Files
bruno/tests/response/large-response-crash-prevention.spec.ts
Pooja 5e6444b8b5 feat: Set JavaScript sandbox to safe mode by default for new collections (#4824)
* feat: Set JavaScript sandbox to safe mode by default for new collections

* rm: sandbox code in playwright test

* rm: safe mode code in var interpolation test

* rm: sandbox modal code

* fix

* fix

* fix

* fix

* improve

* improvement

* fix

* fix
2025-12-18 17:27:38 +05:30

41 lines
1.6 KiB
TypeScript

import { test, expect } from '../../playwright';
import { closeAllCollections, createCollection, createUntitledRequest } from '../utils/page/actions';
test.describe('Large Response Crash/High Memory Usage Prevention', () => {
// Increase timeout to 1 minute for all tests in this describe block, default is 30 seconds.
// Prevents tests from failing due to timeout while waiting for the response, especially on slower internet connections.
test.setTimeout(1 * 60 * 1000); // 1 minute
test.afterAll(async ({ page }) => {
// cleanup: close all collections
await closeAllCollections(page);
});
test('Show appropriate warning for responses over 10MB', async ({ page, createTmpDir }) => {
const collectionName = 'size-warning-test';
// Create collection (auto-opens the collection)
await createCollection(page, collectionName, await createTmpDir(collectionName));
// Create request using the new dropdown flow
await createUntitledRequest(page, {
requestType: 'HTTP',
url: 'https://samples.json-format.com/employees/json/employees_50MB.json'
});
// Send request
const sendButton = page.getByTestId('send-arrow-icon');
await sendButton.click();
// Verify warning appears
await expect(page.getByText('Large Response Warning')).toBeVisible({ timeout: 60000 });
// Verify warning content
await expect(page.getByText('Handling responses over')).toBeVisible();
await expect(page.getByText('could degrade performance')).toBeVisible();
// Verify action button
await expect(page.getByRole('button', { name: 'View', exact: true })).toBeVisible();
});
});