mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-29 07:34:07 +00:00
test(websocket): refactor to use constant for BRU_FILE_NAME
Updated the test cases to utilize a constant for the BRU_FILE_NAME regex pattern for better maintainability and readability.
This commit is contained in:
@@ -2,19 +2,20 @@ import { expect, test } from '../../playwright';
|
||||
import { buildCommonLocators } from './lib/locators';
|
||||
|
||||
const MAX_CONNECTION_TIME = 3000;
|
||||
const BRU_FILE_NAME = /^ws-test-request$/
|
||||
|
||||
test.describe.serial('websockets', () => {
|
||||
test.setTimeout(2 * 10 * 1000);
|
||||
test('websocket requests are visible', async ({ pageWithUserData: page, restartApp }) => {
|
||||
await page.locator('#sidebar-collection-name').click();
|
||||
|
||||
expect(page.locator('span.item-name').filter({ hasText: 'ws-test-request' })).toBeVisible();
|
||||
expect(page.locator('span.item-name').filter({ hasText: BRU_FILE_NAME })).toBeVisible();
|
||||
});
|
||||
|
||||
test('websocket connects', async ({ pageWithUserData: page, restartApp }) => {
|
||||
const locators = buildCommonLocators(page);
|
||||
|
||||
await page.getByTitle('ws-test-request').click();
|
||||
await page.getByTitle(BRU_FILE_NAME).click();
|
||||
await locators.connectionControls.connect().click();
|
||||
|
||||
await expect(locators.connectionControls.disconnect()).toBeAttached({
|
||||
@@ -60,7 +61,7 @@ test.describe.serial('websockets', () => {
|
||||
await locators.runner().click();
|
||||
|
||||
const messages = await locators.messages();
|
||||
|
||||
|
||||
expect(await messages[1].locator('.text-ellipsis').innerText()).toMatch('{ "foo": "bar" }');
|
||||
|
||||
expect(await messages[2].locator('.text-ellipsis').innerText()).toMatch('{ "data": { "foo": "bar" } }');
|
||||
|
||||
Reference in New Issue
Block a user