From 5d9b91d5dee8d3c3ca801589399d91e7f0f2d56f Mon Sep 17 00:00:00 2001 From: itaven Date: Thu, 8 Feb 2024 18:17:00 +0400 Subject: [PATCH 1/2] fix: rename mm setAggressiveGas() locator --- packages/wallets/src/metamask/metamask.page.ts | 2 +- packages/widgets/src/ethereum/ethereum.page.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/wallets/src/metamask/metamask.page.ts b/packages/wallets/src/metamask/metamask.page.ts index 6e5c54cf..7d34b9c9 100644 --- a/packages/wallets/src/metamask/metamask.page.ts +++ b/packages/wallets/src/metamask/metamask.page.ts @@ -245,7 +245,7 @@ export class MetamaskPage implements WalletPage { async confirmTx(page: Page, setAggressiveGas?: boolean) { await test.step('Confirm TX', async () => { if (setAggressiveGas) { - await page.getByTestId('edit-gas-fee-button').click(); + await page.getByTestId('edit-gas-fee-icon').click(); await page.getByTestId('edit-gas-fee-item-high').click(); } await page.click('text=Confirm'); diff --git a/packages/widgets/src/ethereum/ethereum.page.ts b/packages/widgets/src/ethereum/ethereum.page.ts index 943a42fc..b5b9230e 100644 --- a/packages/widgets/src/ethereum/ethereum.page.ts +++ b/packages/widgets/src/ethereum/ethereum.page.ts @@ -62,6 +62,7 @@ export class EthereumPage implements WidgetPage { async doStaking(walletPage: WalletPage) { await test.step('Do staking', async () => { + await this.page.waitForTimeout(4000); await this.page.fill( 'input[type=text]', String(this.stakeConfig.stakeAmount), From 6121accdb097796306bc2a4c9a92d23aa412e088 Mon Sep 17 00:00:00 2001 From: itaven Date: Thu, 8 Feb 2024 18:18:01 +0400 Subject: [PATCH 2/2] refactor: remove polkadot,kusama,solana --- packages/widgets/src/index.ts | 3 - packages/widgets/src/kusama/index.ts | 2 - .../widgets/src/kusama/kusama.constants.ts | 14 ---- packages/widgets/src/kusama/kusama.page.ts | 72 ------------------- packages/widgets/src/polkadot/index.ts | 2 - .../src/polkadot/polkadot.constants.ts | 13 ---- .../widgets/src/polkadot/polkadot.page.ts | 72 ------------------- packages/widgets/src/solana/index.ts | 2 - .../widgets/src/solana/solana.constants.ts | 10 --- packages/widgets/src/solana/solana.page.ts | 68 ------------------ wallets-testing/browser/browser.constants.ts | 6 -- wallets-testing/test/widgets/kusama.spec.ts | 31 -------- wallets-testing/test/widgets/polkadot.spec.ts | 31 -------- wallets-testing/test/widgets/solana.spec.ts | 45 ------------ 14 files changed, 371 deletions(-) delete mode 100644 packages/widgets/src/kusama/index.ts delete mode 100644 packages/widgets/src/kusama/kusama.constants.ts delete mode 100644 packages/widgets/src/kusama/kusama.page.ts delete mode 100644 packages/widgets/src/polkadot/index.ts delete mode 100644 packages/widgets/src/polkadot/polkadot.constants.ts delete mode 100644 packages/widgets/src/polkadot/polkadot.page.ts delete mode 100644 packages/widgets/src/solana/index.ts delete mode 100644 packages/widgets/src/solana/solana.constants.ts delete mode 100644 packages/widgets/src/solana/solana.page.ts delete mode 100644 wallets-testing/test/widgets/kusama.spec.ts delete mode 100644 wallets-testing/test/widgets/polkadot.spec.ts delete mode 100644 wallets-testing/test/widgets/solana.spec.ts diff --git a/packages/widgets/src/index.ts b/packages/widgets/src/index.ts index 3e473d29..e63922e0 100644 --- a/packages/widgets/src/index.ts +++ b/packages/widgets/src/index.ts @@ -2,6 +2,3 @@ export * from './widgets.constants'; export * from './widgets.page'; export * from './ethereum'; export * from './polygon'; -export * from './kusama'; -export * from './polkadot'; -export * from './solana'; diff --git a/packages/widgets/src/kusama/index.ts b/packages/widgets/src/kusama/index.ts deleted file mode 100644 index 613a4106..00000000 --- a/packages/widgets/src/kusama/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './kusama.page'; -export * from './kusama.constants'; diff --git a/packages/widgets/src/kusama/kusama.constants.ts b/packages/widgets/src/kusama/kusama.constants.ts deleted file mode 100644 index 70536fcc..00000000 --- a/packages/widgets/src/kusama/kusama.constants.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { WidgetConfig } from '../widgets.constants'; - -export const KUSAMA_WIDGET_CONFIG: WidgetConfig = { - url: 'https://kusama.lido.fi/', - nodeUrl: 'https://rpc.moonriver.moonbeam.network', - isDefaultNetwork: false, - name: 'kusama', - networkName: 'Ethereum', - stakeContract: '0xffc7780c34b450d917d557e728f033033cb4fa8c', - wrapContract: '', - chainId: 1285, - chainName: 'Moonriver', - tokenSymbol: 'MOVR', -}; diff --git a/packages/widgets/src/kusama/kusama.page.ts b/packages/widgets/src/kusama/kusama.page.ts deleted file mode 100644 index 9142d1ae..00000000 --- a/packages/widgets/src/kusama/kusama.page.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { WidgetPage } from '../widgets.page'; -import { Logger } from '@nestjs/common'; -import { Page, test } from '@playwright/test'; -import { StakeConfig } from '../widgets.constants'; -import { WalletPage } from '@lidofinance/wallets-testing-wallets'; -import { KUSAMA_WIDGET_CONFIG } from './kusama.constants'; -import expect from 'expect'; - -export class KusamaPage implements WidgetPage { - private readonly logger = new Logger(KusamaPage.name); - page: Page; - - constructor(page: Page, private stakeConfig: StakeConfig) { - this.page = page; - } - - async navigate(): Promise { - await test.step('Navigate to Kusama widget', async () => { - await this.page.goto(KUSAMA_WIDGET_CONFIG.url); - }); - } - - async connectWallet(walletPage: WalletPage): Promise { - await test.step( - 'Connect wallet ' + walletPage.config.COMMON.WALLET_NAME, - async () => { - await this.page.waitForTimeout(2000); - const isConnected = - (await this.page - .locator("button :has-text('Connect wallet')") - .count()) === 0; - if (!isConnected) { - await this.page - .locator("button :has-text('Connect wallet')") - .first() - .click(); - await this.page.waitForTimeout(2000); - if ( - (await this.page.locator("button :has-text('Stake')").count()) === 0 - ) { - if (!(await this.page.isChecked('input[type=checkbox]'))) - await this.page.click('input[type=checkbox]', { force: true }); - if (walletPage.config.COMMON.SIMPLE_CONNECT) { - await this.page.click( - `button[type=button] :text('${walletPage.config.COMMON.CONNECT_BUTTON_NAME}')`, - ); - } else { - const [connectWalletPage] = await Promise.all([ - this.page.context().waitForEvent('page', { timeout: 5000 }), - this.page.click( - `button[type=button] :text('${walletPage.config.COMMON.CONNECT_BUTTON_NAME}')`, - ), - ]); - await walletPage.connectWallet(connectWalletPage); - } - expect( - await this.page.waitForSelector("button :has-text('Stake')"), - ).not.toBeNaN(); - await this.page.locator('header > div > button').nth(0).click(); - expect(await this.page.textContent('div[role="dialog"]')).toContain( - `Connected with ${walletPage.config.COMMON.CONNECTED_WALLET_NAME}`, - ); - await this.page.locator('div[role="dialog"] button').nth(0).click(); - } - } - }, - ); - } - - // eslint-disable-next-line - async doStaking(walletPage: WalletPage): Promise {} -} diff --git a/packages/widgets/src/polkadot/index.ts b/packages/widgets/src/polkadot/index.ts deleted file mode 100644 index 1886655b..00000000 --- a/packages/widgets/src/polkadot/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './polkadot.page'; -export * from './polkadot.constants'; diff --git a/packages/widgets/src/polkadot/polkadot.constants.ts b/packages/widgets/src/polkadot/polkadot.constants.ts deleted file mode 100644 index 214ef027..00000000 --- a/packages/widgets/src/polkadot/polkadot.constants.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { WidgetConfig } from '../widgets.constants'; - -export const POLKADOT_WIDGET_CONFIG: WidgetConfig = { - url: 'https://polkadot.lido.fi/', - nodeUrl: 'https://rpc.api.moonbeam.network/', - isDefaultNetwork: false, - name: 'polkadot', - networkName: 'Ethereum', - stakeContract: '0xFA36Fe1dA08C89eC72Ea1F0143a35bFd5DAea108', - chainId: 1284, - chainName: 'Moonbeam', - tokenSymbol: 'GLMR', -}; diff --git a/packages/widgets/src/polkadot/polkadot.page.ts b/packages/widgets/src/polkadot/polkadot.page.ts deleted file mode 100644 index d24c288f..00000000 --- a/packages/widgets/src/polkadot/polkadot.page.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { WidgetPage } from '../widgets.page'; -import { Logger } from '@nestjs/common'; -import { Page, test } from '@playwright/test'; -import { StakeConfig } from '../widgets.constants'; -import { WalletPage } from '@lidofinance/wallets-testing-wallets'; -import { POLKADOT_WIDGET_CONFIG } from './polkadot.constants'; -import expect from 'expect'; - -export class PolkadotPage implements WidgetPage { - private readonly logger = new Logger(PolkadotPage.name); - page: Page; - - constructor(page: Page, private stakeConfig: StakeConfig) { - this.page = page; - } - - async navigate(): Promise { - await test.step('Navigate to Kusama widget', async () => { - await this.page.goto(POLKADOT_WIDGET_CONFIG.url); - }); - } - - async connectWallet(walletPage: WalletPage): Promise { - await test.step( - 'Connect wallet ' + walletPage.config.COMMON.WALLET_NAME, - async () => { - await this.page.waitForTimeout(2000); - const isConnected = - (await this.page - .locator("button :has-text('Connect wallet')") - .count()) === 0; - if (!isConnected) { - await this.page - .locator("button :has-text('Connect wallet')") - .first() - .click(); - await this.page.waitForTimeout(2000); - if ( - (await this.page.locator("button :has-text('Stake')").count()) === 0 - ) { - if (!(await this.page.isChecked('input[type=checkbox]'))) - await this.page.click('input[type=checkbox]', { force: true }); - if (walletPage.config.COMMON.SIMPLE_CONNECT) { - await this.page.click( - `button[type=button] :text('${walletPage.config.COMMON.CONNECT_BUTTON_NAME}')`, - ); - } else { - const [connectWalletPage] = await Promise.all([ - this.page.context().waitForEvent('page', { timeout: 5000 }), - this.page.click( - `button[type=button] :text('${walletPage.config.COMMON.CONNECT_BUTTON_NAME}')`, - ), - ]); - await walletPage.connectWallet(connectWalletPage); - } - expect( - await this.page.waitForSelector("button :has-text('Stake')"), - ).not.toBeNaN(); - await this.page.locator('header > div > button').nth(0).click(); - expect(await this.page.textContent('div[role="dialog"]')).toContain( - `Connected with ${walletPage.config.COMMON.CONNECTED_WALLET_NAME}`, - ); - await this.page.locator('div[role="dialog"] button').nth(0).click(); - } - } - }, - ); - } - - // eslint-disable-next-line - async doStaking(walletPage: WalletPage): Promise {} -} diff --git a/packages/widgets/src/solana/index.ts b/packages/widgets/src/solana/index.ts deleted file mode 100644 index 0c3f6f29..00000000 --- a/packages/widgets/src/solana/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './solana.page'; -export * from './solana.constants'; diff --git a/packages/widgets/src/solana/solana.constants.ts b/packages/widgets/src/solana/solana.constants.ts deleted file mode 100644 index 83a2b3c2..00000000 --- a/packages/widgets/src/solana/solana.constants.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { WidgetConfig } from '../widgets.constants'; - -export const SOLANA_WIDGET_CONFIG: WidgetConfig = { - url: 'https://solana.lido.fi/', - nodeUrl: '', - isDefaultNetwork: true, - name: 'solana', - networkName: 'Solana', - stakeContract: '7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj', -}; diff --git a/packages/widgets/src/solana/solana.page.ts b/packages/widgets/src/solana/solana.page.ts deleted file mode 100644 index 7b2e29ce..00000000 --- a/packages/widgets/src/solana/solana.page.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { SOLANA_WIDGET_CONFIG } from './solana.constants'; -import { StakeConfig } from '../widgets.constants'; -import { WidgetPage } from '../widgets.page'; -import expect from 'expect'; -import { Logger } from '@nestjs/common'; -import { WalletPage } from '@lidofinance/wallets-testing-wallets'; -import { test, Page } from '@playwright/test'; - -export class SolanaPage implements WidgetPage { - private readonly logger = new Logger(SolanaPage.name); - page: Page; - - constructor(page: Page, private stakeConfig: StakeConfig) { - this.page = page; - } - - async navigate() { - await test.step('Navigate to Solana widget', async () => { - await this.page.goto(SOLANA_WIDGET_CONFIG.url); - }); - } - - async connectWallet(walletPage: WalletPage) { - await test.step( - 'Connect wallet ' + walletPage.config.COMMON.WALLET_NAME, - async () => { - await this.page.waitForTimeout(2000); - const isConnected = - (await this.page - .locator('button:has-text("Connect wallet")') - .count()) === 0; - if (!isConnected) { - await this.page - .locator("button:has-text('Connect wallet')") - .first() - .click(); - await this.page.waitForTimeout(2000); - if ( - (await this.page.locator("button :has-text('Submit')").count()) === - 0 - ) { - if (!(await this.page.isChecked('input[type=checkbox]'))) - await this.page.click('input[type=checkbox]', { force: true }); - if (walletPage.config.COMMON.SIMPLE_CONNECT) { - await this.page.click( - `button[type=button] :text('${walletPage.config.COMMON.CONNECT_BUTTON_NAME}')`, - ); - } else { - const [connectWalletPage] = await Promise.all([ - this.page.context().waitForEvent('page', { timeout: 5000 }), - this.page.click( - `button[type=button] :text('${walletPage.config.COMMON.CONNECT_BUTTON_NAME}')`, - ), - ]); - await walletPage.connectWallet(connectWalletPage); - } - expect( - await this.page.waitForSelector("button:has-text('Submit')"), - ).not.toBeNaN(); - } - } - }, - ); - } - - // eslint-disable-next-line - async doStaking(walletPage: WalletPage) {} -} diff --git a/wallets-testing/browser/browser.constants.ts b/wallets-testing/browser/browser.constants.ts index c52c9f93..59c25a06 100644 --- a/wallets-testing/browser/browser.constants.ts +++ b/wallets-testing/browser/browser.constants.ts @@ -10,10 +10,7 @@ import { } from '@lidofinance/wallets-testing-wallets'; import { EthereumPage, - KusamaPage, - PolkadotPage, PolygonPage, - SolanaPage, } from '@lidofinance/wallets-testing-widgets'; export const WALLET_PAGES = { @@ -30,7 +27,4 @@ export const WALLET_PAGES = { export const WIDGET_PAGES = { ethereum: EthereumPage, polygon: PolygonPage, - kusama: KusamaPage, - polkadot: PolkadotPage, - solana: SolanaPage, }; diff --git a/wallets-testing/test/widgets/kusama.spec.ts b/wallets-testing/test/widgets/kusama.spec.ts deleted file mode 100644 index 65bd92f9..00000000 --- a/wallets-testing/test/widgets/kusama.spec.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { INestApplication } from '@nestjs/common'; -import { prepareNodeModule } from '../../commons'; -import { METAMASK_COMMON_CONFIG } from '@lidofinance/wallets-testing-wallets'; -import { KUSAMA_WIDGET_CONFIG } from '@lidofinance/wallets-testing-widgets'; -import { BrowserModule } from '../../browser/browser.module'; -import { BrowserService } from '../../browser/browser.service'; -import { test } from '@playwright/test'; - -test.describe.skip('Kusama', () => { - let app: INestApplication; - let browserService: BrowserService; - - test.beforeAll(async () => { - const moduleFixture: TestingModule = await Test.createTestingModule({ - imports: [prepareNodeModule(), BrowserModule], - }).compile(); - app = moduleFixture.createNestApplication(); - await app.init(); - browserService = moduleFixture.get(BrowserService); - }); - - test(`Metamask connect`, async () => { - await browserService.setup(METAMASK_COMMON_CONFIG, KUSAMA_WIDGET_CONFIG); - await browserService.connectWallet(); - }); - - test.afterEach(async () => { - await browserService.teardown(); - }); -}); diff --git a/wallets-testing/test/widgets/polkadot.spec.ts b/wallets-testing/test/widgets/polkadot.spec.ts deleted file mode 100644 index 6ed21400..00000000 --- a/wallets-testing/test/widgets/polkadot.spec.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { INestApplication } from '@nestjs/common'; -import { prepareNodeModule } from '../../commons'; -import { METAMASK_COMMON_CONFIG } from '@lidofinance/wallets-testing-wallets'; -import { POLKADOT_WIDGET_CONFIG } from '@lidofinance/wallets-testing-widgets'; -import { BrowserModule } from '../../browser/browser.module'; -import { BrowserService } from '../../browser/browser.service'; -import { test } from '@playwright/test'; - -test.describe.skip('Polkadot', () => { - let app: INestApplication; - let browserService: BrowserService; - - test.beforeAll(async () => { - const moduleFixture: TestingModule = await Test.createTestingModule({ - imports: [prepareNodeModule(), BrowserModule], - }).compile(); - app = moduleFixture.createNestApplication(); - await app.init(); - browserService = moduleFixture.get(BrowserService); - }); - - test(`Metamask connect`, async () => { - await browserService.setup(METAMASK_COMMON_CONFIG, POLKADOT_WIDGET_CONFIG); - await browserService.connectWallet(); - }); - - test.afterEach(async () => { - await browserService.teardown(); - }); -}); diff --git a/wallets-testing/test/widgets/solana.spec.ts b/wallets-testing/test/widgets/solana.spec.ts deleted file mode 100644 index 6522b9eb..00000000 --- a/wallets-testing/test/widgets/solana.spec.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { INestApplication } from '@nestjs/common'; -import { prepareNodeModule } from '../../commons'; -import { - COINBASE_COMMON_CONFIG, - COIN98_COMMON_CONFIG, - EXODUS_COMMON_CONFIG, -} from '@lidofinance/wallets-testing-wallets'; -import { SOLANA_WIDGET_CONFIG } from '@lidofinance/wallets-testing-widgets'; -import { BrowserModule } from '../../browser/browser.module'; -import { BrowserService } from '../../browser/browser.service'; -import { test } from '@playwright/test'; - -test.describe.skip('Solana', () => { - let app: INestApplication; - let browserService: BrowserService; - - test.beforeAll(async () => { - const moduleFixture: TestingModule = await Test.createTestingModule({ - imports: [prepareNodeModule(), BrowserModule], - }).compile(); - app = moduleFixture.createNestApplication(); - await app.init(); - browserService = moduleFixture.get(BrowserService); - }); - - test(`Coinbase connect`, async () => { - await browserService.setup(COINBASE_COMMON_CONFIG, SOLANA_WIDGET_CONFIG); - await browserService.connectWallet(); - }); - - test.skip(`Coin98 connect`, async () => { - await browserService.setup(COIN98_COMMON_CONFIG, SOLANA_WIDGET_CONFIG); - await browserService.connectWallet(); - }); - - test.skip(`Exodus connect`, async () => { - await browserService.setup(EXODUS_COMMON_CONFIG, SOLANA_WIDGET_CONFIG); - await browserService.connectWallet(); - }); - - test.afterEach(async () => { - await browserService.teardown(); - }); -});