Files
actual/packages/desktop-client/e2e/page-models/mobile-budget-menu-modal.ts
Joel Jeremy Marquez 0504becaf5 [TypeScript] Convert test page models to TS (#4218)
* Dummy commit

* Delete js snapshots

* Move extended expect and test to fixtures

* Fix wrong commit

* Update VRT

* Dummy commit to run GH actions

* Convert test page models to TS

* Release notes

* Fix typecheck errors

* New page models to TS

* Fix typecheck error

* Fix page name

* Put awaits on getTableTotals

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-16 10:24:38 -08:00

67 lines
1.9 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { type Locator, type Page } from '@playwright/test';
export class BudgetMenuModal {
readonly page: Page;
readonly locator: Locator;
readonly heading: Locator;
readonly budgetAmountInput: Locator;
readonly copyLastMonthBudgetButton: Locator;
readonly setTo3MonthAverageButton: Locator;
readonly setTo6MonthAverageButton: Locator;
readonly setToYearlyAverageButton: Locator;
readonly applyBudgetTemplateButton: Locator;
constructor(locator: Locator) {
this.locator = locator;
this.page = locator.page();
this.heading = locator.getByRole('heading');
this.budgetAmountInput = locator.getByTestId('amount-input');
this.copyLastMonthBudgetButton = locator.getByRole('button', {
name: 'Copy last months budget',
});
this.setTo3MonthAverageButton = locator.getByRole('button', {
name: 'Set to 3 month average',
});
this.setTo6MonthAverageButton = locator.getByRole('button', {
name: 'Set to 6 month average',
});
this.setToYearlyAverageButton = locator.getByRole('button', {
name: 'Set to yearly average',
});
this.applyBudgetTemplateButton = locator.getByRole('button', {
name: 'Apply budget template',
});
}
async close() {
await this.heading.getByRole('button', { name: 'Close' }).click();
}
async setBudgetAmount(newAmount: string) {
await this.budgetAmountInput.fill(newAmount);
await this.budgetAmountInput.blur();
await this.close();
}
async copyLastMonthBudget() {
await this.copyLastMonthBudgetButton.click();
}
async setTo3MonthAverage() {
await this.setTo3MonthAverageButton.click();
}
async setTo6MonthAverage() {
await this.setTo6MonthAverageButton.click();
}
async setToYearlyAverage() {
await this.setToYearlyAverageButton.click();
}
async applyBudgetTemplate() {
await this.applyBudgetTemplateButton.click();
}
}