diff --git a/.github/actions/test/e2e/action.yml b/.github/actions/test/e2e/action.yml index 2427704055..819310e069 100644 --- a/.github/actions/test/e2e/action.yml +++ b/.github/actions/test/e2e/action.yml @@ -51,6 +51,7 @@ runs: BROWSER: ${{ inputs.BROWSER }} DISPLAY: ${{ inputs.DISPLAY }} BATCH: ${{ inputs.BATCH }} + SERVICE_WORKER_LOGS: true run: | commonTags="@Testnet and not @Pending" tagsToRun="'${commonTags}'" diff --git a/packages/e2e-tests/README.md b/packages/e2e-tests/README.md index fbdd511fac..7e541a0442 100755 --- a/packages/e2e-tests/README.md +++ b/packages/e2e-tests/README.md @@ -56,6 +56,8 @@ UI-mapped gherkin tests for the Lace browser extension environment variable) - `TEST_DAPP_URL=`(required) - url for test DApp (only for DApp Connector tests) +- `SERVICE_WORKER_LOGS=true|false` default=false (optional) + - enables service worker logs collection ## Run single feature file with params diff --git a/packages/e2e-tests/src/assert/walletAddressPageAssert.ts b/packages/e2e-tests/src/assert/walletAddressPageAssert.ts index c233edd702..f212ea6cef 100644 --- a/packages/e2e-tests/src/assert/walletAddressPageAssert.ts +++ b/packages/e2e-tests/src/assert/walletAddressPageAssert.ts @@ -27,7 +27,7 @@ class WalletAddressPageAssert { } await WalletAddressPage.drawerHeaderCloseButton.waitForDisplayed(); await WalletAddressPage.drawerHeaderSubtitle.waitForDisplayed(); - expect(await WalletAddressPage.drawerHeaderSubtitle.getText()).to.equal( + expect(await WalletAddressPage.drawerHeaderSubtitle.getText()).contains( await t('qrInfo.scanQRCodeToConnectWallet') ); await WalletAddressPage.qrCode.waitForDisplayed(); diff --git a/packages/e2e-tests/src/features/WalletAccountsExtended.feature b/packages/e2e-tests/src/features/WalletAccountsExtended.feature index aad9f1c822..c01b4c3e51 100644 --- a/packages/e2e-tests/src/features/WalletAccountsExtended.feature +++ b/packages/e2e-tests/src/features/WalletAccountsExtended.feature @@ -9,7 +9,7 @@ Feature: Wallet accounts When I click the menu button And I click on chevron for wallet number 1 Then "Accounts" menu is displayed - And I see 24 accounts on the list + And I see 50 accounts on the list And each account item contains icon, logo and path @LW-9299 diff --git a/packages/e2e-tests/src/features/WalletAccountsPopup.feature b/packages/e2e-tests/src/features/WalletAccountsPopup.feature index b1057022db..32b5ef0ba2 100644 --- a/packages/e2e-tests/src/features/WalletAccountsPopup.feature +++ b/packages/e2e-tests/src/features/WalletAccountsPopup.feature @@ -9,7 +9,7 @@ Feature: Wallet accounts When I click the menu button And I click on chevron for wallet number 1 Then "Accounts" menu is displayed - And I see 24 accounts on the list + And I see 50 accounts on the list And each account item contains icon, logo and path @LW-9319 diff --git a/packages/e2e-tests/src/hooks/scenarioTagRunner.ts b/packages/e2e-tests/src/hooks/scenarioTagRunner.ts index 76dcffc0f2..bc0b1c62b4 100644 --- a/packages/e2e-tests/src/hooks/scenarioTagRunner.ts +++ b/packages/e2e-tests/src/hooks/scenarioTagRunner.ts @@ -9,10 +9,13 @@ import { browser } from '@wdio/globals'; import consoleManager from '../utils/consoleManager'; import { clearWalletRepository } from '../fixture/walletRepositoryInitializer'; +import allure from '@wdio/allure-reporter'; // eslint-disable-next-line no-unused-vars Before(async () => { - // use Before hooks in feature steps file, see AddressBook.ts as an example + if (String(process.env.SERVICE_WORKER_LOGS) === 'true') { + await consoleManager.startLogsCollection(); + } }); After({ tags: 'not @Pending and not @pending' }, async () => { @@ -27,5 +30,16 @@ After({ tags: 'not @Pending and not @pending' }, async () => { }); AfterStep(async (scenario) => { - if (scenario.result.status === 'FAILED') await browser.takeScreenshot(); + if (scenario.result.status === 'FAILED') { + await browser.takeScreenshot(); + + if (String(process.env.SERVICE_WORKER_LOGS) === 'true') { + const logs = await consoleManager.getLogsAsString(); + if (logs !== undefined) { + allure.addAttachment('Service worker logs', logs, 'text/plain'); + } + } + await consoleManager.clearLogs(); + await consoleManager.closeOpenedCdpSessions(); + } }); diff --git a/packages/e2e-tests/src/utils/consoleManager.ts b/packages/e2e-tests/src/utils/consoleManager.ts index 577d7a9e64..9ffa9d138e 100644 --- a/packages/e2e-tests/src/utils/consoleManager.ts +++ b/packages/e2e-tests/src/utils/consoleManager.ts @@ -29,9 +29,7 @@ export class ConsoleManager { ConsoleManager.cdpSessions.push(client); await client.send(this.CONSOLE_ENABLE); client.on('Console.messageAdded', async (entry: any) => { - if (entry.message.level !== 'debug') { - ConsoleManager.capturedLogs.push(entry.message); - } + ConsoleManager.capturedLogs.push(entry.message); }); }); }); @@ -42,6 +40,15 @@ export class ConsoleManager { }; getLogs = async (): Promise => ConsoleManager.capturedLogs; + + getLogsAsString = async (): Promise => { + let logs; + for (const log of ConsoleManager.capturedLogs) { + logs = `${logs} ${JSON.stringify(log)}`; + } + return logs; + }; + closeOpenedCdpSessions = async (): Promise => { await this.clearLogs(); ConsoleManager.cdpSessions.map(async (session) => {