From ff82a502418e8f089cc99281c3e060eb8537b67a Mon Sep 17 00:00:00 2001 From: jake Date: Fri, 29 Nov 2024 00:13:58 +0300 Subject: [PATCH] fix: fixes after review --- playwright-tests/.env.example | 6 +++--- playwright-tests/config/env.config.ts | 2 +- playwright-tests/pages/components/header.ts | 3 +-- playwright-tests/pages/components/index.ts | 4 ++++ playwright-tests/pages/components/stats.ts | 3 +-- .../pages/components/wallet-list-modal.ts | 3 +-- playwright-tests/pages/components/wallet-modal.ts | 3 +-- playwright-tests/pages/index.ts | 1 + playwright-tests/pages/reefKnot.page.ts | 15 ++++----------- .../services/browser/browser.service.ts | 2 +- playwright-tests/services/fixture.service.ts | 2 +- .../services/{helpers => }/helpers.ts | 0 playwright-tests/services/index.ts | 4 ++++ playwright-tests/services/reef-knot.service.ts | 7 +++---- playwright-tests/services/sdk.service.ts | 4 ++-- playwright-tests/test-data/index.ts | 3 +++ playwright-tests/tests/connectWallet.spec.ts | 11 +++++------ playwright-tests/tests/matomo-event.spec.ts | 12 ++++++------ playwright-tests/tsconfig.json | 13 +++++-------- 19 files changed, 47 insertions(+), 51 deletions(-) create mode 100644 playwright-tests/pages/components/index.ts create mode 100644 playwright-tests/pages/index.ts rename playwright-tests/services/{helpers => }/helpers.ts (100%) create mode 100644 playwright-tests/services/index.ts create mode 100644 playwright-tests/test-data/index.ts diff --git a/playwright-tests/.env.example b/playwright-tests/.env.example index b205010c..7bfbccb9 100644 --- a/playwright-tests/.env.example +++ b/playwright-tests/.env.example @@ -9,9 +9,9 @@ STAND_LINK_TYPE=testnet # Wallet configurations ## Secret phase of the wallet to set up the wallet extension WALLET_SECRET_PHRASE= -## Wallet password -WALLET_PASSWORD=QwerTY!123! -## Lido rpc private key (ask QA team) +## Wallet password (use minimal 10 symbols with uppercase, lowercase, numbers, and symbols) +WALLET_PASSWORD= +## Drpc private key RPC_URL_KEY= # Qase reporter diff --git a/playwright-tests/config/env.config.ts b/playwright-tests/config/env.config.ts index eda33abe..3e768114 100644 --- a/playwright-tests/config/env.config.ts +++ b/playwright-tests/config/env.config.ts @@ -17,7 +17,7 @@ export const STAND_TYPE = { }; export const STAND_LINK = { - testnet: 'https://lidofinance.github.io/', + testnet: 'https://lidofinance.github.io/reef-knot/', localhost: 'http://localhost:3000/', }; diff --git a/playwright-tests/pages/components/header.ts b/playwright-tests/pages/components/header.ts index c1d98fab..ccaea1a6 100644 --- a/playwright-tests/pages/components/header.ts +++ b/playwright-tests/pages/components/header.ts @@ -1,5 +1,4 @@ -import { Page } from 'playwright'; -import { Locator } from '@playwright/test'; +import { Locator, Page } from '@playwright/test'; export class Header { page: Page; diff --git a/playwright-tests/pages/components/index.ts b/playwright-tests/pages/components/index.ts new file mode 100644 index 00000000..84876596 --- /dev/null +++ b/playwright-tests/pages/components/index.ts @@ -0,0 +1,4 @@ +export * from './header'; +export * from './stats'; +export * from './wallet-list-modal'; +export * from './wallet-modal'; diff --git a/playwright-tests/pages/components/stats.ts b/playwright-tests/pages/components/stats.ts index ed7cd9aa..9da76d0c 100644 --- a/playwright-tests/pages/components/stats.ts +++ b/playwright-tests/pages/components/stats.ts @@ -1,5 +1,4 @@ -import { Page } from 'playwright'; -import { Locator } from '@playwright/test'; +import { Locator, Page } from '@playwright/test'; export class StatsBlock { page: Page; diff --git a/playwright-tests/pages/components/wallet-list-modal.ts b/playwright-tests/pages/components/wallet-list-modal.ts index e7bdacf8..78f728eb 100644 --- a/playwright-tests/pages/components/wallet-list-modal.ts +++ b/playwright-tests/pages/components/wallet-list-modal.ts @@ -1,5 +1,4 @@ -import { Page } from 'playwright'; -import { Locator, test } from '@playwright/test'; +import { Page, Locator, test } from '@playwright/test'; export class WalletListModal { page: Page; diff --git a/playwright-tests/pages/components/wallet-modal.ts b/playwright-tests/pages/components/wallet-modal.ts index ea8c5728..ce110250 100644 --- a/playwright-tests/pages/components/wallet-modal.ts +++ b/playwright-tests/pages/components/wallet-modal.ts @@ -1,5 +1,4 @@ -import { Locator } from '@playwright/test'; -import { Page } from 'playwright'; +import { Page, Locator } from '@playwright/test'; export class WalletModal { page: Page; diff --git a/playwright-tests/pages/index.ts b/playwright-tests/pages/index.ts new file mode 100644 index 00000000..3b7bdbc6 --- /dev/null +++ b/playwright-tests/pages/index.ts @@ -0,0 +1 @@ +export * from './reefKnot.page'; diff --git a/playwright-tests/pages/reefKnot.page.ts b/playwright-tests/pages/reefKnot.page.ts index c870d7f8..d84ba2c3 100644 --- a/playwright-tests/pages/reefKnot.page.ts +++ b/playwright-tests/pages/reefKnot.page.ts @@ -1,11 +1,6 @@ -import { Page } from 'playwright'; -import { Header } from './components/header'; -import { REEF_KNOT_CONFIG } from '../config'; -import { WalletListModal } from './components/wallet-list-modal'; -import { test } from '@playwright/test'; -import { TIMEOUT } from '../test-data/timeout.data'; -import { StatsBlock } from './components/stats'; -import { WalletModal } from './components/wallet-modal'; +import { Header, WalletListModal, StatsBlock, WalletModal } from './components'; +import { Page, test } from '@playwright/test'; +import { TIMEOUT } from '@test-data'; export class ReefKnotPage { readonly page: Page; @@ -23,9 +18,7 @@ export class ReefKnotPage { } async goto(param = '') { - const link = - REEF_KNOT_CONFIG.STAND_LINK_TYPE === 'testnet' ? '/reef-knot' : ''; - await this.page.goto(link + param); + await this.page.goto(param); } async allowUseCookies() { diff --git a/playwright-tests/services/browser/browser.service.ts b/playwright-tests/services/browser/browser.service.ts index 42646a06..3aed63de 100644 --- a/playwright-tests/services/browser/browser.service.ts +++ b/playwright-tests/services/browser/browser.service.ts @@ -10,7 +10,7 @@ import { WALLET_PAGES, } from './browser.constants'; import { BrowserContextService } from './browser-context.service'; -import { REEF_KNOT_CONFIG } from '../../config'; +import { REEF_KNOT_CONFIG } from '@config'; export class BrowserService { private walletPage: WalletPage; diff --git a/playwright-tests/services/fixture.service.ts b/playwright-tests/services/fixture.service.ts index 9ace86a6..dc6b8fa2 100644 --- a/playwright-tests/services/fixture.service.ts +++ b/playwright-tests/services/fixture.service.ts @@ -2,7 +2,7 @@ import { test as base } from '@playwright/test'; import { METAMASK_COMMON_CONFIG } from '@lidofinance/wallets-testing-wallets'; import { ETHEREUM_WIDGET_CONFIG } from '@lidofinance/wallets-testing-widgets'; import { ExtensionService } from '@lidofinance/wallets-testing-extensions'; -import { BrowserService } from './browser'; +import { BrowserService } from '@browser'; import { ReefKnotService } from './reef-knot.service'; type Fixtures = object; diff --git a/playwright-tests/services/helpers/helpers.ts b/playwright-tests/services/helpers.ts similarity index 100% rename from playwright-tests/services/helpers/helpers.ts rename to playwright-tests/services/helpers.ts diff --git a/playwright-tests/services/index.ts b/playwright-tests/services/index.ts new file mode 100644 index 00000000..463c330f --- /dev/null +++ b/playwright-tests/services/index.ts @@ -0,0 +1,4 @@ +export * from './reef-knot.service'; +export * from './fixture.service'; +export * from './sdk.service'; +export * from './helpers'; diff --git a/playwright-tests/services/reef-knot.service.ts b/playwright-tests/services/reef-knot.service.ts index 33155b2f..66d515dd 100644 --- a/playwright-tests/services/reef-knot.service.ts +++ b/playwright-tests/services/reef-knot.service.ts @@ -1,8 +1,7 @@ -import { expect, test } from '@playwright/test'; -import { Page } from 'playwright'; -import { ReefKnotPage } from '../pages/reefKnot.page'; +import { expect, test, Page } from '@playwright/test'; +import { ReefKnotPage } from '@pages'; import { WalletPage } from '@lidofinance/wallets-testing-wallets'; -import { TIMEOUT } from '../test-data/timeout.data'; +import { TIMEOUT } from '@test-data'; import { HDAccount, mnemonicToAccount } from 'viem/accounts'; import { SdkService } from './sdk.service'; diff --git a/playwright-tests/services/sdk.service.ts b/playwright-tests/services/sdk.service.ts index c942745b..da9d351e 100644 --- a/playwright-tests/services/sdk.service.ts +++ b/playwright-tests/services/sdk.service.ts @@ -1,7 +1,7 @@ import { LidoSDK, VIEM_CHAINS } from '@lidofinance/lido-ethereum-sdk'; -import { HDAccount, mnemonicToAccount } from 'viem/accounts'; +import { HDAccount } from 'viem/accounts'; import { createWalletClient, http } from 'viem'; -import { REEF_KNOT_CONFIG } from '../config'; +import { REEF_KNOT_CONFIG } from '@config'; global.fetch = fetch; diff --git a/playwright-tests/test-data/index.ts b/playwright-tests/test-data/index.ts new file mode 100644 index 00000000..a082e3bb --- /dev/null +++ b/playwright-tests/test-data/index.ts @@ -0,0 +1,3 @@ +export * from './matomo.data'; +export * from './tags.data'; +export * from './timeout.data'; diff --git a/playwright-tests/tests/connectWallet.spec.ts b/playwright-tests/tests/connectWallet.spec.ts index 1a8f74d3..799f6a00 100644 --- a/playwright-tests/tests/connectWallet.spec.ts +++ b/playwright-tests/tests/connectWallet.spec.ts @@ -1,10 +1,9 @@ -import { test } from '../services/fixture.service'; -import { Tags } from '../test-data/tags.data'; -import { ReefKnotPage } from '../pages/reefKnot.page'; +import { test, toCut } from '@services'; +import { Tags } from '@test-data'; +import { ReefKnotPage } from '@pages'; import { expect } from '@playwright/test'; -import { REEF_KNOT_CONFIG } from '../config'; +import { REEF_KNOT_CONFIG } from '@config'; import { formatEther } from 'viem'; -import { toCut } from '../services/helpers/helpers'; import { qase } from 'playwright-qase-reporter'; test.describe.serial( @@ -72,7 +71,7 @@ test.describe.serial( await reefKnotService.walletPage.page.close(); await expect( reefKnotPage.statsBlock.ethBalance, - 'Expected the ETH balance comply with ReefKnot stats block', + 'Expected the wallet ETH balance comply with ReefKnot stats block', ).toContainText(walletEthBalance); }); diff --git a/playwright-tests/tests/matomo-event.spec.ts b/playwright-tests/tests/matomo-event.spec.ts index 2999f9fe..96978f00 100644 --- a/playwright-tests/tests/matomo-event.spec.ts +++ b/playwright-tests/tests/matomo-event.spec.ts @@ -1,8 +1,8 @@ -import { test } from '../services/fixture.service'; -import { ReefKnotPage } from '../pages/reefKnot.page'; -import { CONFIG_MATOMO_CLICK_TO_WALLET_EVENTS } from '../test-data/matomo.data'; +import { test } from '@services'; +import { ReefKnotPage } from '@pages'; +import { CONFIG_MATOMO_CLICK_TO_WALLET_EVENTS } from '@test-data'; import { expect } from '@playwright/test'; -import { Tags } from '../test-data/tags.data'; +import { Tags } from '@test-data'; import { qase } from 'playwright-qase-reporter'; test.describe('ReefKnot. Matomo events', async () => { @@ -58,8 +58,8 @@ test.describe('ReefKnot. Matomo events', async () => { test( qase(431, 'Click to buttons "More wallets" and "Less wallets"'), async () => { - const expectedMoreWalletsNameParam = 'More Wallets clicked'; - const expectedLessWalletsNameParam = 'Less Wallets clicked'; + const expectedMoreWalletsNameParam = 'more wallets clicked'; + const expectedLessWalletsNameParam = 'less wallets clicked'; await test.step('Open the wallet popup', async () => { await reefKnotPage.header.connectWalletButton.click(); diff --git a/playwright-tests/tsconfig.json b/playwright-tests/tsconfig.json index 5d18514f..25718e7c 100644 --- a/playwright-tests/tsconfig.json +++ b/playwright-tests/tsconfig.json @@ -26,14 +26,11 @@ ], "baseUrl": ".", "paths": { - "@testData": ["tests/widget/testData"], - "@config": ["tests/widget/config"], - "@pages": ["tests/widget/pages"], - "@elements/*": ["tests/widget/pages/elements/*"], - "@utils/*": ["tests/widget/utils/*"], - "@services": ["tests/widget/services"], - "@testFixture": ["tests/widget/tests/test.fixture"], - "@browser": ["tests/widget/browser"] + "@test-data": ["test-data"], + "@config": ["config"], + "@pages": ["pages"], + "@services": ["services"], + "@browser": ["services/browser"] } }, }