mirror of
https://github.com/zhigang1992/wallet.git
synced 2026-01-12 22:53:27 +08:00
81 lines
2.6 KiB
YAML
81 lines
2.6 KiB
YAML
name: Playwright Tests
|
|
|
|
env:
|
|
CI: true
|
|
WALLET_ENVIRONMENT: testing
|
|
|
|
on:
|
|
push:
|
|
branches: [dev]
|
|
pull_request:
|
|
branches: [dev]
|
|
|
|
jobs:
|
|
test:
|
|
name: Shard ${{ matrix.shardIndex }} of ${{ matrix.shardTotal }}
|
|
timeout-minutes: 30
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8]
|
|
shardTotal: [8]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: ./.github/actions/provision
|
|
|
|
- name: Get installed Playwright version
|
|
id: playwright-version
|
|
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package.json').devDependencies['@playwright/test'])")" >> $GITHUB_ENV
|
|
|
|
- uses: actions/cache@v3
|
|
id: cache
|
|
with:
|
|
path: '**/node_modules'
|
|
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/package.json') }}-${{ env.PLAYWRIGHT_VERSION }}-force
|
|
|
|
- name: Install dependencies
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
env:
|
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
|
run: yarn --frozen-lockfile
|
|
|
|
- name: Cache playwright binaries
|
|
uses: actions/cache@v3
|
|
id: playwright-cache
|
|
with:
|
|
path: ~/.cache/ms-playwright
|
|
key: ${{ runner.os }}-playwright-cache-${{ env.PLAYWRIGHT_VERSION }}
|
|
|
|
- name: Install Playwright browsers
|
|
run: yarn playwright install chrome chromium
|
|
if: steps.playwright-cache.outputs.cache-hit != 'true'
|
|
|
|
- name: Install Playwright deps
|
|
run: yarn playwright install --with-deps
|
|
if: steps.playwright-cache.outputs.cache-hit != 'true'
|
|
|
|
- name: Build extension in test mode
|
|
run: yarn build:test
|
|
|
|
# Playwright can only test extensions in headed mode, see
|
|
# https://playwright.dev/docs/chrome-extensions. To run a browser in
|
|
# headed mode, a display server is necessary. However, this job runs on
|
|
# an Ubuntu worker without a display server.
|
|
#
|
|
# The `xvfb-run` utility,
|
|
# https://manpages.ubuntu.com/manpages/xenial/man1/xvfb-run.1.html,
|
|
# provides a virtual X display server to the process it runs, allowing
|
|
# processes that require a display server to run in environments where
|
|
# one is not available.
|
|
- name: Run Playwright tests
|
|
run: xvfb-run yarn playwright test tests/specs --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --workers=1
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
if: always()
|
|
with:
|
|
name: playwright-report
|
|
path: playwright-report/
|
|
retention-days: 10
|