diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index b0384e5d..621437ae 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -66,6 +66,7 @@ jobs: "@artifacts and @various", "@artifacts and @transactionsItems", "@transactions and @withdraw", + "@transactions and @deposit and @blockchain", "@various and @emptyWallet", "@actions and @contacts" ] diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index e734f361..280a43e9 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -48,7 +48,7 @@ jobs: name: E2E secrets: inherit with: - targetUrl: ${{ needs.build.outputs.dappUrl }} + targetUrl: ${{ needs.deploy.outputs.dappUrl }} network: Goerli publish_to_allure: true environmentTags: "" diff --git a/tests/e2e/features/artifacts/swapPage/artifacts-swap.feature b/tests/e2e/features/artifacts/swapPage/artifacts-swap.feature index beef37a1..cf26c3ab 100644 --- a/tests/e2e/features/artifacts/swapPage/artifacts-swap.feature +++ b/tests/e2e/features/artifacts/swapPage/artifacts-swap.feature @@ -8,8 +8,8 @@ Feature: Artifacts - UI - Swap Scenario: Check artifacts for the Swap page Given I go to page "/payments/?network=era-goerli" When I click by text "Swap" - Then Element with "text" "Swap tokens" should be "visible " - Then Element with "xpath" "//*[@class='arrow-icon']" should be "visible " + Then Element with "text" "Swap tokens" should be "visible" + Then Element with "xpath" "//*[@class='arrow-icon']" should be "visible" Then Element with "xpath" "//*[@class='arrow-icon']" should be "clickable" Then Element with "partial href and text" "'https://app.mute.io/swap' and 'Mute.io'" should be "visible" Then Element with "partial href and text" "'https://app.mute.io/swap' and 'Mute.io'" should be "clickable" diff --git a/tests/e2e/features/transactions/deposit/deposit-with-blockchcain.feature b/tests/e2e/features/transactions/deposit/deposit-with-blockchcain.feature new file mode 100644 index 00000000..46f92249 --- /dev/null +++ b/tests/e2e/features/transactions/deposit/deposit-with-blockchcain.feature @@ -0,0 +1,19 @@ +@deposit @regression @transactions @blockchain +Feature: Deposit + + Background: + Given Connect Metamask extension with login action + + @id1418 + Scenario: Make a deposit in ETH + 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 "empty" + Then Element with "testId" "fee-amount" should be "visible" + Then Fee should have "$" value + Then Fee should have "ETH" value + When I choose "ETH" as token and insert "0.0000000001" as amount + When I "confirm" transaction after clicking "Add funds to zkSync Era Testnet" button + Then Message "Transaction submitted" should be visible + diff --git a/tests/e2e/src/pages/base.page.ts b/tests/e2e/src/pages/base.page.ts index c23adc93..7668d7e5 100644 --- a/tests/e2e/src/pages/base.page.ts +++ b/tests/e2e/src/pages/base.page.ts @@ -270,6 +270,7 @@ export class BasePage { const helper = new Helper(this.world); element = await this.returnElementByType(elementType, value); let result; + const reDigits = new RegExp(`\d*([\,\.]?\d*)`); //eslint-disable-line if (checkType === "visible") { await expect(element).toBeVisible({ timeout: config.increasedTimeout.timeout }); @@ -286,6 +287,10 @@ export class BasePage { } else if (checkType === "enabled") { result = await element.isDisabled(); await expect(result).toBe(false); + } else if (checkType === "empty") { + await expect(element).toHaveValue(""); + } else if (checkType.length !== 0 && reDigits.test(checkType)) { + await expect(element).toHaveValue(checkType); } } } diff --git a/tests/e2e/src/pages/main.page.ts b/tests/e2e/src/pages/main.page.ts index e831e9f2..0f14b914 100644 --- a/tests/e2e/src/pages/main.page.ts +++ b/tests/e2e/src/pages/main.page.ts @@ -85,6 +85,10 @@ export class MainPage extends BasePage { return `//*[@type='button' and contains(., '${buttonName}')] | //button[text()[contains(string(), '${buttonName}')]]`; } + get confirmFeeChangeButton() { + return "//button[text()='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 8471e6f7..3508ba82 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"; @@ -35,6 +36,9 @@ export class MetamaskPage extends BasePage { get feeChangerBtn() { return "//div[@class='edit-gas-display']//button"; } + get feeChangerAlert() { + return "//p[contains(text(), 'Fee has changed')]"; + } get saveFeeBtn() { return "//*[@class='popover-container']//button"; @@ -176,15 +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(config.minimalTimeout.timeout); await popUpContext?.setViewportSize(config.popUpWindowSize); await popUpContext?.click(this.confirmTransaction); } @@ -196,11 +195,25 @@ export class MetamaskPage extends BasePage { const [popUp] = await Promise.all([ this.world.context?.waitForEvent("page"), await helper.checkElementVisible(element), - await this.world.page?.locator(element).first().click(), + await await this.world.page?.locator(element).first().click(), + await setTimeout(config.defaultTimeout.timeout), + await this.isFeeAlert(element), ]); + return popUp; } + 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.confirmFeeChangeButton); + await this.click(mainPage.confirmFeeChangeButton); + await this.catchPopUpByClick(element); + } + } + async catchPopUp() { const [popUp] = await Promise.all([this.world.context?.waitForEvent("page")]); return popUp; diff --git a/tests/e2e/src/steps/portal.steps.ts b/tests/e2e/src/steps/portal.steps.ts index 421706b7..9ca11c5a 100644 --- a/tests/e2e/src/steps/portal.steps.ts +++ b/tests/e2e/src/steps/portal.steps.ts @@ -257,6 +257,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?.waitForSelector(element); result = await this.page?.locator(element); await expect(result).toContainText(fee); });