docs(test-sharding): fix GitHub workflow snippets (#26465)

This commit is contained in:
Max Schmitt 2023-08-14 16:09:21 +02:00 committed by GitHub
parent 5d875141c1
commit 373a149a23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -48,15 +48,16 @@ This will produce a standard HTML report into `playwright-report` directory.
One of the easiest ways to shard Playwright tests across multiple machines is by using GitHub Actions matrix strategy. For example, you can configure a job to run your tests on four machines in parallel like this: One of the easiest ways to shard Playwright tests across multiple machines is by using GitHub Actions matrix strategy. For example, you can configure a job to run your tests on four machines in parallel like this:
```yaml title=".github/workflows/playwright.yml" ```yaml title=".github/workflows/playwright.yml"
name: "Playwright Tests" name: Playwright Tests
on: on:
push: push:
branches: branches: [ main, master ]
- main pull_request:
branches: [ main, master ]
jobs: jobs:
playwright-tests: test:
timeout-minutes: 60
runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -65,10 +66,12 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
- name: Install Playwright browsers - name: Install Playwright browsers
run: npx playwright install run: npx playwright install --with-deps
- name: Run Playwright tests - name: Run Playwright tests
run: npx playwright test --shard ${{ matrix.shard }} run: npx playwright test --shard ${{ matrix.shard }}
@ -96,6 +99,8 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci