Skip to content

Commit

Permalink
fix: fixed minor bug, removed webkit, as it does not support clipboar…
Browse files Browse the repository at this point in the history
…d, will add this back later
  • Loading branch information
JonathanConn committed Aug 2, 2023
1 parent 4479ce9 commit b176180
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 31 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/playwright_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down
6 changes: 1 addition & 5 deletions laboratory/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,8 @@ export default defineConfig({
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] }
},

{
name: 'webkit',
use: { ...devices['Desktop Safari'] }
}

/* Test against mobile viewports. */
/*
* {
Expand Down
24 changes: 16 additions & 8 deletions laboratory/tests/shared/validators/ModalValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
25 changes: 16 additions & 9 deletions laboratory/tests/w3m-wallet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
}
)

Expand Down

0 comments on commit b176180

Please sign in to comment.