import { Page } from '@playwright/test'; import { P2MUi } from '../p2m/ui'; import { NAV, FIELD, BUTTON } from './labels'; /** Page actions for the MOCK PPM pack (same locator policy as the other packs). Every label comes from ./labels.ts. */ export class PPMUi extends P2MUi { constructor(page: Page) { super(page); } async ppmNav(key: keyof typeof NAV) { await this.go(NAV[key]); } textbox(name: string) { return this.page.getByRole('textbox', { name, exact: true }); } combo(name: string) { return this.page.getByRole('combobox', { name, exact: true }); } /** Fill a search textbox (Project / Adjustment / Invoice) and press the Search button of that same form. */ async searchField(field: string, value: string) { const box = this.textbox(field); await box.fill(value); await this.page.getByRole('search', { name: field, exact: true }).getByRole('button', { name: BUTTON.search, exact: true }).click(); } async projectSearch(project: string) { await this.searchField(FIELD.project, project); } }