From 93ea8abd91ae7f87d27a443392d0b7cda52c232b Mon Sep 17 00:00:00 2001 From: Debbie O'Brien Date: Wed, 29 Jan 2025 20:49:50 +0100 Subject: [PATCH] docs: update snapshot path template description and configuration example for toMatchAriaSnapshot --- docs/src/aria-snapshots.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/src/aria-snapshots.md b/docs/src/aria-snapshots.md index adb1d5f75e..51e683daf1 100644 --- a/docs/src/aria-snapshots.md +++ b/docs/src/aria-snapshots.md @@ -344,12 +344,16 @@ To store your snapshots in a separate file, use the `toMatchAriaSnapshot` method await expect(page.getByRole('main')).toMatchAriaSnapshot({ name: 'main-snapshot.yml' }); ``` -By default, snapshots are saved in a directory next to your test file and a `.yml` file is created for each project specified in your Playwright configuration file. You can customize the snapshot path template using the `snapshotPathTemplate` option in the test runner configuration: +By default, snapshots are saved with the following pattern `{snapshotDir}/{testFileDir}/{testFileName}-snapshots/{arg}{ext}`. As snapshots should be the same across browsers, only one snapshot is saved even if testing with multiple browsers. Should you wish, you can customize the snapshot path template using the following configuration: ```js -export default defineConfig({ - snapshotPathTemplate: '__snapshots__/{testFilePath}/{arg}{ext}', -}); +export default { + expect: { + toMatchAriaSnapshot: { + pathTemplate: '__snapshots__/{testFilePath}/{arg}{ext}', + }, + }, +}; ``` ### 3. Using the `Locator.ariaSnapshot` method