Files
actual/packages/desktop-client/e2e/page-models/mobile-account-page.js
Joel Jeremy Marquez 3cefd98ce9 useTransactions hook to simplify loading of transactions (#3685)
* useTransactions hook to load transactions

* Release notes + lint fix

* Update useQuery

* useTransactions update

* Stabilize tests

* Fx flaky test

* Fix tests

* Fix tests

* Update queries

* Apply coderabbit suggestions

* Fix onlySync

* Update useTransactions

* Code rabbit suggestions

* useTransactionsSearch hook

* Debounce the useTransactionsSearch search method

* usePreviewTransactions debounce fix

* Fix lint

* Coderabbit feedback + make useSchedules consistent with query pattern used in useTransactions

* Code review feedback and improve schedules loading

* Update error handling

* Cancel debounce on unmount

* Fix lint

* set loading state on error

* Fix test

* VRT

* Revert VRT

---------

Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>
2024-11-11 22:41:42 -08:00

48 lines
1.2 KiB
JavaScript

import { MobileTransactionEntryPage } from './mobile-transaction-entry-page';
export class MobileAccountPage {
constructor(page) {
this.page = page;
this.heading = page.getByRole('heading');
this.balance = page.getByTestId('transactions-balance');
this.noTransactionsMessage = page.getByText('No transactions');
this.searchBox = page.getByPlaceholder(/^Search/);
this.transactionList = page.getByLabel('Transaction list');
this.transactions = this.transactionList.getByRole('button');
this.createTransactionButton = page.getByRole('button', {
name: 'Add Transaction',
});
}
async waitFor() {
await this.transactionList.waitFor();
}
/**
* Retrieve the balance of the account as a number
*/
async getBalance() {
return parseInt(await this.balance.textContent(), 10);
}
/**
* Search by the given term
*/
async searchByText(term) {
await this.searchBox.fill(term);
}
async clearSearch() {
await this.searchBox.clear();
}
/**
* Go to transaction creation page
*/
async clickCreateTransaction() {
this.createTransactionButton.click();
return new MobileTransactionEntryPage(this.page);
}
}