enso/app/gui/integration-test/dashboard/actions/SettingsFormActions.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

35 lines
1.2 KiB
TypeScript

/** @file Actions for the "account" form in settings. */
import type { Locator, Page } from '@playwright/test'
import { TEXT } from '.'
import type { BaseActionsClass } from './BaseActions'
import PageActions from './PageActions'
/** Actions for the "account" form in settings. */
export default class SettingsFormActions<
Context,
ParentClass extends BaseActionsClass<Context>,
> extends PageActions<Context> {
/** Construct a {@link SettingsFormActions}. */
constructor(
private parentClass: ParentClass,
protected locate: (page: Page) => Locator,
...args: ConstructorParameters<typeof PageActions<Context>>
) {
super(...args)
}
/** Save and submit this settings section. */
save(): InstanceType<ParentClass> {
return this.step('Save settings form', (page) =>
this.locate(page).getByRole('button', { name: TEXT.save }).getByText(TEXT.save).click(),
).into(this.parentClass)
}
/** Cancel editing this settings section. */
cancel(): InstanceType<ParentClass> {
return this.step('Cancel editing settings form', (page) =>
this.locate(page).getByRole('button', { name: TEXT.cancel }).getByText(TEXT.cancel).click(),
).into(this.parentClass)
}
}