diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2022-09-29 15:18:58 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2022-10-03 16:50:24 +0200 |
| commit | 339f506fb8a32b0e33c53b1c4e4d091bc01e297e (patch) | |
| tree | ce49b780bde8d8ee7a9671b323e3235b8f36c028 /gui/test | |
| parent | 1d017dd9eb0b5f8e75a871d661fc55f50f3b3b94 (diff) | |
| download | mullvadvpn-339f506fb8a32b0e33c53b1c4e4d091bc01e297e.tar.xz mullvadvpn-339f506fb8a32b0e33c53b1c4e4d091bc01e297e.zip | |
Add locator for data-test-id
Diffstat (limited to 'gui/test')
| -rw-r--r-- | gui/test/e2e/utils.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gui/test/e2e/utils.ts b/gui/test/e2e/utils.ts index 9618136962..0c68d47d49 100644 --- a/gui/test/e2e/utils.ts +++ b/gui/test/e2e/utils.ts @@ -1,8 +1,11 @@ import { Locator, Page, _electron as electron, ElectronApplication } from 'playwright'; +export type GetByTestId = (id: string) => Locator; + export interface StartAppResponse { app: ElectronApplication; page: Page; + getByTestId: GetByTestId; } export const startApp = async (mainPath: string): Promise<StartAppResponse> => { @@ -22,7 +25,9 @@ export const startApp = async (mainPath: string): Promise<StartAppResponse> => { console.log(msg.text()); }); - return { app, page }; + const getByTestId = (id: string) => page.locator(`data-test-id=${id}`); + + return { app, page, getByTestId }; }; const getStyleProperty = (locator: Locator, property: string) => { |
