Files
bruno/tests/response/large-response-crash-prevention.spec.ts
Abhishek S Lal a798b32f25 feat: add response data type selector in response viewer (#6100)
* feat: add response data type selector in response viewer

* chore: fixed lint issue

* test: add test for resonse format change and preview.

* refactor: streamline response format tests with utility functions for navigation and format switching

* refactor: simplify ButtonDropdown component and enhance QueryResultTypeSelector with header and toggle switch

* feat: enhance ButtonDropdown with prefix and suffix props; implement content type detection and update QueryResult for improved format handling

* fix: lint errors resolved

* fix: remove unnecessary blank line to resolve lint issues

* fix: update response format tests

* refactor: remove preview tab locator from response format tests

* fix: update dependency in useEffect to include previewFormatOptions for accurate format handling

* refactor: reorganize imports and enhance QueryResult component for improved format handling and error display

* fix: update error messages in response format preview tests and adjust version in JSON fixture

* feat: add drag detection to HtmlPreview component and update structure for improved user interaction

* refactor: update ResponsePane components for improved structure and functionality;

replace QueryResult with QueryResponse, enhance layout handling, and streamline response actions

* refactor: remove ButtonDropdown component and associated styles;

* refactor: moved ErrorAlert to ui folder

* fix: lint error

* feat: add data-testid attributes to Collection and CollectionItem components for improved testability

* feat: hide dropdown on select in response selector

* fix: update QueryResult component to use detectedContentType for format handling

* test: update ResponseLayoutToggle tests to use data-testid for button selection

* feat: add data-testid attribute to ResponseClear component for improved testability

* refactor: implement clickResponseAction utility for streamlined response action handling in tests

* feat: add data-testid attribute to ResponseCopy component for enhanced testability

* fix: unwanted code in test
2025-12-09 23:45:01 +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
await createCollection(page, collectionName, await createTmpDir(collectionName), { openWithSandboxMode: 'safe' });
// 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();
});
});