mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-11 12:43:09 -05:00
* Re-implement useDisplayPayee to use context to minimize SQL queries * Rename ScrollProvider to useScrollListener and move to hooks folder * Add DisplayPayeeContextProvider to TransactionsTable.test.tsx * Set higher page count * Fix payee autocomplete search * [autofix.ci] apply automated fixes * Fix highlight of Create payee * Show search if there are 100 payees * Cleanup * Rename to DisplayPayeeProvider * Update VRT screenshots Auto-generated by VRT workflow PR: #5795 * Update VRT screenshots Auto-generated by VRT workflow PR: #5795 * Fix new payee not being created in tests * Update VRT screenshots Auto-generated by VRT workflow PR: #5795 * Update rules test to use pressSequentially * [autofix.ci] apply automated fixes * Coderabbit suggestion * Fix typecheck error * Cleanup * Update VRT screenshots Auto-generated by VRT workflow PR: #5795 * Revert VRT * Move DisplayPayeeProvider location * Recert https on E2E start url * Fix lint --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
79 lines
2.2 KiB
TypeScript
79 lines
2.2 KiB
TypeScript
import { type Page, type Locator } from '@playwright/test';
|
|
|
|
type ScheduleEntry = {
|
|
scheduleName?: string;
|
|
payee?: string;
|
|
account?: string;
|
|
amount?: number;
|
|
};
|
|
|
|
export class ScheduleEditModal {
|
|
readonly page: Page;
|
|
readonly locator: Locator;
|
|
readonly heading: Locator;
|
|
readonly scheduleNameInput: Locator;
|
|
readonly payeeInput: Locator;
|
|
readonly accountInput: Locator;
|
|
readonly amountInput: Locator;
|
|
readonly addButton: Locator;
|
|
readonly saveButton: Locator;
|
|
readonly cancelButton: Locator;
|
|
|
|
constructor(locator: Locator) {
|
|
this.locator = locator;
|
|
this.page = locator.page();
|
|
|
|
this.heading = locator.getByRole('heading');
|
|
this.scheduleNameInput = locator.getByRole('textbox', {
|
|
name: 'Schedule name',
|
|
});
|
|
this.payeeInput = locator.getByRole('textbox', { name: 'Payee' });
|
|
this.accountInput = locator.getByRole('textbox', { name: 'Account' });
|
|
this.amountInput = locator.getByLabel('Amount');
|
|
this.addButton = locator.getByRole('button', { name: 'Add' });
|
|
this.saveButton = locator.getByRole('button', { name: 'Save' });
|
|
this.cancelButton = locator.getByRole('button', { name: 'Cancel' });
|
|
}
|
|
|
|
async fill(data: ScheduleEntry) {
|
|
// Using pressSequentially on autocomplete fields here to simulate user typing.
|
|
// When using .fill(...), playwright just "pastes" the entire word onto the input
|
|
// and for some reason this breaks the autocomplete highlighting logic
|
|
// e.g. "Create payee" option is not being highlighted.
|
|
|
|
if (data.scheduleName) {
|
|
await this.scheduleNameInput.fill(data.scheduleName);
|
|
}
|
|
|
|
if (data.payee) {
|
|
await this.payeeInput.pressSequentially(data.payee);
|
|
await this.page.keyboard.press('Enter');
|
|
}
|
|
|
|
if (data.account) {
|
|
await this.accountInput.pressSequentially(data.account);
|
|
await this.page.keyboard.press('Enter');
|
|
}
|
|
|
|
if (data.amount) {
|
|
await this.amountInput.fill(String(data.amount));
|
|
}
|
|
}
|
|
|
|
async save() {
|
|
await this.saveButton.click();
|
|
}
|
|
|
|
async add() {
|
|
await this.addButton.click();
|
|
}
|
|
|
|
async cancel() {
|
|
await this.cancelButton.click();
|
|
}
|
|
|
|
async close() {
|
|
await this.heading.getByRole('button', { name: 'Close' }).click();
|
|
}
|
|
}
|