From 56ccccddb8835b73305218867e43c7eb47b9c5fb Mon Sep 17 00:00:00 2001 From: Patrik Csak Date: Thu, 26 Jun 2025 09:31:31 -0700 Subject: [PATCH] docs: move note (#36432) --- docs/src/test-snapshots-js.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/src/test-snapshots-js.md b/docs/src/test-snapshots-js.md index 6a8d42e886..5c64eccfbb 100644 --- a/docs/src/test-snapshots-js.md +++ b/docs/src/test-snapshots-js.md @@ -50,6 +50,9 @@ The snapshot name `example-test-1-chromium-darwin.png` consists of a few parts: The snapshot name and path can be configured with [`property: TestConfig.snapshotPathTemplate`] in the playwright config. +> Note that `toHaveScreenshot()` also accepts an array of path segments to the snapshot file such as `expect().toHaveScreenshot(['relative', 'path', 'to', 'snapshot.png'])`. +> However, this path must stay within the snapshots directory for each test file (i.e. `a.spec.js-snapshots`), otherwise it will throw. + ## Updating screenshots Sometimes you need to update the reference screenshot, for example when the page has changed. Do this with the `--update-snapshots` flag. @@ -58,9 +61,6 @@ Sometimes you need to update the reference screenshot, for example when the page npx playwright test --update-snapshots ``` -> Note that `snapshotName` also accepts an array of path segments to the snapshot file such as `expect().toHaveScreenshot(['relative', 'path', 'to', 'snapshot.png'])`. -> However, this path must stay within the snapshots directory for each test file (i.e. `a.spec.js-snapshots`), otherwise it will throw. - ## Options ### maxDiffPixels