Files
actual/packages/desktop-client/e2e/page-models/rules-page.ts
Joel Jeremy Marquez da8072ffbd Re-implement useDisplayPayee to use context to minimize SQL queries (#5795)
* 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>
2025-11-06 09:31:04 -08:00

43 lines
1.1 KiB
TypeScript

import { type Locator, type Page } from '@playwright/test';
import { EditRuleModal } from './edit-rule-modal';
export class RulesPage {
readonly page: Page;
readonly searchBox: Locator;
readonly createNewRuleButton: Locator;
constructor(page: Page) {
this.page = page;
this.searchBox = page.getByPlaceholder('Filter rules...');
this.createNewRuleButton = page.getByRole('button', {
name: 'Create new rule',
});
}
/**
* Open the edit rule modal to create a new rule.
*/
async createNewRule() {
await this.createNewRuleButton.click();
return new EditRuleModal(this.page.getByTestId('edit-rule-modal'));
}
/**
* Retrieve the data for the nth-rule.
* 0-based index
*/
getNthRule(index: number) {
const row = this.page.getByTestId('table').getByTestId('row').nth(index);
return {
conditions: row.getByTestId('conditions').locator(':scope > div'),
actions: row.getByTestId('actions').locator(':scope > div'),
};
}
async searchFor(text: string) {
await this.searchBox.fill(text);
}
}