Skip to content

Commit

Permalink
test: refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
pcheremu committed Aug 7, 2023
1 parent 1a6db57 commit 572697b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 4 additions & 0 deletions tests/e2e/src/pages/main.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ export class MainPage extends BasePage {
return `${this.byTestId}network-switcher`;
}

get confirmFeeChange() {
return "//*[@class='alert-body']//*[contains(string(), 'Confirm')]";
}

async selectTransaction(transactionType: string) {
try {
let route: string;
Expand Down
9 changes: 4 additions & 5 deletions tests/e2e/src/pages/metamask.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { setTimeout } from "timers/promises";

import { BasePage } from "./base.page";
import { MainPage } from "./main.page";
import { Extension } from "../data/data";
import { depositTag, Helper } from "../helpers/helper";
import { config, wallet } from "../support/config";
Expand Down Expand Up @@ -39,9 +40,6 @@ export class MetamaskPage extends BasePage {
return "//*[@class='alert-body']//*[contains(text(), 'Fee has changed')]";
}

get confirmFeeChange() {
return "//*[@class='alert-body']//*[contains(., 'Confirm')]";
}
get saveFeeBtn() {
return "//*[@class='popover-container']//button";
}
Expand Down Expand Up @@ -214,10 +212,11 @@ export class MetamaskPage extends BasePage {
}

async isFeeAlert(helper: Helper, element: string) {
const mainPage = new MainPage(this.world);
const feeAlert = await helper.checkElementVisible(this.feeChangerAlert);
if (feeAlert) {
await helper.checkElementVisible(this.confirmFeeChange);
await this.world.page?.locator(this.confirmFeeChange).first().click();
await helper.checkElementVisible(mainPage.confirmFeeChange);
await this.world.page?.locator(mainPage.confirmFeeChange).first().click();
await this.catchPopUpByClick(element);
return true;
}
Expand Down

0 comments on commit 572697b

Please sign in to comment.