docs(test-runner): add example with Docker to generate snapshots (#7712)

This commit is contained in:
Max Schmitt 2021-07-19 12:25:27 +02:00 committed by GitHub
parent 2ff25522cc
commit 4617bc4baf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,6 +41,14 @@ drwxr-xr-x 3 user group 96 Jun 4 11:46 example.spec.ts-snapshots
Note the `chromium-darwin` in the generated snapshot file name - it contains the browser name and the platform. Screenshots differ between browsers and platforms due to different rendering, fonts and more, so you will need different snapshots for them. If you use multiple projects in your [configuration file](./test-configuration.md), project name will be used instead of `chromium`.
If you are not on the same operating system as your CI system, you can use Docker to generate/update the screenshots:
```bash
docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v1.12.3-focal /bin/bash
npm install
npx playwright test --update-snapshots
```
Sometimes you need to update the reference screenshot, for example when the page has changed. Do this with the `--update-snapshots` flag.
```bash