enso/app/gui/integration-test/dashboard/actions/goToPageActions.ts
somebody1234 b83c5a15eb
Clean up integration tests and add listeners for backend calls (#11847)
- Close https://github.com/enso-org/cloud-v2/issues/1604
- Add ability to track backend calls
- Remove inconsistent integration test code
- Add skeleton classes for settings pages

# Important Notes
None
2024-12-12 09:49:58 +00:00

37 lines
1.3 KiB
TypeScript

/** @file Actions for going to a different page. */
import type { PageCallback } from './BaseActions'
import BaseActions from './BaseActions'
import DrivePageActions from './DrivePageActions'
import EditorPageActions from './EditorPageActions'
import SettingsPageActions from './SettingsPageActions'
/** Actions for going to a different page. */
export interface GoToPageActions<Context> {
readonly drive: () => DrivePageActions<Context>
readonly editor: () => EditorPageActions<Context>
readonly settings: () => SettingsPageActions<Context>
}
/** Generate actions for going to a different page. */
export function goToPageActions<Context>(
step: (name: string, callback: PageCallback<Context>) => BaseActions<Context>,
): GoToPageActions<Context> {
return {
drive: () =>
step('Go to "Data Catalog" page', (page) =>
page
.getByRole('tab')
.filter({ has: page.getByText('Data Catalog') })
.click(),
).into(DrivePageActions<Context>),
editor: () =>
step('Go to "Spatial Analysis" page', (page) =>
page.getByTestId('editor-tab-button').click(),
).into(EditorPageActions<Context>),
settings: () =>
step('Go to "settings" page', (page) => BaseActions.press(page, 'Mod+,')).into(
SettingsPageActions<Context>,
),
}
}