diff --git a/tests/e2e/features/transactions/deposit/deposit-with-blockchcain.feature b/tests/e2e/features/transactions/deposit/deposit-with-blockchcain.feature index 5d3c8bbf..30af8dbf 100644 --- a/tests/e2e/features/transactions/deposit/deposit-with-blockchcain.feature +++ b/tests/e2e/features/transactions/deposit/deposit-with-blockchcain.feature @@ -9,6 +9,7 @@ Feature: Deposit Given I am on the Main page Given I go to "Deposit" transaction section When I click by "text" with "Your account" value + Then Element with "id" "amount-input" should be "" Then Element with "testId" "fee-amount" should be "visible" Then Fee should have "$" value Then Fee should have "ETH" value diff --git a/tests/e2e/src/pages/base.page.ts b/tests/e2e/src/pages/base.page.ts index 246fc047..c7ad7be2 100644 --- a/tests/e2e/src/pages/base.page.ts +++ b/tests/e2e/src/pages/base.page.ts @@ -278,6 +278,8 @@ export class BasePage { } else if (checkType === "enabled") { result = await element.isDisabled(); await expect(result).toBe(false); + } else { + await expect(element).toHaveValue(checkType); } } } diff --git a/tests/e2e/src/pages/main.page.ts b/tests/e2e/src/pages/main.page.ts index 2ac38630..01a85958 100644 --- a/tests/e2e/src/pages/main.page.ts +++ b/tests/e2e/src/pages/main.page.ts @@ -77,8 +77,8 @@ export class MainPage extends BasePage { return `${this.byTestId}network-switcher`; } - get confirmFeeChange() { - return "//*[@class='alert-body']//*[contains(string(), 'Confirm')]"; + get confirmFeeChangeButton() { + return "//button[text()='Confirm']"; } async selectTransaction(transactionType: string) { diff --git a/tests/e2e/src/pages/metamask.page.ts b/tests/e2e/src/pages/metamask.page.ts index a707a853..3508ba82 100644 --- a/tests/e2e/src/pages/metamask.page.ts +++ b/tests/e2e/src/pages/metamask.page.ts @@ -37,7 +37,7 @@ export class MetamaskPage extends BasePage { return "//div[@class='edit-gas-display']//button"; } get feeChangerAlert() { - return "//*[@class='alert-body']//*[contains(text(), 'Fee has changed')]"; + return "//p[contains(text(), 'Fee has changed')]"; } get saveFeeBtn() { @@ -180,17 +180,10 @@ export class MetamaskPage extends BasePage { try { await this.switchNetwork(); } finally { - await setTimeout(2.5 * 1000); + await setTimeout(config.minimalTimeout.timeout); await this.click(this.continueBtn); - // const confirmBtnSelector = "//*[@class='alert-body']//button"; - // const confirmBtn: any = await this.world.page?.locator(confirmBtnSelector); - // if (await confirmBtn.isEnabled()) { - // console.log("spotted"); - // await this.click(confirmBtn); - // } const popUpContext = await this.catchPopUpByClick(`//span[contains(text(),'${triggeredElement}')]`); - await setTimeout(2.5 * 1000); - + await setTimeout(config.minimalTimeout.timeout); await popUpContext?.setViewportSize(config.popUpWindowSize); await popUpContext?.click(this.confirmTransaction); } @@ -202,25 +195,23 @@ export class MetamaskPage extends BasePage { const [popUp] = await Promise.all([ this.world.context?.waitForEvent("page"), await helper.checkElementVisible(element), - //await helper.checkElementClickable(element), - await this.world.page?.locator(element).first().click(), - await setTimeout(10 * 1000), - await this.isFeeAlert(helper, element), + await await this.world.page?.locator(element).first().click(), + await setTimeout(config.defaultTimeout.timeout), + await this.isFeeAlert(element), ]); return popUp; } - async isFeeAlert(helper: Helper, element: string) { + async isFeeAlert(element: string) { + const helper = new Helper(this.world); const mainPage = new MainPage(this.world); const feeAlert = await helper.checkElementVisible(this.feeChangerAlert); if (feeAlert) { - await helper.checkElementVisible(mainPage.confirmFeeChange); - await this.world.page?.locator(mainPage.confirmFeeChange).first().click(); + await helper.checkElementVisible(mainPage.confirmFeeChangeButton); + await this.click(mainPage.confirmFeeChangeButton); await this.catchPopUpByClick(element); - return true; } - return false; } async catchPopUp() { diff --git a/tests/e2e/src/steps/portal.steps.ts b/tests/e2e/src/steps/portal.steps.ts index 6aa940aa..4ec4eb39 100644 --- a/tests/e2e/src/steps/portal.steps.ts +++ b/tests/e2e/src/steps/portal.steps.ts @@ -252,7 +252,7 @@ Then("Fee should have {string} value", config.stepTimeout, async function (this: mainPage = new MainPage(this); basePage = new BasePage(this); element = mainPage.feeValue; - await this.page?.waitForTimeout(5000); + await this.page?.waitForSelector(element); result = await this.page?.locator(element); await expect(result).toContainText(fee); });