Files
bruno/tests/response/json-response-formatting/json-response-formatting.spec.ts
Siddharth Gelera (reaper) efad149afc HTTP stream enhancements (#6077)
* feat: add stop request button in api url bar

* docs: add farsi translation

* fix: handle escaped forward slashes by fast-json-format library upgrade

* refactor: change ui to use one from Websockets

* chore: cleanup

* fix: lint issues

* Replace IconPlayerStop with IconSquareRoundedX

* update json request and response formatting logic

* chore: format changes

* chore: remove un-needed diffs

* chore: sanitize

* bugfix(#5939): curl import fails for custom content-types

* chore: remove un-needed diffs

* chore: enhance response handling for streaming

* fix: disable requestid check for tests and assertions to be updated after streaming result

* chore: housekeeping

* fix: streamline loading and cancel request icon logic

* chore: formatting

* fix: multiple co-pilot changes

* fix: handle in folders

* feat: add WaitGroup utility for managing concurrent tasks

* refactor: remove WaitGroup utility and clean up network IPC logic

* refactor: remove unused setTimeout import and clean up post script execution

* refactor: clean up post-response script execution logic

* undiff

* re-align

* refactor: streamline post-response script execution

- Cleaned up formatting and improved readability of the post-response script execution logic.
- Consolidated parameters in function calls for consistency.

* fix: keep original dataBuffer for saving response

---------

Co-authored-by: adarshajit <adarshajit@gmail.com>
Co-authored-by: sajadoncode <sajadoncode@gmail.com>
Co-authored-by: lohit-bruno <lohit@usebruno.com>
Co-authored-by: Bijin A B <bijin@usebruno.com>
Co-authored-by: Pragadesh-45 <temporaryg7904@gmail.com>
Co-authored-by: Anoop M D <anoop@usebruno.com>
Co-authored-by: Anoop M D <anoop.md1421@gmail.com>
Co-authored-by: Dawid Góra <dawidgora@icloud.com>
2025-11-14 16:57:29 +05:30

44 lines
1.7 KiB
TypeScript

import { test, expect } from '../../../playwright';
import { closeAllCollections } from '../../utils/page';
test.describe.serial('JSON Response Formatting', () => {
test.afterAll(async ({ pageWithUserData: page }) => {
// cleanup: close all collections
await closeAllCollections(page);
});
test('should handle BigInt values and unicode chars in JSON response formatting', async ({ pageWithUserData: page }) => {
await test.step('Navigate to collection and request', async () => {
// Navigate to the test collection
await expect(page.locator('#sidebar-collection-name').getByText('collection')).toBeVisible();
await page.locator('#sidebar-collection-name').getByText('collection').click();
// Navigate to the request
await page.getByRole('complementary').getByText('request').click();
});
await test.step('Send request and verify response', async () => {
// Send the request
await page.getByTestId('send-arrow-icon').click();
// Wait for response
await expect(page.getByTestId('response-status-code')).toContainText('200', { timeout: 15000 });
// Verify the response is properly formatted JSON
const responseBody = page.locator('.response-pane');
await expect(responseBody).toBeVisible();
// The response should preserve `bigint` value precision
await expect(responseBody).toContainText('1736184243098437392');
// The response should handle unicode chars
await expect(responseBody).toContainText('一');
await expect(responseBody).toContainText('二');
await expect(responseBody).toContainText('三');
// The response should handle escaped forward slashes
await expect(responseBody).toContainText('/url/path/');
});
});
});