Skip to content

Commit

Permalink
test: refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
pcheremu committed Aug 24, 2023
1 parent d94f9d3 commit 10247f0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions tests/e2e/src/helpers/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,19 @@ export class Helper {
return result;
}

async checkSelectorHidden(selector: string, waitTime = 10000): Promise<boolean> {
result = true;
try {
await this.world.page?.waitForSelector(selector, {
state: "hidden",
timeout: waitTime,
});
} catch {
result = false;
}
return result;
}

async checkElementClickable(element: any, waitTime = 10000): Promise<boolean> {
result = true;
try {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/src/pages/revoke.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class RevokePage extends BasePage {
selector = await this.revokeButton("Revoking");
const revokingButtonIsVisible = await helper.checkElementVisible(selector);
if (revokingButtonIsVisible) {
await this.world.page?.waitForSelector(selector, { state: "hidden", timeout: config.increasedTimeout.timeout });
await helper.checkSelectorHidden(selector, config.increasedTimeout.timeout);
}
}
}

0 comments on commit 10247f0

Please sign in to comment.