From 572697b22340acc2159825818380f7d5eae6b0f3 Mon Sep 17 00:00:00 2001 From: pcheremu Date: Wed, 2 Aug 2023 22:12:33 +0200 Subject: [PATCH] test: refactoring --- tests/e2e/src/pages/main.page.ts | 4 ++++ tests/e2e/src/pages/metamask.page.ts | 9 ++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/e2e/src/pages/main.page.ts b/tests/e2e/src/pages/main.page.ts index b8e0cc121..2ac386306 100644 --- a/tests/e2e/src/pages/main.page.ts +++ b/tests/e2e/src/pages/main.page.ts @@ -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; diff --git a/tests/e2e/src/pages/metamask.page.ts b/tests/e2e/src/pages/metamask.page.ts index bdbc775d9..a707a8531 100644 --- a/tests/e2e/src/pages/metamask.page.ts +++ b/tests/e2e/src/pages/metamask.page.ts @@ -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"; @@ -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"; } @@ -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; }