From 5155e8a49fc9429613b55e57c182604169a00d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbyn=C4=9Bk=20Dr=C3=A1pela?= Date: Thu, 11 Jul 2024 13:09:06 +0200 Subject: [PATCH] Add check enabled and then click page --- .../playwright/support/pages/CatalogImport.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/e2e-tests/playwright/support/pages/CatalogImport.ts b/e2e-tests/playwright/support/pages/CatalogImport.ts index e3cab0374..fe9ca9fc4 100644 --- a/e2e-tests/playwright/support/pages/CatalogImport.ts +++ b/e2e-tests/playwright/support/pages/CatalogImport.ts @@ -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);