Skip to content

Commit

Permalink
Add check enabled and then click page
Browse files Browse the repository at this point in the history
  • Loading branch information
zdrapela committed Jul 11, 2024
1 parent 2f8c4b2 commit 5155e8a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions e2e-tests/playwright/support/pages/CatalogImport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,26 @@ export class BackstageShowcase {
return response.json();
}

async checkEnabledAndClick(locator: string) {
if (await this.page.locator(locator).isEnabled()) {
await this.page.click(locator);
}
}

async clickNextPage() {
await this.page.click(BackstageShowcasePO.tableNextPage);
await this.checkEnabledAndClick(BackstageShowcasePO.tableNextPage);
}

async clickPreviousPage() {
await this.page.click(BackstageShowcasePO.tablePreviousPage);
await this.checkEnabledAndClick(BackstageShowcasePO.tablePreviousPage);
}

async clickLastPage() {
await this.page.click(BackstageShowcasePO.tableLastPage);
await this.checkEnabledAndClick(BackstageShowcasePO.tableLastPage);
}

async clickFirstPage() {
await this.page.click(BackstageShowcasePO.tableFirstPage);
await this.checkEnabledAndClick(BackstageShowcasePO.tableFirstPage);
}
async verifyPRRowsPerPage(rows, allPRs) {
await this.selectRowsPerPage(rows);
Expand Down

0 comments on commit 5155e8a

Please sign in to comment.