Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions nodejs/docs/test-snapshots.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ The snapshot name `example-test-1-chromium-darwin.png` consists of a few parts:

The snapshot name and path can be configured with [testConfig.snapshotPathTemplate](/api/class-testconfig.mdx#test-config-snapshot-path-template) 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.
Expand All @@ -61,9 +64,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
Expand Down
Loading