refactor: locators, tests, new request design

This commit is contained in:
Siddharth Gelera
2025-10-01 13:28:58 +05:30
parent 0ed2ec1e20
commit e805beaf83
6 changed files with 74 additions and 69 deletions

View File

@@ -0,0 +1,26 @@
import { Page } from '../../../playwright';
export const buildWebsocketCommonLocators = (page: Page) => ({
runner: () => page.getByTestId('run-button'),
saveButton: () => page
.locator('.infotip')
.filter({ hasText: /^Save/ }),
connectionControls: {
connect: () =>
page
.locator('div.connection-controls')
.locator('.infotip')
.filter({ hasText: /^Connect$/ }),
disconnect: () =>
page
.locator('div.connection-controls')
.locator('.infotip')
.filter({ hasText: /^Close Connection$/ })
},
messages: () => page.locator('.ws-message').all(),
toolbar: {
latestFirst: () => page.getByRole('button', { name: 'Latest First' }),
latestLast: () => page.getByRole('button', { name: 'Latest Last' }),
clearResponse: () => page.getByRole('button', { name: 'Clear Response' })
}
});