From 117c6342ea4d00c3604d4422c5a428550ec6e9a0 Mon Sep 17 00:00:00 2001 From: eunjisong Date: Mon, 9 Dec 2024 11:27:04 -0500 Subject: [PATCH 1/2] all dapps testing passing --- .../e2e/helpers/playwrightActions.ts | 4 +- .../e2e/helpers/playwrightSetup.ts | 13 +-- .../e2e/locators/commonPlaywrightEls.loc.ts | 4 +- .../core-mobile/e2e/locators/uniswap.loc.ts | 5 -- packages/core-mobile/e2e/pages/aave.page.ts | 15 ---- .../core-mobile/e2e/pages/balancer.page.ts | 39 --------- packages/core-mobile/e2e/pages/benqi.page.ts | 15 ---- .../e2e/pages/commonPlaywrightEls.page.ts | 64 ++++++++++---- .../e2e/pages/compoundFinance.page.ts | 15 ---- .../e2e/pages/convexFinance.page.ts | 23 ----- .../e2e/pages/dappsPlaywright.page.ts | 85 +++++++++++++++++++ packages/core-mobile/e2e/pages/gmx.page.ts | 15 ---- .../core-mobile/e2e/pages/instadapp.page.ts | 38 --------- .../core-mobile/e2e/pages/multichain.page.ts | 15 ---- packages/core-mobile/e2e/pages/oasis.page.ts | 15 ---- .../core-mobile/e2e/pages/opensea.page.ts | 15 ---- .../core-mobile/e2e/pages/pangolin.page.ts | 47 ---------- .../core-mobile/e2e/pages/stakeLido.page.ts | 25 ------ .../core-mobile/e2e/pages/traderjoe.page.ts | 26 ------ .../core-mobile/e2e/pages/uniswap.page.ts | 23 ----- .../core-mobile/e2e/pages/yieldyak.page.ts | 27 ------ .../e2e/tests/playwright/aave.spec.ts | 27 +++--- .../e2e/tests/playwright/balancer.spec.ts | 31 +++---- .../e2e/tests/playwright/benqi.spec.ts | 28 +++--- .../tests/playwright/compoundFinance.spec.ts | 31 +++---- .../tests/playwright/convexFinance.spec.ts | 30 +++---- .../e2e/tests/playwright/core/core.spec.ts | 2 +- .../e2e/tests/playwright/gmx.spec.ts | 28 +++--- .../e2e/tests/playwright/instadapp.spec.ts | 27 +++--- .../e2e/tests/playwright/lfj.spec.ts | 24 ++++++ .../e2e/tests/playwright/multichain.spec.ts | 57 +++++++++---- .../e2e/tests/playwright/oasis.spec.ts | 27 +++--- .../e2e/tests/playwright/opensea.spec.ts | 27 +++--- .../e2e/tests/playwright/pangolin.spec.ts | 34 +++++--- .../e2e/tests/playwright/qr_codes.txt | 1 + .../e2e/tests/playwright/stakeLido.spec.ts | 30 +++---- .../e2e/tests/playwright/traderjoe.spec.ts | 24 ------ .../e2e/tests/playwright/uniswap.spec.ts | 33 +++---- .../e2e/tests/playwright/yieldyak.spec.ts | 44 ++++------ 39 files changed, 399 insertions(+), 634 deletions(-) delete mode 100644 packages/core-mobile/e2e/locators/uniswap.loc.ts delete mode 100644 packages/core-mobile/e2e/pages/aave.page.ts delete mode 100644 packages/core-mobile/e2e/pages/balancer.page.ts delete mode 100644 packages/core-mobile/e2e/pages/benqi.page.ts delete mode 100644 packages/core-mobile/e2e/pages/compoundFinance.page.ts delete mode 100644 packages/core-mobile/e2e/pages/convexFinance.page.ts create mode 100644 packages/core-mobile/e2e/pages/dappsPlaywright.page.ts delete mode 100644 packages/core-mobile/e2e/pages/gmx.page.ts delete mode 100644 packages/core-mobile/e2e/pages/instadapp.page.ts delete mode 100644 packages/core-mobile/e2e/pages/multichain.page.ts delete mode 100644 packages/core-mobile/e2e/pages/oasis.page.ts delete mode 100644 packages/core-mobile/e2e/pages/opensea.page.ts delete mode 100644 packages/core-mobile/e2e/pages/pangolin.page.ts delete mode 100644 packages/core-mobile/e2e/pages/stakeLido.page.ts delete mode 100644 packages/core-mobile/e2e/pages/traderjoe.page.ts delete mode 100644 packages/core-mobile/e2e/pages/uniswap.page.ts delete mode 100644 packages/core-mobile/e2e/pages/yieldyak.page.ts create mode 100644 packages/core-mobile/e2e/tests/playwright/lfj.spec.ts delete mode 100644 packages/core-mobile/e2e/tests/playwright/traderjoe.spec.ts diff --git a/packages/core-mobile/e2e/helpers/playwrightActions.ts b/packages/core-mobile/e2e/helpers/playwrightActions.ts index 535623efa..ea6c141c4 100644 --- a/packages/core-mobile/e2e/helpers/playwrightActions.ts +++ b/packages/core-mobile/e2e/helpers/playwrightActions.ts @@ -3,8 +3,8 @@ import { expect } from '@playwright/test' const fs = require('fs') const tap = async (item: Locator, timeout = 5000) => { - await expect(item.first()).toBeEnabled({ timeout }) - await item.first().click() + await expect(item).toBeEnabled({ timeout }) + await item.click() } const open = async (url: string, page: Page) => { diff --git a/packages/core-mobile/e2e/helpers/playwrightSetup.ts b/packages/core-mobile/e2e/helpers/playwrightSetup.ts index 7ac811503..061560124 100644 --- a/packages/core-mobile/e2e/helpers/playwrightSetup.ts +++ b/packages/core-mobile/e2e/helpers/playwrightSetup.ts @@ -1,16 +1,19 @@ -import { test, Page } from '@playwright/test' +import { test, Page, Browser } from '@playwright/test' const { chromium } = require('playwright-extra') const stealth = require('puppeteer-extra-plugin-stealth')() chromium.use(stealth) export const warmupWeb = async () => { - const browser = await chromium.launch({ headless: false }) - const page = await browser.newPage() + const browser = await chromium.launch({ headless: true }) + const context = await browser.newContext({ + permissions: ['clipboard-read'] + }) + const page = await context.newPage() return { browser, page } } export const playwrightSetup = () => { - let browser: { close: () => Promise } | null = null + let browser: Browser | null = null let page: Page | null = null test.beforeAll(async () => { @@ -30,7 +33,7 @@ export const playwrightSetup = () => { }) return () => { - if (page !== null) { + if (page !== null && browser !== null) { return { browser, page } } else { throw new Error('Page is not initialized or invalid type.') diff --git a/packages/core-mobile/e2e/locators/commonPlaywrightEls.loc.ts b/packages/core-mobile/e2e/locators/commonPlaywrightEls.loc.ts index 15c0c06f1..922a3e1b2 100644 --- a/packages/core-mobile/e2e/locators/commonPlaywrightEls.loc.ts +++ b/packages/core-mobile/e2e/locators/commonPlaywrightEls.loc.ts @@ -1,6 +1,8 @@ export default { connectWallet: 'Connect Wallet', + connectwallet: 'Connect wallet', walletConnectBtn: 'WalletConnect', wuiQrCode: 'wui-qr-code', - wcmUri: 'wcm-qrcode' + wcmQrCode: 'wcm-qrcode', + w3mQrCode: 'w3m-qrcode' } diff --git a/packages/core-mobile/e2e/locators/uniswap.loc.ts b/packages/core-mobile/e2e/locators/uniswap.loc.ts deleted file mode 100644 index 8d733233e..000000000 --- a/packages/core-mobile/e2e/locators/uniswap.loc.ts +++ /dev/null @@ -1,5 +0,0 @@ -export default { - connectBtn: '[data-testid="navbar-connect-wallet"]', - walletConnect: 'WalletConnect', - copyQrCode: 'wcm-action-btn' -} diff --git a/packages/core-mobile/e2e/pages/aave.page.ts b/packages/core-mobile/e2e/pages/aave.page.ts deleted file mode 100644 index c4ced40a1..000000000 --- a/packages/core-mobile/e2e/pages/aave.page.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Page } from '@playwright/test' - -class AavePage { - page: Page - - constructor(page: Page) { - this.page = page - } - - get aaveHomepage() { - return 'https://app.aave.com/' - } -} - -export default AavePage diff --git a/packages/core-mobile/e2e/pages/balancer.page.ts b/packages/core-mobile/e2e/pages/balancer.page.ts deleted file mode 100644 index e67902e50..000000000 --- a/packages/core-mobile/e2e/pages/balancer.page.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Page } from '@playwright/test' - -class BalancerPage { - page: Page - - constructor(page: Page) { - this.page = page - } - - get balancerHomepage() { - return 'https://app.balancer.fi/' - } - - get connectWalletBtn() { - return this.page.locator('path[stroke="url(#wallet_gradient)"]').first() - } - - get tosCheckbox() { - return this.page.locator('input[value="bal-rules"]') - } - - get walletConnectBtn() { - return this.page.locator('img[src*="walletconnect"]') - } - - async clickWalletConnectBtn() { - await this.walletConnectBtn.click() - } - - async clickTosCheckbox() { - await this.tosCheckbox.click() - } - - async clickConnectWalletBtn() { - await this.connectWalletBtn.click() - } -} - -export default BalancerPage diff --git a/packages/core-mobile/e2e/pages/benqi.page.ts b/packages/core-mobile/e2e/pages/benqi.page.ts deleted file mode 100644 index 5ff298079..000000000 --- a/packages/core-mobile/e2e/pages/benqi.page.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Page } from '@playwright/test' - -class BenqiPage { - page: Page - - constructor(page: Page) { - this.page = page - } - - get benqiHomepage() { - return 'https://staking.benqi.fi/' - } -} - -export default BenqiPage diff --git a/packages/core-mobile/e2e/pages/commonPlaywrightEls.page.ts b/packages/core-mobile/e2e/pages/commonPlaywrightEls.page.ts index 7ca10a7ad..b0a2c0355 100644 --- a/packages/core-mobile/e2e/pages/commonPlaywrightEls.page.ts +++ b/packages/core-mobile/e2e/pages/commonPlaywrightEls.page.ts @@ -1,6 +1,7 @@ import { Page } from '@playwright/test' import commonEls from '../locators/commonPlaywrightEls.loc' -import playwrightActions from '../helpers/playwrightActions' +import actions from '../helpers/playwrightActions' + class CommonElsPage { page: Page @@ -12,54 +13,83 @@ class CommonElsPage { return this.page.getByText(commonEls.connectWallet).first() } + get connectwalletBtn() { + return this.page.getByText(commonEls.connectwallet).first() + } + get walletConnectBtn() { return this.page.getByText(commonEls.walletConnectBtn).first() } + get walletConnectV2Btn() { + return this.page.locator('text="WalletConnect V2"') + } + get wuiQrCodeUri() { return this.page.locator(commonEls.wuiQrCode) } - get wcmWalletUri() { - return this.page.locator(commonEls.wcmUri).first() + get w3mQrCodeUri() { + return this.page.locator(commonEls.w3mQrCode) + } + + get wcmQrCode() { + return this.page.locator(commonEls.wcmQrCode).first() } get connectToAWalletBtn() { - return this.page.getByText('Connect to a wallet') + return this.page.locator('text="Connect to a wallet"') + } + + get open() { + return this.page.locator('text="OPEN"') } async qrUriValue(locator = 'wcm', timeout = 5000) { if (locator === 'wcm') { - await playwrightActions.waitFor(this.wcmWalletUri, timeout) - return await this.wcmWalletUri.getAttribute('uri') + await actions.waitFor(this.wcmQrCode, timeout) + return await this.wcmQrCode.getAttribute('uri') + } else if (locator === 'w3m') { + await actions.waitFor(this.w3mQrCodeUri, timeout) + return await this.w3mQrCodeUri.getAttribute('uri') } else { - await playwrightActions.waitFor(this.wuiQrCodeUri, timeout) + await actions.waitFor(this.wuiQrCodeUri, timeout) return await this.wuiQrCodeUri.getAttribute('uri') } } - async clickConnectWalletBtn() { - await this.connectWalletBtn.click() + async tapConnectWallet(index = 0) { + const connectWallet = this.page.locator( + `text=/connect wallet/i >> nth=${index}` + ) + await actions.waitFor(connectWallet) + await connectWallet.click() } // Some sites have multiple wallet connect buttons so adjust the index as needed in order to click the correct one - async clickWalletConnectBtn(index = 0) { + async tapWalletConnect(index = 0) { const walletConnectBtn = this.page.locator( - `text=WalletConnect >> nth=${index}` + `text="WalletConnect" >> nth=${index}` ) + await actions.waitFor(walletConnectBtn) await walletConnectBtn.click() } - get walletConnectUri() { - return this.page.getByText('Copy to clipboard') + async tapCopy() { + return actions.tap(this.page.getByText('Copy')) + } + + async tapWalletConnectV2() { + await actions.waitFor(this.walletConnectV2Btn) + await actions.tap(this.walletConnectV2Btn) } - async walletConnectUriValue() { - await this.walletConnectUri.click() + async tapOpen() { + await actions.tap(this.open, 20000) } - async clickConnectToAWalletBtn() { - await this.connectToAWalletBtn.click() + async tapConnectToAWallet(index = 0) { + await this.connectToAWalletBtn.nth(index).click() } } diff --git a/packages/core-mobile/e2e/pages/compoundFinance.page.ts b/packages/core-mobile/e2e/pages/compoundFinance.page.ts deleted file mode 100644 index 7d335affc..000000000 --- a/packages/core-mobile/e2e/pages/compoundFinance.page.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Page } from '@playwright/test' - -class CompoundFinancePage { - page: Page - - constructor(page: Page) { - this.page = page - } - - get compoundFinanceHomepage() { - return 'https://app.compound.finance/' - } -} - -export default CompoundFinancePage diff --git a/packages/core-mobile/e2e/pages/convexFinance.page.ts b/packages/core-mobile/e2e/pages/convexFinance.page.ts deleted file mode 100644 index 34fdc7d70..000000000 --- a/packages/core-mobile/e2e/pages/convexFinance.page.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Page } from '@playwright/test' - -class ConvexFinancePage { - page: Page - - constructor(page: Page) { - this.page = page - } - - get convexFinanceHomepage() { - return 'https://www.convexfinance.com/' - } - - get walletConnectV2Btn() { - return this.page.locator('text=WalletConnect V2') - } - - async clickWalletConnectV2Btn() { - await this.walletConnectV2Btn.click() - } -} - -export default ConvexFinancePage diff --git a/packages/core-mobile/e2e/pages/dappsPlaywright.page.ts b/packages/core-mobile/e2e/pages/dappsPlaywright.page.ts new file mode 100644 index 000000000..c938866aa --- /dev/null +++ b/packages/core-mobile/e2e/pages/dappsPlaywright.page.ts @@ -0,0 +1,85 @@ +import { Page } from '@playwright/test' + +class DappsPlaywrightPage { + page: Page + + constructor(page: Page) { + this.page = page + } + + get aaveUrl() { + return 'https://app.aave.com/' + } + + get balancerUrl() { + return 'https://balancer.fi/pools' + } + + get benqiUrl() { + return 'https://app.benqi.fi/markets' + } + + get compoundFinanceUrl() { + return 'https://app.compound.finance/' + } + + get convexFinanceUrl() { + return 'https://www.convexfinance.com/' + } + + get gmxUrl() { + return 'https://app.gmx.io/#/trade' + } + + get instadappUrl() { + return 'https://lite.instadapp.io/' + } + + get multichainUrl() { + return 'https://app.multichain.org/#/router' + } + + get oasisUrl() { + return 'https://summer.fi/' + } + + get openseaUrl() { + return 'https://opensea.io/' + } + + get pangolinUrl() { + return 'https://beta.pangolin.exchange/swap' + } + + get pangolinAgree() { + return this.page.locator('#agree') + } + + get stakeLidoUrl() { + return 'https://stake.lido.fi/' + } + + get lfjUrl() { + return 'https://lfj.gg/avalanche' + } + + get uniswapUrl() { + return 'https://app.uniswap.org/#/swap' + } + + get yieldYakUrl() { + return 'https://www.yieldyak.com/' + } + + get lidoAgree() { + return this.page.getByText( + 'I certify that I have read and accept the updated' + ) + } + + get lfjAgree() { + return this.page.locator('text="I read and accept"') + } +} + +export default DappsPlaywrightPage diff --git a/packages/core-mobile/e2e/pages/gmx.page.ts b/packages/core-mobile/e2e/pages/gmx.page.ts deleted file mode 100644 index c9c7dd94c..000000000 --- a/packages/core-mobile/e2e/pages/gmx.page.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Page } from '@playwright/test' - -class GmxPage { - page: Page - - constructor(page: Page) { - this.page = page - } - - get gmxHomepage() { - return 'https://app.gmx.io/#/dashboard' - } -} - -export default GmxPage diff --git a/packages/core-mobile/e2e/pages/instadapp.page.ts b/packages/core-mobile/e2e/pages/instadapp.page.ts deleted file mode 100644 index 25729bc9b..000000000 --- a/packages/core-mobile/e2e/pages/instadapp.page.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Page } from '@playwright/test' -import delay from '../helpers/waits' - -class InstadappPage { - page: Page - - constructor(page: Page) { - this.page = page - } - - get instadappHomepage() { - return 'https:/defi.instadapp.io/' - } - - get connectBtn() { - return this.page.locator('text=Connect >> visible=true') - } - - get walletConnectV2Btn() { - return this.page.locator('text=WalletConnect v2') - } - - // async clickConnectBtn(index = 0) { - // const connectBtn = this.page.locator(`text=Connect >> nth=${index}`) - // await connectBtn.click() - // } - - async clickConnectBtn() { - await delay(2000) - await this.connectBtn.click() - } - - async clickWalletConnectV2Btn() { - await this.walletConnectV2Btn.click() - } -} - -export default InstadappPage diff --git a/packages/core-mobile/e2e/pages/multichain.page.ts b/packages/core-mobile/e2e/pages/multichain.page.ts deleted file mode 100644 index d9210fc10..000000000 --- a/packages/core-mobile/e2e/pages/multichain.page.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Page } from '@playwright/test' - -class MultichainPage { - page: Page - - constructor(page: Page) { - this.page = page - } - - get multichainHomepage() { - return 'https://app.multichain.org/#/router' - } -} - -export default MultichainPage diff --git a/packages/core-mobile/e2e/pages/oasis.page.ts b/packages/core-mobile/e2e/pages/oasis.page.ts deleted file mode 100644 index 34bb31150..000000000 --- a/packages/core-mobile/e2e/pages/oasis.page.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Page } from '@playwright/test' - -class OasisPage { - page: Page - - constructor(page: Page) { - this.page = page - } - - get oasisHomepage() { - return 'https://www.oasis.app' - } -} - -export default OasisPage diff --git a/packages/core-mobile/e2e/pages/opensea.page.ts b/packages/core-mobile/e2e/pages/opensea.page.ts deleted file mode 100644 index 9acccbcc1..000000000 --- a/packages/core-mobile/e2e/pages/opensea.page.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Page } from '@playwright/test' - -class OpenseaPage { - page: Page - - constructor(page: Page) { - this.page = page - } - - get openseaHomepage() { - return 'https://opensea.io/' - } -} - -export default OpenseaPage diff --git a/packages/core-mobile/e2e/pages/pangolin.page.ts b/packages/core-mobile/e2e/pages/pangolin.page.ts deleted file mode 100644 index d2dfd2bea..000000000 --- a/packages/core-mobile/e2e/pages/pangolin.page.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -import fs from 'fs' -import { Page } from '@playwright/test' -import actions from '../helpers/actions' -const QrCode = require('qrcode-reader') -const Jimp = require('jimp') - -class PangolinPage { - page: Page - - constructor(page: Page) { - this.page = page - } - - get pangolinHomepage() { - return 'https://app.pangolin.exchange/' - } - - get qrCodeSvg() { - return this.page.locator('svg[width="256"]') - } - - async decodeQrCode() { - const svgImage = this.page.locator('svg[width="256"]') - await svgImage?.screenshot({ - path: './e2e/tests/playwright/qrCode.png' - }) - const svgImageBuffer = fs.readFileSync('./e2e/tests/playwright/qrCode.png') - Jimp.read(svgImageBuffer, function (err: any, image: any) { - if (err) { - console.log(err) - } - const qr = new QrCode() - qr.callback = async function (error: any, value: { result: any }) { - if (error) { - console.error(err) - } - await actions.writeQrCodeToFile(value.result) - console.log(value.result) - } - - qr.decode(image.bitmap) - }) - } -} - -export default PangolinPage diff --git a/packages/core-mobile/e2e/pages/stakeLido.page.ts b/packages/core-mobile/e2e/pages/stakeLido.page.ts deleted file mode 100644 index 8eec97d97..000000000 --- a/packages/core-mobile/e2e/pages/stakeLido.page.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Page } from '@playwright/test' - -class StakeLidoPage { - page: Page - - constructor(page: Page) { - this.page = page - } - - get stakeLidoHomepage() { - return 'https://stake.lido.fi/' - } - - get tosCheckbox() { - return this.page.locator( - 'text=I certify that I have read and accept the updated' - ) - } - - async clickTosCheckbox() { - await this.tosCheckbox.click() - } -} - -export default StakeLidoPage diff --git a/packages/core-mobile/e2e/pages/traderjoe.page.ts b/packages/core-mobile/e2e/pages/traderjoe.page.ts deleted file mode 100644 index fcfa08c20..000000000 --- a/packages/core-mobile/e2e/pages/traderjoe.page.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Page } from '@playwright/test' -class TraderJoePage { - page: Page - - constructor(page: Page) { - this.page = page - } - - get oldWalletConnectModal() { - return this.page.getByRole('button', { name: 'OPEN' }) - } - - get metamaskButton() { - return this.page.getByRole('button', { name: 'MetaMask' }) - } - - async clickOldWalletConnectModal() { - await this.oldWalletConnectModal.click() - } - - get homePage() { - return 'https://traderjoe.xyz/' - } -} - -export default TraderJoePage diff --git a/packages/core-mobile/e2e/pages/uniswap.page.ts b/packages/core-mobile/e2e/pages/uniswap.page.ts deleted file mode 100644 index 6c64ef996..000000000 --- a/packages/core-mobile/e2e/pages/uniswap.page.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Page } from '@playwright/test' - -class UniswapPage { - page: Page - - constructor(page: Page) { - this.page = page - } - - get connectWalletBtn() { - return this.page.locator('[data-testid="navbar-connect-wallet"]') - } - - async clickConnectBtn() { - await this.connectWalletBtn.click() - } - - get uniswapHomePage() { - return 'https://app.uniswap.org/#/swap' - } -} - -export default UniswapPage diff --git a/packages/core-mobile/e2e/pages/yieldyak.page.ts b/packages/core-mobile/e2e/pages/yieldyak.page.ts deleted file mode 100644 index db6f12aec..000000000 --- a/packages/core-mobile/e2e/pages/yieldyak.page.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Page } from '@playwright/test' - -class YieldYakPage { - page: Page - - constructor(page: Page) { - this.page = page - } - - get yieldYakHomepage() { - return 'https://www.yieldyak.com/' - } - - get showMoreBtn() { - return this.page.locator('text=Show more') - } - - get connectWalletBtn() { - return this.page.locator('text= Connect Wallet ') - } - - async clickShowMoreBtn() { - await this.showMoreBtn.click() - } -} - -export default YieldYakPage diff --git a/packages/core-mobile/e2e/tests/playwright/aave.spec.ts b/packages/core-mobile/e2e/tests/playwright/aave.spec.ts index 0c1d9c1c1..a000f7bd5 100644 --- a/packages/core-mobile/e2e/tests/playwright/aave.spec.ts +++ b/packages/core-mobile/e2e/tests/playwright/aave.spec.ts @@ -1,23 +1,22 @@ -import { test, expect } from '@playwright/test' -import actions from '../../helpers/actions' +import { test } from '@playwright/test' import CommonPlaywrightPage from '../../pages/commonPlaywrightEls.page' -import AavePage from '../../pages/aave.page' +import actions from '../../helpers/playwrightActions' +import { playwrightSetup } from '../../helpers/playwrightSetup' +import DappsPlaywrightPage from '../../pages/dappsPlaywright.page' -test('check wallet connect button', async ({ page }) => { - const commonEls = new CommonPlaywrightPage(page) - const aavePage = new AavePage(page) +const getContext = playwrightSetup() - await actions.openPage(aavePage.page, aavePage.aaveHomepage) - await expect(commonEls.connectWalletBtn).toBeVisible() - await commonEls.clickConnectWalletBtn() - await expect(commonEls.walletConnectBtn).toBeVisible() - await commonEls.clickWalletConnectBtn(1) - await expect(commonEls.wcmWalletUri).toBeVisible({ timeout: 1000000 }) - const qrUri = await commonEls.qrUriValue('wcm') +test('Connect Aave', async () => { + const { page } = getContext() + const common = new CommonPlaywrightPage(page) + const dapps = new DappsPlaywrightPage(page) + await actions.open(dapps.aaveUrl, dapps.page) + await common.tapConnectWallet() + await common.tapWalletConnect(1) + const qrUri = await common.qrUriValue('wcm') if (qrUri) { await actions.writeQrCodeToFile(qrUri) } - console.log('URI: ', qrUri) }) diff --git a/packages/core-mobile/e2e/tests/playwright/balancer.spec.ts b/packages/core-mobile/e2e/tests/playwright/balancer.spec.ts index 85079995e..6e56e4782 100644 --- a/packages/core-mobile/e2e/tests/playwright/balancer.spec.ts +++ b/packages/core-mobile/e2e/tests/playwright/balancer.spec.ts @@ -1,25 +1,22 @@ -import { test, expect } from '@playwright/test' -import actions from '../../helpers/actions' +import { test } from '@playwright/test' import CommonPlaywrightPage from '../../pages/commonPlaywrightEls.page' -import BalancerPage from '../../pages/balancer.page' +import actions from '../../helpers/playwrightActions' +import { playwrightSetup } from '../../helpers/playwrightSetup' +import DappsPlaywrightPage from '../../pages/dappsPlaywright.page' -test('check wallet connect button', async ({ page }) => { - const commonEls = new CommonPlaywrightPage(page) - const balancerPage = new BalancerPage(page) - - await actions.openPage(balancerPage.page, balancerPage.balancerHomepage) - await expect(balancerPage.connectWalletBtn).toBeVisible() - await balancerPage.clickConnectWalletBtn() - await expect(balancerPage.tosCheckbox).toBeVisible() - await balancerPage.clickTosCheckbox() - await expect(balancerPage.walletConnectBtn).toBeVisible() - await balancerPage.clickWalletConnectBtn() - await expect(commonEls.wcmWalletUri).toBeVisible() - const qrUri = await commonEls.qrUriValue('wcm') +const getContext = playwrightSetup() +test('Connect Balancer', async () => { + const { page } = getContext() + const common = new CommonPlaywrightPage(page) + const dapps = new DappsPlaywrightPage(page) + await actions.open(dapps.balancerUrl, dapps.page) + await common.tapConnectWallet() + await common.tapWalletConnect() + await common.tapOpen() + const qrUri = await common.qrUriValue('wcm') if (qrUri) { await actions.writeQrCodeToFile(qrUri) } - console.log('URI: ', qrUri) }) diff --git a/packages/core-mobile/e2e/tests/playwright/benqi.spec.ts b/packages/core-mobile/e2e/tests/playwright/benqi.spec.ts index ad4f4b4bd..00b1ca5de 100644 --- a/packages/core-mobile/e2e/tests/playwright/benqi.spec.ts +++ b/packages/core-mobile/e2e/tests/playwright/benqi.spec.ts @@ -1,23 +1,21 @@ -import { test, expect } from '@playwright/test' -import actions from '../../helpers/actions' +import { test } from '@playwright/test' import CommonPlaywrightPage from '../../pages/commonPlaywrightEls.page' -import BenqiPage from '../../pages/benqi.page' +import actions from '../../helpers/playwrightActions' +import { playwrightSetup } from '../../helpers/playwrightSetup' +import DappsPlaywrightPage from '../../pages/dappsPlaywright.page' -test('check wallet connect button', async ({ page }) => { - const commonEls = new CommonPlaywrightPage(page) - const benqiPage = new BenqiPage(page) - - await actions.openPage(benqiPage.page, benqiPage.benqiHomepage) - await expect(commonEls.connectWalletBtn).toBeVisible() - await commonEls.clickConnectWalletBtn() - await expect(commonEls.walletConnectBtn).toBeVisible() - await commonEls.clickWalletConnectBtn() - await expect(commonEls.wcmWalletUri).toBeVisible() - const qrUri = await commonEls.qrUriValue('wcm') +const getContext = playwrightSetup() +test('Connect Benqi', async () => { + const { page } = getContext() + const common = new CommonPlaywrightPage(page) + const dapps = new DappsPlaywrightPage(page) + await actions.open(dapps.benqiUrl, dapps.page) + await common.tapConnectWallet(1) + await common.tapWalletConnect() + const qrUri = await common.qrUriValue('wcm') if (qrUri) { await actions.writeQrCodeToFile(qrUri) } - console.log('URI: ', qrUri) }) diff --git a/packages/core-mobile/e2e/tests/playwright/compoundFinance.spec.ts b/packages/core-mobile/e2e/tests/playwright/compoundFinance.spec.ts index 586eae450..71250a4ca 100644 --- a/packages/core-mobile/e2e/tests/playwright/compoundFinance.spec.ts +++ b/packages/core-mobile/e2e/tests/playwright/compoundFinance.spec.ts @@ -1,26 +1,21 @@ -import { test, expect } from '@playwright/test' -import actions from '../../helpers/actions' +import { test } from '@playwright/test' import CommonPlaywrightPage from '../../pages/commonPlaywrightEls.page' -import CompoundFinancePage from '../../pages/compoundFinance.page' +import actions from '../../helpers/playwrightActions' +import { playwrightSetup } from '../../helpers/playwrightSetup' +import DappsPlaywrightPage from '../../pages/dappsPlaywright.page' -test('check wallet connect button', async ({ page }) => { - const commonEls = new CommonPlaywrightPage(page) - const compoundFinancePage = new CompoundFinancePage(page) - - await actions.openPage( - compoundFinancePage.page, - compoundFinancePage.compoundFinanceHomepage - ) - await expect(commonEls.connectWalletBtn).toBeVisible() - await commonEls.clickConnectWalletBtn() - await expect(commonEls.walletConnectBtn).toBeVisible() - await commonEls.clickWalletConnectBtn(1) - await expect(commonEls.wuiQrCodeUri).toBeVisible() - const qrUri = await commonEls.qrUriValue('w3m') +const getContext = playwrightSetup() +test('Connect CompoundFinance', async () => { + const { page } = getContext() + const common = new CommonPlaywrightPage(page) + const dapps = new DappsPlaywrightPage(page) + await actions.open(dapps.compoundFinanceUrl, dapps.page) + await common.tapConnectWallet() + await common.tapWalletConnect() + const qrUri = await common.qrUriValue('w3m') if (qrUri) { await actions.writeQrCodeToFile(qrUri) } - console.log('URI: ', qrUri) }) diff --git a/packages/core-mobile/e2e/tests/playwright/convexFinance.spec.ts b/packages/core-mobile/e2e/tests/playwright/convexFinance.spec.ts index 8fe9840cf..a367c3557 100644 --- a/packages/core-mobile/e2e/tests/playwright/convexFinance.spec.ts +++ b/packages/core-mobile/e2e/tests/playwright/convexFinance.spec.ts @@ -1,26 +1,22 @@ -import { test, expect } from '@playwright/test' -import actions from '../../helpers/actions' +import { test } from '@playwright/test' import CommonPlaywrightPage from '../../pages/commonPlaywrightEls.page' -import ConvexFinancePage from '../../pages/convexFinance.page' +import actions from '../../helpers/playwrightActions' +import { playwrightSetup } from '../../helpers/playwrightSetup' +import DappsPlaywrightPage from '../../pages/dappsPlaywright.page' -test('check wallet connect button', async ({ page }) => { - const commonEls = new CommonPlaywrightPage(page) - const convexFinancePage = new ConvexFinancePage(page) +const getContext = playwrightSetup() - await actions.openPage( - convexFinancePage.page, - convexFinancePage.convexFinanceHomepage - ) - await expect(commonEls.connectWalletBtn).toBeVisible() - await commonEls.clickConnectWalletBtn() - await expect(convexFinancePage.walletConnectV2Btn).toBeVisible() - await convexFinancePage.clickWalletConnectV2Btn() - await expect(commonEls.wcmWalletUri).toBeVisible() - const qrUri = await commonEls.qrUriValue('wcm') +test('Connect ConvexFinance', async () => { + const { page } = getContext() + const common = new CommonPlaywrightPage(page) + const dapps = new DappsPlaywrightPage(page) + await actions.open(dapps.convexFinanceUrl, dapps.page) + await common.tapConnectWallet() + await common.tapWalletConnectV2() + const qrUri = await common.qrUriValue() if (qrUri) { await actions.writeQrCodeToFile(qrUri) } - console.log('URI: ', qrUri) }) diff --git a/packages/core-mobile/e2e/tests/playwright/core/core.spec.ts b/packages/core-mobile/e2e/tests/playwright/core/core.spec.ts index 783907135..2d00e0c55 100644 --- a/packages/core-mobile/e2e/tests/playwright/core/core.spec.ts +++ b/packages/core-mobile/e2e/tests/playwright/core/core.spec.ts @@ -17,7 +17,7 @@ test('Connect Core', async () => { await playwrightActions.tap(core.termsCheckBox) await playwrightActions.tap(core.continueBtn) await playwrightActions.tap(common.walletConnectBtn) - const uri = await common.qrUriValue('w3m') + const uri = await common.qrUriValue('wui') console.log('URI: ', uri) if (uri) { await playwrightActions.writeQrCodeToFile(uri) diff --git a/packages/core-mobile/e2e/tests/playwright/gmx.spec.ts b/packages/core-mobile/e2e/tests/playwright/gmx.spec.ts index 36230917c..851b84218 100644 --- a/packages/core-mobile/e2e/tests/playwright/gmx.spec.ts +++ b/packages/core-mobile/e2e/tests/playwright/gmx.spec.ts @@ -1,23 +1,23 @@ -import { test, expect } from '@playwright/test' -import actions from '../../helpers/actions' +import { test } from '@playwright/test' import CommonPlaywrightPage from '../../pages/commonPlaywrightEls.page' -import GmxPage from '../../pages/gmx.page' +import actions from '../../helpers/playwrightActions' +import { playwrightSetup } from '../../helpers/playwrightSetup' +import DappsPlaywrightPage from '../../pages/dappsPlaywright.page' -test('check wallet connect button', async ({ page }) => { - const commonEls = new CommonPlaywrightPage(page) - const gmxPage = new GmxPage(page) +const getContext = playwrightSetup() - await actions.openPage(gmxPage.page, gmxPage.gmxHomepage) - await expect(commonEls.connectWalletBtn).toBeVisible() - await commonEls.clickConnectWalletBtn() - await expect(commonEls.walletConnectBtn).toBeVisible() - await commonEls.clickWalletConnectBtn() - await expect(commonEls.wcmWalletUri).toBeVisible() - const qrUri = await commonEls.qrUriValue('wcm') +test('Connect GMX', async () => { + const { page } = getContext() + const common = new CommonPlaywrightPage(page) + const dapps = new DappsPlaywrightPage(page) + await actions.open(dapps.gmxUrl, dapps.page) + await common.tapConnectWallet(1) + await common.tapWalletConnect() + await common.tapOpen() + const qrUri = await common.qrUriValue() if (qrUri) { await actions.writeQrCodeToFile(qrUri) } - console.log('URI: ', qrUri) }) diff --git a/packages/core-mobile/e2e/tests/playwright/instadapp.spec.ts b/packages/core-mobile/e2e/tests/playwright/instadapp.spec.ts index f50df2f40..a300a3d09 100644 --- a/packages/core-mobile/e2e/tests/playwright/instadapp.spec.ts +++ b/packages/core-mobile/e2e/tests/playwright/instadapp.spec.ts @@ -1,23 +1,22 @@ -import { test, expect } from '@playwright/test' -import actions from '../../helpers/actions' +import { test } from '@playwright/test' import CommonPlaywrightPage from '../../pages/commonPlaywrightEls.page' -import InstadappPage from '../../pages/instadapp.page' +import actions from '../../helpers/playwrightActions' +import { playwrightSetup } from '../../helpers/playwrightSetup' +import DappsPlaywrightPage from '../../pages/dappsPlaywright.page' -test('check wallet connect button', async ({ page }) => { - const commonEls = new CommonPlaywrightPage(page) - const instadappPage = new InstadappPage(page) +const getContext = playwrightSetup() - await actions.openPage(instadappPage.page, instadappPage.instadappHomepage) - await expect(instadappPage.connectBtn).toBeVisible() - await instadappPage.clickConnectBtn() - await expect(instadappPage.walletConnectV2Btn).toBeVisible() - await instadappPage.clickWalletConnectV2Btn() - await expect(commonEls.wcmWalletUri).toBeVisible() - const qrUri = await commonEls.qrUriValue('wcm') +test('Connect InstaDapp', async () => { + const { page } = getContext() + const common = new CommonPlaywrightPage(page) + const dapps = new DappsPlaywrightPage(page) + await actions.open(dapps.instadappUrl, dapps.page) + await common.tapConnectWallet() + await common.tapWalletConnect() + const qrUri = await common.qrUriValue() if (qrUri) { await actions.writeQrCodeToFile(qrUri) } - console.log('URI: ', qrUri) }) diff --git a/packages/core-mobile/e2e/tests/playwright/lfj.spec.ts b/packages/core-mobile/e2e/tests/playwright/lfj.spec.ts new file mode 100644 index 000000000..8136cddea --- /dev/null +++ b/packages/core-mobile/e2e/tests/playwright/lfj.spec.ts @@ -0,0 +1,24 @@ +import { test } from '@playwright/test' +import CommonPlaywrightPage from '../../pages/commonPlaywrightEls.page' +import actions from '../../helpers/playwrightActions' +import { playwrightSetup } from '../../helpers/playwrightSetup' +import DappsPlaywrightPage from '../../pages/dappsPlaywright.page' + +const getContext = playwrightSetup() + +test('Connect LFJ', async () => { + const { page } = getContext() + const common = new CommonPlaywrightPage(page) + const dapps = new DappsPlaywrightPage(page) + + await actions.open(dapps.lfjUrl, dapps.page) + await common.tapConnectWallet() + await actions.tap(dapps.lfjAgree) + await common.tapWalletConnect() + await common.tapOpen() + const qrUri = await common.qrUriValue() + if (qrUri) { + await actions.writeQrCodeToFile(qrUri) + } + console.log('URI: ', qrUri) +}) diff --git a/packages/core-mobile/e2e/tests/playwright/multichain.spec.ts b/packages/core-mobile/e2e/tests/playwright/multichain.spec.ts index 1003deb93..4964df225 100644 --- a/packages/core-mobile/e2e/tests/playwright/multichain.spec.ts +++ b/packages/core-mobile/e2e/tests/playwright/multichain.spec.ts @@ -1,29 +1,52 @@ -import { test, expect } from '@playwright/test' -import CommonPlaywrightPage from '../../pages/commonPlaywrightEls.page' -import MultichainPage from '../../pages/multichain.page' -import actions from '../../helpers/actions' +// import { test, expect } from '@playwright/test' +// import CommonPlaywrightPage from '../../pages/commonPlaywrightEls.page' +// import MultichainPage from '../../pages/multichain.page' +// import actions from '../../helpers/actions' + +// test('check wallet connect button', async ({ page, context }) => { +// const commonEls = new CommonPlaywrightPage(page) +// const multichainPage = new MultichainPage(page) + +// await actions.openPage(multichainPage.page, multichainPage.multichainHomepage) + +// await expect(commonEls.connectToAWalletBtn).toBeVisible() +// await commonEls.clickConnectToAWalletBtn() +// await expect(commonEls.walletConnectBtn).toBeVisible() +// await commonEls.clickWalletConnectBtn() +// await expect(commonEls.walletConnectUri).toBeVisible() +// await commonEls.walletConnectUriValue() -test('check wallet connect button', async ({ page, context }) => { - const commonEls = new CommonPlaywrightPage(page) - const multichainPage = new MultichainPage(page) +// await context.grantPermissions(['clipboard-read']) - await actions.openPage(multichainPage.page, multichainPage.multichainHomepage) +// const clipboardValue = await page.evaluate(() => { +// // @ts-ignore +// return navigator.clipboard.readText() +// }) - await expect(commonEls.connectToAWalletBtn).toBeVisible() - await commonEls.clickConnectToAWalletBtn() - await expect(commonEls.walletConnectBtn).toBeVisible() - await commonEls.clickWalletConnectBtn() - await expect(commonEls.walletConnectUri).toBeVisible() - await commonEls.walletConnectUriValue() +// await actions.writeQrCodeToFile(clipboardValue) - await context.grantPermissions(['clipboard-read']) +// console.log('URI: ', clipboardValue) +// }) +import { test } from '@playwright/test' +import CommonPlaywrightPage from '../../pages/commonPlaywrightEls.page' +import actions from '../../helpers/playwrightActions' +import { playwrightSetup } from '../../helpers/playwrightSetup' +import DappsPlaywrightPage from '../../pages/dappsPlaywright.page' + +const getContext = playwrightSetup() +test('Connect MultiChain', async () => { + const { page } = getContext() + const common = new CommonPlaywrightPage(page) + const dapps = new DappsPlaywrightPage(page) + await actions.open(dapps.multichainUrl, dapps.page) + await common.tapConnectWallet() + await common.tapWalletConnect() + await common.tapCopy() const clipboardValue = await page.evaluate(() => { // @ts-ignore return navigator.clipboard.readText() }) - await actions.writeQrCodeToFile(clipboardValue) - console.log('URI: ', clipboardValue) }) diff --git a/packages/core-mobile/e2e/tests/playwright/oasis.spec.ts b/packages/core-mobile/e2e/tests/playwright/oasis.spec.ts index 94ac6ed56..ef1532ee9 100644 --- a/packages/core-mobile/e2e/tests/playwright/oasis.spec.ts +++ b/packages/core-mobile/e2e/tests/playwright/oasis.spec.ts @@ -1,23 +1,22 @@ -import { test, expect } from '@playwright/test' -import actions from '../../helpers/actions' +import { test } from '@playwright/test' import CommonPlaywrightPage from '../../pages/commonPlaywrightEls.page' -import OasisPage from '../../pages/oasis.page' +import actions from '../../helpers/playwrightActions' +import { playwrightSetup } from '../../helpers/playwrightSetup' +import DappsPlaywrightPage from '../../pages/dappsPlaywright.page' -test('check wallet connect button', async ({ page }) => { - const commonEls = new CommonPlaywrightPage(page) - const oasisPage = new OasisPage(page) +const getContext = playwrightSetup() - await actions.openPage(oasisPage.page, oasisPage.oasisHomepage) - await expect(commonEls.connectWalletBtn).toBeVisible() - await commonEls.clickConnectWalletBtn() - await expect(commonEls.walletConnectBtn).toBeVisible() - await commonEls.clickWalletConnectBtn() - await expect(commonEls.wcmWalletUri).toBeVisible() - const qrUri = await commonEls.qrUriValue('wcm') +test('Connect Oasis', async () => { + const { page } = getContext() + const common = new CommonPlaywrightPage(page) + const dapps = new DappsPlaywrightPage(page) + await actions.open(dapps.oasisUrl, dapps.page) + await common.tapConnectWallet() + await common.tapWalletConnect() + const qrUri = await common.qrUriValue() if (qrUri) { await actions.writeQrCodeToFile(qrUri) } - console.log('URI: ', qrUri) }) diff --git a/packages/core-mobile/e2e/tests/playwright/opensea.spec.ts b/packages/core-mobile/e2e/tests/playwright/opensea.spec.ts index c9822263b..450954970 100644 --- a/packages/core-mobile/e2e/tests/playwright/opensea.spec.ts +++ b/packages/core-mobile/e2e/tests/playwright/opensea.spec.ts @@ -1,23 +1,22 @@ -import { test, expect } from '@playwright/test' -import actions from '../../helpers/actions' +import { test } from '@playwright/test' import CommonPlaywrightPage from '../../pages/commonPlaywrightEls.page' -import Opensea from '../../pages/opensea.page' +import actions from '../../helpers/playwrightActions' +import { playwrightSetup } from '../../helpers/playwrightSetup' +import DappsPlaywrightPage from '../../pages/dappsPlaywright.page' -test('check wallet connect button', async ({ page }) => { - const commonEls = new CommonPlaywrightPage(page) - const openseaPage = new Opensea(page) +const getContext = playwrightSetup() - await actions.openPage(openseaPage.page, openseaPage.openseaHomepage) - await expect(commonEls.connectWalletBtn).toBeVisible() - await commonEls.clickConnectWalletBtn() - await expect(commonEls.walletConnectBtn).toBeVisible() - await commonEls.clickWalletConnectBtn(1) - await expect(commonEls.wcmWalletUri).toBeVisible() - const qrUri = await commonEls.qrUriValue('wcm') +test('Connect OpenSea', async () => { + const { page } = getContext() + const common = new CommonPlaywrightPage(page) + const dapps = new DappsPlaywrightPage(page) + await actions.open(dapps.oasisUrl, dapps.page) + await common.tapConnectWallet() + await common.tapWalletConnect() + const qrUri = await common.qrUriValue() if (qrUri) { await actions.writeQrCodeToFile(qrUri) } - console.log('URI: ', qrUri) }) diff --git a/packages/core-mobile/e2e/tests/playwright/pangolin.spec.ts b/packages/core-mobile/e2e/tests/playwright/pangolin.spec.ts index 446dc3c0b..b32cec2d8 100644 --- a/packages/core-mobile/e2e/tests/playwright/pangolin.spec.ts +++ b/packages/core-mobile/e2e/tests/playwright/pangolin.spec.ts @@ -1,20 +1,26 @@ -import { test, expect } from '@playwright/test' +import { test } from '@playwright/test' import CommonPlaywrightPage from '../../pages/commonPlaywrightEls.page' -import PangolinPage from '../../pages/pangolin.page' -import actions from '../../helpers/actions' +import actions from '../../helpers/playwrightActions' +import { playwrightSetup } from '../../helpers/playwrightSetup' +import DappsPlaywrightPage from '../../pages/dappsPlaywright.page' -test('check wallet connect button', async ({ page }) => { - const commonEls = new CommonPlaywrightPage(page) - const pangolinPage = new PangolinPage(page) +const getContext = playwrightSetup() - await actions.openPage(pangolinPage.page, pangolinPage.pangolinHomepage) +test('Connect Pangolin', async () => { + const { page } = getContext() + const common = new CommonPlaywrightPage(page) + const dapps = new DappsPlaywrightPage(page) - await expect(commonEls.connectToAWalletBtn).toBeVisible() - await commonEls.clickConnectToAWalletBtn() - await expect(commonEls.walletConnectBtn).toBeVisible() - await commonEls.clickWalletConnectBtn() - await expect(commonEls.connectWalletBtn).toBeVisible() - await commonEls.clickConnectWalletBtn() + await actions.open(dapps.pangolinUrl, dapps.page) + await common.tapConnectToAWallet() + await actions.tap(dapps.pangolinAgree) + await common.tapConnectToAWallet(2) + await common.tapWalletConnect() + await common.tapOpen() - await pangolinPage.decodeQrCode() + const qrUri = await common.qrUriValue() + if (qrUri) { + await actions.writeQrCodeToFile(qrUri) + } + console.log('URI: ', qrUri) }) diff --git a/packages/core-mobile/e2e/tests/playwright/qr_codes.txt b/packages/core-mobile/e2e/tests/playwright/qr_codes.txt index e69de29bb..de3d3cf60 100644 --- a/packages/core-mobile/e2e/tests/playwright/qr_codes.txt +++ b/packages/core-mobile/e2e/tests/playwright/qr_codes.txt @@ -0,0 +1 @@ +wc:31c703820476b8872418d94ea60cdbf95d7765fafe14bdeb4c97fd6981f2bf73@2?expiryTimestamp=1733761867&relay-protocol=irn&symKey=a9ea7df324e834da788cc8e117e137c5146c12382aea861eeb6be753e26ea764 \ No newline at end of file diff --git a/packages/core-mobile/e2e/tests/playwright/stakeLido.spec.ts b/packages/core-mobile/e2e/tests/playwright/stakeLido.spec.ts index 6ae349182..46958fec5 100644 --- a/packages/core-mobile/e2e/tests/playwright/stakeLido.spec.ts +++ b/packages/core-mobile/e2e/tests/playwright/stakeLido.spec.ts @@ -1,25 +1,23 @@ -import { test, expect } from '@playwright/test' -import actions from '../../helpers/actions' +import { test } from '@playwright/test' import CommonPlaywrightPage from '../../pages/commonPlaywrightEls.page' -import StakeLidoPage from '../../pages/stakeLido.page' +import actions from '../../helpers/playwrightActions' +import { playwrightSetup } from '../../helpers/playwrightSetup' +import DappsPlaywrightPage from '../../pages/dappsPlaywright.page' -test('check wallet connect button', async ({ page }) => { - const commonEls = new CommonPlaywrightPage(page) - const stakeLidoPage = new StakeLidoPage(page) +const getContext = playwrightSetup() - await actions.openPage(stakeLidoPage.page, stakeLidoPage.stakeLidoHomepage) - await expect(commonEls.connectWalletBtn).toBeVisible() - await commonEls.clickConnectWalletBtn() - await expect(stakeLidoPage.tosCheckbox).toBeVisible() - await stakeLidoPage.clickTosCheckbox() - await expect(commonEls.walletConnectBtn).toBeVisible() - await commonEls.clickWalletConnectBtn() - await expect(commonEls.wcmWalletUri).toBeVisible() - const qrUri = await commonEls.qrUriValue('wcm') +test('Connect StakeLido', async () => { + const { page } = getContext() + const common = new CommonPlaywrightPage(page) + const dapps = new DappsPlaywrightPage(page) + await actions.open(dapps.stakeLidoUrl, dapps.page) + await common.tapConnectWallet() + await actions.tap(dapps.lidoAgree) + await common.tapWalletConnect() + const qrUri = await common.qrUriValue() if (qrUri) { await actions.writeQrCodeToFile(qrUri) } - console.log('URI: ', qrUri) }) diff --git a/packages/core-mobile/e2e/tests/playwright/traderjoe.spec.ts b/packages/core-mobile/e2e/tests/playwright/traderjoe.spec.ts deleted file mode 100644 index f73108c37..000000000 --- a/packages/core-mobile/e2e/tests/playwright/traderjoe.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { test, expect } from '@playwright/test' -import actions from '../../helpers/actions' -import TraderJoePage from '../../pages/traderjoe.page' -import CommonElsPage from '../../pages/commonPlaywrightEls.page' - -test('check wallet connect button', async ({ page }) => { - const traderJoePage = new TraderJoePage(page) - const commonElsPage = new CommonElsPage(page) - - await actions.openPage(traderJoePage.page, traderJoePage.homePage) - await expect(commonElsPage.connectWalletBtn).toBeVisible() - await commonElsPage.clickConnectWalletBtn() - await expect(commonElsPage.walletConnectBtn).toBeVisible() - await commonElsPage.clickWalletConnectBtn() - await expect(traderJoePage.oldWalletConnectModal).toBeVisible() - await traderJoePage.clickOldWalletConnectModal() - const qrUri = await commonElsPage.qrUriValue() - - if (qrUri) { - await actions.writeQrCodeToFile(qrUri) - } - - console.log('Clipboard value:', qrUri) -}) diff --git a/packages/core-mobile/e2e/tests/playwright/uniswap.spec.ts b/packages/core-mobile/e2e/tests/playwright/uniswap.spec.ts index edf7e8943..cf15c698a 100644 --- a/packages/core-mobile/e2e/tests/playwright/uniswap.spec.ts +++ b/packages/core-mobile/e2e/tests/playwright/uniswap.spec.ts @@ -1,21 +1,22 @@ -import { test, expect } from '@playwright/test' -import actions from '../../helpers/actions' -import UniswapPage from '../../pages/uniswap.page' -import CommonElsPage from '../../pages/commonPlaywrightEls.page' +import { test } from '@playwright/test' +import CommonPlaywrightPage from '../../pages/commonPlaywrightEls.page' +import actions from '../../helpers/playwrightActions' +import { playwrightSetup } from '../../helpers/playwrightSetup' +import DappsPlaywrightPage from '../../pages/dappsPlaywright.page' -test('check wallet connect button', async ({ page }) => { - const uniswapPage = new UniswapPage(page) - const commonElsPage = new CommonElsPage(page) +const getContext = playwrightSetup() - await actions.openPage(uniswapPage.page, uniswapPage.uniswapHomePage) - await expect(uniswapPage.connectWalletBtn).toBeVisible() - await uniswapPage.clickConnectBtn() - await expect(commonElsPage.walletConnectBtn).toBeVisible() - await commonElsPage.clickWalletConnectBtn() - const qrCode = await commonElsPage.qrUriValue() +test('Connect UniSwap', async () => { + const { page } = getContext() + const common = new CommonPlaywrightPage(page) + const dapps = new DappsPlaywrightPage(page) - if (qrCode) { - await actions.writeQrCodeToFile(qrCode) + await actions.open(dapps.uniswapUrl, dapps.page) + await common.tapConnectWallet() + await common.tapWalletConnect() + const qrUri = await common.qrUriValue() + if (qrUri) { + await actions.writeQrCodeToFile(qrUri) } - console.log('Clipboard value:', qrCode) + console.log('URI: ', qrUri) }) diff --git a/packages/core-mobile/e2e/tests/playwright/yieldyak.spec.ts b/packages/core-mobile/e2e/tests/playwright/yieldyak.spec.ts index dbf6d5138..1e102d220 100644 --- a/packages/core-mobile/e2e/tests/playwright/yieldyak.spec.ts +++ b/packages/core-mobile/e2e/tests/playwright/yieldyak.spec.ts @@ -1,31 +1,23 @@ -import { test, expect } from '@playwright/test' +import { test } from '@playwright/test' import CommonPlaywrightPage from '../../pages/commonPlaywrightEls.page' -import YieldYakPage from '../../pages/yieldyak.page' -import actions from '../../helpers/actions' +import actions from '../../helpers/playwrightActions' +import { playwrightSetup } from '../../helpers/playwrightSetup' +import DappsPlaywrightPage from '../../pages/dappsPlaywright.page' -test('check wallet connect button', async ({ page, context }) => { - const commonEls = new CommonPlaywrightPage(page) - const yieldYak = new YieldYakPage(page) +const getContext = playwrightSetup() - await actions.openPage(yieldYak.page, yieldYak.yieldYakHomepage) +test('Connect YieldYak', async () => { + const { page } = getContext() + const common = new CommonPlaywrightPage(page) + const dapps = new DappsPlaywrightPage(page) - await expect(commonEls.connectWalletBtn).toBeVisible() - await commonEls.clickConnectWalletBtn() - await expect(yieldYak.showMoreBtn).toBeVisible() - await yieldYak.clickShowMoreBtn() - await expect(commonEls.walletConnectBtn).toBeVisible() - await commonEls.clickWalletConnectBtn() - await expect(commonEls.walletConnectUri).toBeVisible() - await commonEls.walletConnectUriValue() - - await context.grantPermissions(['clipboard-read']) - - const clipboardValue = await page.evaluate(() => { - // @ts-ignore - return navigator.clipboard.readText() - }) - - actions.writeQrCodeToFile(clipboardValue) - - console.log('URI: ', clipboardValue) + await actions.open(dapps.yieldYakUrl, dapps.page) + await common.tapConnectWallet() + await common.tapWalletConnect() + await common.tapOpen() + const qrUri = await common.qrUriValue() + if (qrUri) { + await actions.writeQrCodeToFile(qrUri) + } + console.log('URI: ', qrUri) }) From 8901663452e9318131b34f700171630bd29ea002 Mon Sep 17 00:00:00 2001 From: eunjisong Date: Mon, 9 Dec 2024 11:38:11 -0500 Subject: [PATCH 2/2] cleanup --- .../core-mobile/e2e/locators/oasis.loc.ts | 3 -- .../core-mobile/e2e/locators/traderjoe.loc.ts | 7 ----- .../e2e/tests/playwright/balancer.spec.ts | 1 + .../e2e/tests/playwright/benqi.spec.ts | 1 + .../tests/playwright/compoundFinance.spec.ts | 1 + .../e2e/tests/playwright/multichain.spec.ts | 30 +------------------ .../e2e/tests/playwright/qr_codes.txt | 1 - 7 files changed, 4 insertions(+), 40 deletions(-) delete mode 100644 packages/core-mobile/e2e/locators/oasis.loc.ts delete mode 100644 packages/core-mobile/e2e/locators/traderjoe.loc.ts diff --git a/packages/core-mobile/e2e/locators/oasis.loc.ts b/packages/core-mobile/e2e/locators/oasis.loc.ts deleted file mode 100644 index ba2f2ec6b..000000000 --- a/packages/core-mobile/e2e/locators/oasis.loc.ts +++ /dev/null @@ -1,3 +0,0 @@ -export default { - test: 'test' -} diff --git a/packages/core-mobile/e2e/locators/traderjoe.loc.ts b/packages/core-mobile/e2e/locators/traderjoe.loc.ts deleted file mode 100644 index 64c8f71b7..000000000 --- a/packages/core-mobile/e2e/locators/traderjoe.loc.ts +++ /dev/null @@ -1,7 +0,0 @@ -export default { - connectWalletButton: 'button.chakra-button', - connectWalletButtonText: 'Connect Wallet', - walletConnectButton: 'WalletConnect', - metamaskButton: 'MetaMask', - walletConnectCode: 'Copy to clipboard' -} diff --git a/packages/core-mobile/e2e/tests/playwright/balancer.spec.ts b/packages/core-mobile/e2e/tests/playwright/balancer.spec.ts index 6e56e4782..bc75e556b 100644 --- a/packages/core-mobile/e2e/tests/playwright/balancer.spec.ts +++ b/packages/core-mobile/e2e/tests/playwright/balancer.spec.ts @@ -10,6 +10,7 @@ test('Connect Balancer', async () => { const { page } = getContext() const common = new CommonPlaywrightPage(page) const dapps = new DappsPlaywrightPage(page) + await actions.open(dapps.balancerUrl, dapps.page) await common.tapConnectWallet() await common.tapWalletConnect() diff --git a/packages/core-mobile/e2e/tests/playwright/benqi.spec.ts b/packages/core-mobile/e2e/tests/playwright/benqi.spec.ts index 00b1ca5de..7464b3b09 100644 --- a/packages/core-mobile/e2e/tests/playwright/benqi.spec.ts +++ b/packages/core-mobile/e2e/tests/playwright/benqi.spec.ts @@ -10,6 +10,7 @@ test('Connect Benqi', async () => { const { page } = getContext() const common = new CommonPlaywrightPage(page) const dapps = new DappsPlaywrightPage(page) + await actions.open(dapps.benqiUrl, dapps.page) await common.tapConnectWallet(1) await common.tapWalletConnect() diff --git a/packages/core-mobile/e2e/tests/playwright/compoundFinance.spec.ts b/packages/core-mobile/e2e/tests/playwright/compoundFinance.spec.ts index 71250a4ca..c622e7d21 100644 --- a/packages/core-mobile/e2e/tests/playwright/compoundFinance.spec.ts +++ b/packages/core-mobile/e2e/tests/playwright/compoundFinance.spec.ts @@ -10,6 +10,7 @@ test('Connect CompoundFinance', async () => { const { page } = getContext() const common = new CommonPlaywrightPage(page) const dapps = new DappsPlaywrightPage(page) + await actions.open(dapps.compoundFinanceUrl, dapps.page) await common.tapConnectWallet() await common.tapWalletConnect() diff --git a/packages/core-mobile/e2e/tests/playwright/multichain.spec.ts b/packages/core-mobile/e2e/tests/playwright/multichain.spec.ts index 4964df225..a1ee9cabf 100644 --- a/packages/core-mobile/e2e/tests/playwright/multichain.spec.ts +++ b/packages/core-mobile/e2e/tests/playwright/multichain.spec.ts @@ -1,32 +1,3 @@ -// import { test, expect } from '@playwright/test' -// import CommonPlaywrightPage from '../../pages/commonPlaywrightEls.page' -// import MultichainPage from '../../pages/multichain.page' -// import actions from '../../helpers/actions' - -// test('check wallet connect button', async ({ page, context }) => { -// const commonEls = new CommonPlaywrightPage(page) -// const multichainPage = new MultichainPage(page) - -// await actions.openPage(multichainPage.page, multichainPage.multichainHomepage) - -// await expect(commonEls.connectToAWalletBtn).toBeVisible() -// await commonEls.clickConnectToAWalletBtn() -// await expect(commonEls.walletConnectBtn).toBeVisible() -// await commonEls.clickWalletConnectBtn() -// await expect(commonEls.walletConnectUri).toBeVisible() -// await commonEls.walletConnectUriValue() - -// await context.grantPermissions(['clipboard-read']) - -// const clipboardValue = await page.evaluate(() => { -// // @ts-ignore -// return navigator.clipboard.readText() -// }) - -// await actions.writeQrCodeToFile(clipboardValue) - -// console.log('URI: ', clipboardValue) -// }) import { test } from '@playwright/test' import CommonPlaywrightPage from '../../pages/commonPlaywrightEls.page' import actions from '../../helpers/playwrightActions' @@ -39,6 +10,7 @@ test('Connect MultiChain', async () => { const { page } = getContext() const common = new CommonPlaywrightPage(page) const dapps = new DappsPlaywrightPage(page) + await actions.open(dapps.multichainUrl, dapps.page) await common.tapConnectWallet() await common.tapWalletConnect() diff --git a/packages/core-mobile/e2e/tests/playwright/qr_codes.txt b/packages/core-mobile/e2e/tests/playwright/qr_codes.txt index de3d3cf60..e69de29bb 100644 --- a/packages/core-mobile/e2e/tests/playwright/qr_codes.txt +++ b/packages/core-mobile/e2e/tests/playwright/qr_codes.txt @@ -1 +0,0 @@ -wc:31c703820476b8872418d94ea60cdbf95d7765fafe14bdeb4c97fd6981f2bf73@2?expiryTimestamp=1733761867&relay-protocol=irn&symKey=a9ea7df324e834da788cc8e117e137c5146c12382aea861eeb6be753e26ea764 \ No newline at end of file