Skip to content

Commit 70e9177

Browse files
authored
chore: add script for updating local snapshots (#28254)
Issue number: N/A --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> Team members often need to update the ground truth screenshots when validating visual regressions or working on a design change. The command may be unfamiliar to them or they may be new to the project/playwright. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Adds a new script to the `core` package for updating the local (to the file system) ground truth screenshots. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->
1 parent 51b7ceb commit 70e9177

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

core/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
"test.spec": "stencil test --spec --max-workers=2",
9696
"test.spec.debug": "npx --node-arg=\"--inspect-brk\" stencil test --spec",
9797
"test.e2e": "npx playwright test",
98+
"test.e2e.update-snapshots": "npm run test.e2e -- --update-snapshots",
9899
"test.watch": "jest --watch --no-cache",
99100
"test.treeshake": "node scripts/treeshaking.js dist/index.js",
100101
"validate": "npm run lint && npm run test && npm run build && npm run test.treeshake"

core/src/utils/test/playwright/docs/usage-instructions.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,13 @@ The examples provided in the [Running Tests](#running-tests) section also apply
5959
Note that since you are generating the reference branch ground truth screenshots, you must be on the reference branch locally. Don't forget to pull the latest reference branch changes and then re-build using `npm run build`.
6060

6161
```shell
62-
npm run test.e2e -- --update-snapshots
62+
npm run test.e2e.update-snapshots
63+
```
64+
65+
Optionally, you can pass a directory to only update the ground truths for that directory & subdirectories. This is useful when working on a specific component.
66+
67+
```shell
68+
npm run test.e2e.update-snapshots src/components/alert/
6369
```
6470

6571
From here, you can switch back to your branch and run the tests.

0 commit comments

Comments
 (0)