From 4617bc4baf6c33d460a972f41c687f19a0b64feb Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Mon, 19 Jul 2021 12:25:27 +0200 Subject: [PATCH] docs(test-runner): add example with Docker to generate snapshots (#7712) --- docs/src/test-snapshots.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/src/test-snapshots.md b/docs/src/test-snapshots.md index c7570d0aae..ea804e2daf 100644 --- a/docs/src/test-snapshots.md +++ b/docs/src/test-snapshots.md @@ -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