Skip to content

Commit

Permalink
Fix mobile budget page
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-jeremy committed Sep 24, 2024
1 parent c223444 commit 08f8ef4
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions packages/desktop-client/e2e/page-models/mobile-budget-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,20 @@ export class MobileBudgetPage {
`budgeted-${categoryName}-button`,
);

if (!(await budgetedButton.isVisible())) {
await this.toggleVisibleColumns();
budgetedButton = await this.getBudgetedButton(categoryName);
if ((await budgetedButton.count()) > 0) {
return budgetedButton;
}

return budgetedButton;
await this.toggleVisibleColumns();
budgetedButton = await this.getBudgetedButton(categoryName);

if ((await budgetedButton.count()) > 0) {
return budgetedButton;
}

throw new Error(
`Budget button for category ${categoryName} could not be located`,
);
}

async openBudgetMenu(categoryName) {
Expand All @@ -61,14 +69,22 @@ export class MobileBudgetPage {
}

async getSpentButton(categoryName) {
let budgetedButton = this.page.getByTestId(`spent-${categoryName}-button`);
let spentButton = this.page.getByTestId(`spent-${categoryName}-button`);

if (!(await budgetedButton.isVisible())) {
await this.toggleVisibleColumns();
budgetedButton = await this.getSpentButton(categoryName);
if ((await spentButton.count()) > 0) {
return spentButton;
}

return budgetedButton;
await this.toggleVisibleColumns();
spentButton = await this.getSpentButton(categoryName);

if ((await spentButton.count()) > 0) {
return spentButton;
}

throw new Error(
`Spent button for category ${categoryName} could not be located`,
);
}

async openSpentPage(categoryName) {
Expand Down

0 comments on commit 08f8ef4

Please sign in to comment.