diff --git a/.github/workflows/ui_tests.yml b/.github/workflows/ui_tests.yml index bdc50085ed..7fc6d9483c 100644 --- a/.github/workflows/ui_tests.yml +++ b/.github/workflows/ui_tests.yml @@ -23,7 +23,7 @@ jobs: ui_tests: name: 'Playwright Tests' runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 steps: - name: checkout uses: actions/checkout@v3 @@ -64,6 +64,12 @@ jobs: name: playwright-report path: ./apps/laboratory/playwright-report/ retention-days: 7 + - uses: actions/upload-artifact@v3 + if: always() + with: + name: videos + path: ./apps/laboratory/test-results/ + retention-days: 7 - uses: actions/upload-artifact@v3 if: always() with: diff --git a/.gitignore b/.gitignore index f5dc69bbbe..0edfd8c462 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ lerna-debug.log .turbo playwright-report/ screenshots/ +test-results/ diff --git a/apps/laboratory/playwright.config.ts b/apps/laboratory/playwright.config.ts index 6231eb6133..3da74cb207 100644 --- a/apps/laboratory/playwright.config.ts +++ b/apps/laboratory/playwright.config.ts @@ -9,12 +9,12 @@ export default defineConfig({ testDir: './tests', fullyParallel: true, - retries: process.env['CI'] ? 2 : 0, - workers: process.env['CI'] ? 1 : undefined, + retries: 0, + workers: 2, reporter: [['list'], ['html']], expect: { - timeout: (process.env['CI'] ? 60 : 15) * 1000 + timeout: 30 * 1000 }, timeout: 60 * 1000, @@ -25,7 +25,7 @@ export default defineConfig({ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: 'on-first-retry', - video: process.env['CI'] ? 'off' : 'on-first-retry' + video: 'retain-on-failure' }, /* Configure projects for major browsers */ diff --git a/apps/laboratory/tests/shared/pages/ModalPage.ts b/apps/laboratory/tests/shared/pages/ModalPage.ts index 10a94e3f03..5d65467d68 100644 --- a/apps/laboratory/tests/shared/pages/ModalPage.ts +++ b/apps/laboratory/tests/shared/pages/ModalPage.ts @@ -1,4 +1,4 @@ -import type { Locator, Page } from '@playwright/test' +import { expect, type Locator, type Page } from '@playwright/test' import { BASE_URL } from '../constants' export type ModalFlavor = 'default' | 'siwe' @@ -29,8 +29,20 @@ export class ModalPage { await this.page.goto(this.url) await this.connectButton.click() await this.page.getByTestId('wallet-selector-walletconnect').click() - await this.page.waitForTimeout(2000) - await this.page.getByTestId('copy-wc2-uri').click() + // There is an issue in the modal where the URI might not be set + await expect + .poll( + async () => { + await this.page.getByTestId('copy-wc2-uri').click() + + return await this.page.evaluate('navigator.clipboard.readText()') + }, + { + message: 'Ensure WC URI is set', + timeout: 5000 + } + ) + .toContain('wc') } async disconnect() { diff --git a/apps/laboratory/tests/shared/pages/WalletPage.ts b/apps/laboratory/tests/shared/pages/WalletPage.ts index d2d07320bd..e3616a3264 100644 --- a/apps/laboratory/tests/shared/pages/WalletPage.ts +++ b/apps/laboratory/tests/shared/pages/WalletPage.ts @@ -19,12 +19,17 @@ export class WalletPage { async connect() { await this.gotoHome.click() + await this.page.waitForTimeout(3000) + await this.page.getByTestId('uri-input').click() // Paste clipboard const isMac = process.platform === 'darwin' const modifier = isMac ? 'Meta' : 'Control' await this.page.keyboard.press(`${modifier}+KeyV`) + + await this.page.waitForTimeout(2000) + await this.page.getByTestId('uri-connect-button').click() } diff --git a/apps/laboratory/tests/shared/validators/WalletValidator.ts b/apps/laboratory/tests/shared/validators/WalletValidator.ts index 9cedbadf47..9ce69a2813 100644 --- a/apps/laboratory/tests/shared/validators/WalletValidator.ts +++ b/apps/laboratory/tests/shared/validators/WalletValidator.ts @@ -15,10 +15,14 @@ export class WalletValidator { } async expectDisconnected() { - await this.page.waitForTimeout(1000) - await this.page.reload() - await this.gotoSessions.click() - await expect(this.page.getByTestId('session-card')).not.toBeVisible() + await expect.poll(async () => { + await this.page.reload() + await this.gotoSessions.click() + return await this.page.getByTestId('session-card').isVisible() + }, { + message: 'All sessions should be disconnected', + timeout: 15000, + }).toBe(false) } async expectReceivedSign({ chainName = 'Ethereum' }) {