diff --git a/docs/src/ci.md b/docs/src/ci.md index 5590ad5dd5..edf60b89ac 100644 --- a/docs/src/ci.md +++ b/docs/src/ci.md @@ -130,6 +130,59 @@ Suggested configuration 1. Using `--init` Docker flag or [dumb-init](https://github.com/Yelp/dumb-init) is recommended to avoid special treatment for processes with PID=1. This is a common reason for zombie processes. +### GitHub Actions (via containers) + +GitHub Actions support [running jobs in a container](https://docs.github.com/en/actions/using-jobs/running-jobs-in-a-container) by using the [`jobs..container`](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idcontainer) option. + +```yml js +steps: + playwright: + name: 'Playwright Tests' + runs-on: ubuntu-latest + container: + image: mcr.microsoft.com/playwright:v1.24.0-focal + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '14' + - name: Install dependencies + run: npm ci + - name: Run your tests + run: npx playwright test +``` + +#### Sharding +* langs: js + +GitHub Actions supports [sharding tests between multiple jobs](https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs) using the [`jobs..strategy.matrix`](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix) option. The `matrix` option will run a seperate job for every possible combination of the provided options. In the example below, we have 2 `project` values, 10 `shardIndex` values and 1 `shardTotal` value, resulting in a total of 20 jobs to be run. + +```yml js +steps: + playwright: + name: 'Playwright Tests - ${{ matrix.project }} - Shard ${{ matrix.shardIndex }} of ${{ matrix.shardTotal }}' + runs-on: ubuntu-latest + container: + image: mcr.microsoft.com/playwright:v1.24.0-focal + strategy: + fail-fast: false + matrix: + project: [Chrome, Safari] + shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + shardTotal: [10] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '14' + - name: Install dependencies + run: npm ci + - name: Run your tests + run: npx playwright test --project=${{ matrix.project }} --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} +``` + +> Note: The `${{ }}` is the [expression](https://docs.github.com/en/actions/learn-github-actions/expressions) syntax that allows accessing the current [context](https://docs.github.com/en/actions/learn-github-actions/contexts). In this example, we are using the [`matrix`](https://docs.github.com/en/actions/learn-github-actions/contexts#matrix-context) context to set the job variants. + ### Azure Pipelines For Windows or macOS agents, no additional configuration required, just install Playwright and run your tests. diff --git a/docs/src/test-reporters-js.md b/docs/src/test-reporters-js.md index d81c013c6a..7a558d5fe2 100644 --- a/docs/src/test-reporters-js.md +++ b/docs/src/test-reporters-js.md @@ -302,6 +302,8 @@ Or if there is a custom folder name: npx playwright show-report my-report ``` +> The `html` reporter currently does not support merging reports generated across multiple [`--shards`](./test-parallel.md#shard-tests-between-multiple-machines) into a single report. See [this](https://github.com/microsoft/playwright/issues/10437) issue for available third party solutions. + ### JSON reporter