Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: run tests in parallel #1682

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/ui_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ lerna-debug.log
.turbo
playwright-report/
screenshots/
test-results/
8 changes: 4 additions & 4 deletions apps/laboratory/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ export default defineConfig<ModalFixture>({
testDir: './tests',

fullyParallel: true,
retries: process.env['CI'] ? 2 : 0,
workers: process.env['CI'] ? 1 : undefined,
retries: 0,
workers: 2,
Comment on lines +12 to +13
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you remove the env flags on purpose?

reporter: [['list'], ['html']],

expect: {
timeout: (process.env['CI'] ? 60 : 15) * 1000
timeout: 30 * 1000
},
timeout: 60 * 1000,

Expand All @@ -25,7 +25,7 @@ export default defineConfig<ModalFixture>({
/* 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 */
Expand Down
18 changes: 15 additions & 3 deletions apps/laboratory/tests/shared/pages/ModalPage.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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() {
Expand Down
5 changes: 5 additions & 0 deletions apps/laboratory/tests/shared/pages/WalletPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down
12 changes: 8 additions & 4 deletions apps/laboratory/tests/shared/validators/WalletValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' }) {
Expand Down
Loading