From b176180b56b86021dc72e2a3bd3599a5aa47f73a Mon Sep 17 00:00:00 2001 From: Jonathan Conn Date: Wed, 2 Aug 2023 13:49:46 -0400 Subject: [PATCH] fix: fixed minor bug, removed webkit, as it does not support clipboard, will add this back later --- .github/workflows/playwright_tests.yml | 12 +++------ laboratory/playwright.config.ts | 6 +---- .../tests/shared/validators/ModalValidator.ts | 24 ++++++++++++------ laboratory/tests/w3m-wallet.spec.ts | 25 ++++++++++++------- 4 files changed, 36 insertions(+), 31 deletions(-) diff --git a/.github/workflows/playwright_tests.yml b/.github/workflows/playwright_tests.yml index 82355eb097..cca8bdf632 100644 --- a/.github/workflows/playwright_tests.yml +++ b/.github/workflows/playwright_tests.yml @@ -22,14 +22,8 @@ env: jobs: e2e_tests: - name: 'Playwright Tests - ${{ matrix.project }} - Shard ${{ matrix.shardIndex }} of ${{ matrix.shardTotal }}' - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - project: [chromium, webkit, firefox] - shardIndex: [1, 2, 3] - shardTotal: [3] + name: 'Playwright Tests' + runs-on: ubuntu-latest timeout-minutes: 30 steps: - name: checkout @@ -53,7 +47,7 @@ jobs: - name: Run Playwright tests working-directory: ./laboratory - run: npx playwright test --project=${{ matrix.project }} --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} + run: npx playwright test - uses: actions/upload-artifact@v3 if: always() diff --git a/laboratory/playwright.config.ts b/laboratory/playwright.config.ts index 0eb424c53b..41cbeaa13f 100644 --- a/laboratory/playwright.config.ts +++ b/laboratory/playwright.config.ts @@ -37,12 +37,8 @@ export default defineConfig({ { name: 'firefox', use: { ...devices['Desktop Firefox'] } - }, - - { - name: 'webkit', - use: { ...devices['Desktop Safari'] } } + /* Test against mobile viewports. */ /* * { diff --git a/laboratory/tests/shared/validators/ModalValidator.ts b/laboratory/tests/shared/validators/ModalValidator.ts index e8f122fe69..75004573fe 100644 --- a/laboratory/tests/shared/validators/ModalValidator.ts +++ b/laboratory/tests/shared/validators/ModalValidator.ts @@ -22,22 +22,30 @@ export class ModalValidator { } async expectAcceptedSign() { - await expect(this.page.getByText('Sign Message')).toBeVisible() - await expect(this.page.getByText('0x')).toBeVisible() + await expect(this.page.getByTestId('notification-header')).toBeVisible() + await expect(this.page.getByTestId('notification-header')).toHaveText('Sign Message') + await expect(this.page.getByTestId('notification-body')).toBeVisible() + await expect(this.page.getByTestId('notification-body')).toHaveText(/0x/u) } async expectRejectedSign() { - await expect(this.page.getByText('Sign Message')).toBeVisible() - await expect(this.page.getByText(/User rejected/u)).toBeVisible() + await expect(this.page.getByTestId('notification-header')).toBeVisible() + await expect(this.page.getByTestId('notification-header')).toHaveText('Sign Message') + await expect(this.page.getByTestId('notification-body')).toBeVisible() + await expect(this.page.getByTestId('notification-body')).toHaveText(/User rejected/u) } async expectAcceptedSignTyped() { - await expect(this.page.getByText('Sign Typed Data')).toBeVisible() - await expect(this.page.getByText('0x')).toBeVisible() + await expect(this.page.getByTestId('notification-header')).toBeVisible() + await expect(this.page.getByTestId('notification-header')).toHaveText('Sign Typed Data') + await expect(this.page.getByTestId('notification-body')).toBeVisible() + await expect(this.page.getByTestId('notification-body')).toHaveText(/0x/u) } async expectRejectedSignTyped() { - await expect(this.page.getByText('Sign Typed Data')).toBeVisible() - await expect(this.page.getByText(/User rejected/u)).toBeVisible() + await expect(this.page.getByTestId('notification-header')).toBeVisible() + await expect(this.page.getByTestId('notification-header')).toHaveText('Sign Typed Data') + await expect(this.page.getByTestId('notification-body')).toBeVisible() + await expect(this.page.getByTestId('notification-body')).toHaveText(/User rejected/u) } } diff --git a/laboratory/tests/w3m-wallet.spec.ts b/laboratory/tests/w3m-wallet.spec.ts index 6d836c4df2..8418da2526 100644 --- a/laboratory/tests/w3m-wallet.spec.ts +++ b/laboratory/tests/w3m-wallet.spec.ts @@ -2,14 +2,21 @@ import { DEFAULT_SESSION_PARAMS } from './shared/constants' import { testMW, expect } from './shared/fixtures/w3m-wallet-fixture' testMW.describe('W3M using wallet web-example', () => { - testMW.beforeEach(async ({ modalPage, walletPage, modalValidator, walletValidator }) => { - await modalPage.getUri() - await walletPage.connect() - - await walletPage.handleSessionProposal(DEFAULT_SESSION_PARAMS) - await modalValidator.expectConnected() - await walletValidator.expectConnected() - }) + testMW.beforeEach( + async ({ modalPage, walletPage, modalValidator, walletValidator, browserName }) => { + testMW.skip( + browserName === 'webkit' && process.platform === 'linux', + 'Webkit on Linux does not support clipboard' + ) + + await modalPage.getUri() + await walletPage.connect() + + await walletPage.handleSessionProposal(DEFAULT_SESSION_PARAMS) + await modalValidator.expectConnected() + await walletValidator.expectConnected() + } + ) testMW('Should be able to connect', ({ modalPage, walletPage }) => { expect(modalPage).toBeDefined() @@ -77,7 +84,7 @@ testMW.describe('W3M using wallet web-example', () => { await walletValidator.expectRecievedSignTyped({}) await walletPage.handleRequest({ accept: false }) - await modalValidator.expectAcceptedSignTyped() + await modalValidator.expectRejectedSignTyped() } )