Skip to content

Commit

Permalink
Try running headful and headless
Browse files Browse the repository at this point in the history
  • Loading branch information
duckception committed Oct 6, 2023
1 parent 61b5c64 commit 31d565e
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 11 deletions.
59 changes: 55 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ jobs:
- name: Run tests
run: pnpm run test

test-e2e:
name: Run E2E tests
test-e2e-headless:
name: Run E2E tests (headless)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -55,17 +55,68 @@ jobs:
- name: Install browsers for Playwright
run: pnpm dlx playwright install chromium

- name: Install linux deps
run: |
sudo apt-get install --no-install-recommends -y \
fluxbox \
xvfb
- name: Build project
run: pnpm run build

- name: Run E2E tests (headless)
run: pnpm run test:e2e:headless
run: |
Xvfb :0 -screen 0 1024x768x24 -listen tcp -ac &
fluxbox &
pnpm run test:e2e:headless
env:
DISPLAY: :0.0

- name: Archive Playwright traces
uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: playwright-traces
name: playwright-traces-headless
path: |
wallets/metamask/test-results
if-no-files-found: error

test-e2e-headful:
name: Run E2E tests (headful)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
version: 8.7.6

- uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
registry-url: https://registry.npmjs.org
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

# For now, we only need Chromium.
- name: Install browsers for Playwright
run: pnpm dlx playwright install chromium

- name: Install linux deps
run: |
sudo apt-get install --no-install-recommends -y \
fluxbox \
xvfb
- name: Build project
run: pnpm run build

- name: Run E2E tests (headful)
run: |
Xvfb :0 -screen 0 1024x768x24 -listen tcp -ac &
fluxbox &
pnpm run test:e2e
env:
DISPLAY: :0.0
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"sort-package-json": "sort-package-json 'package.json' '{packages,wallets,examples}/*/package.json'",
"sort-package-json:check": "sort-package-json 'package.json' '{packages,wallets,examples}/*/package.json' --check",
"test": "turbo test",
"test:e2e": "turbo test:e2e",
"test:e2e:headless": "turbo test:e2e:headless"
},
"lint-staged": {
Expand Down
3 changes: 3 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"test": {
"dependsOn": ["build"]
},
"test:e2e": {
"dependsOn": ["build"]
},
"test:e2e:headless": {
"dependsOn": ["build"]
}
Expand Down
2 changes: 1 addition & 1 deletion wallets/metamask/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"clean": "rimraf dist types",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"test:e2e": "playwright test",
"test:e2e": "DEBUG=pw:browser playwright test",
"test:e2e:headless": "DEBUG=pw:browser HEADLESS=true playwright test",
"test:watch": "vitest watch",
"types:check": "tsc --noEmit"
Expand Down
7 changes: 1 addition & 6 deletions wallets/metamask/test/e2e/metamask.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,7 @@ const test = base.extend({

const context = await chromium.launchPersistentContext('', {
headless: false,
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.5938.62 Safari/537.36',
args: browserArgs,
viewport: {
width: 1920,
height: 1080
}
args: browserArgs
})

try {
Expand Down

0 comments on commit 31d565e

Please sign in to comment.