import type { Locator, Page, PackageConfig } from '@genesislcap/foundation-testing/e2e'; import { defaultAuditThresholds, playAudit } from '@genesislcap/foundation-testing/e2e'; export class EntityManagementPage { config: PackageConfig; port: number; page: Page; entityList: Locator; username: Locator; password: Locator; constructor(config: PackageConfig, port: number, page: Page) { this.config = config; this.port = port; this.page = page; /** * Locate fields not guarded by conditionals upfront, and the remaining on-demand */ this.entityList = this.page.locator('data-test-id=entity-list'); this.username = this.page.locator('data-test-id=username').locator('input'); this.password = this.page.locator('data-test-id=password').locator('input'); } async goto() { await this.page.goto('/'); } async audit() { await playAudit({ page: this.page, port: this.port, thresholds: defaultAuditThresholds, // TODO: this should be coming from foundation-testing/src/playwright/test.ts base config }); } async autofill( username: string = this.config.DEFAULT_USER, password: string = this.config.DEFAULT_PASSWORD, ) { await this.username.fill(username); await this.password.fill(password); } }