From d36283e8c9f9d31635a07afdead5a04a294e32d8 Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Mon, 17 Mar 2025 14:30:13 -0700 Subject: [PATCH] chore(snapshots): use default value for cmd line argument (#30263) Issue number: N/A --------- ## What is the current behavior? Certain custom commands related to Playwright are failing. Specifically: - `npm run test.e2e.update-snapshots ${component}` - `npm run test.e2e.docker.update-snapshots ${component}` The failures are due to Playwright [v1.50 changing](https://playwright.dev/docs/release-notes#breaking) it's accepted values for `update-snapshots`. Possible values are "all", "changed", "missing", and "none". By default, it's "all". All snapshots will be updated when no value is passed or a wrong value is passed. Our scripts end up running (doesn't matter if it's local or through the docker): - `npx playwright test --update-snapshots ${component}` It used to only update the snapshots that have changed. However, with the update, the argument thinks that the component is its value but since it's not an accepted one, it leads to the default. ## What is the new behavior? Set our default value when it comes to updating snapshots. By using `changed` then we would only update snapshots for those tests that have a difference. This aligns with how it used to work before the update. ## Does this introduce a breaking change? - [ ] Yes - [x] No ## Other information N/A --- .github/workflows/actions/test-core-screenshot/action.yml | 2 +- core/package.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/actions/test-core-screenshot/action.yml b/.github/workflows/actions/test-core-screenshot/action.yml index b3f17f1b0c..2afdf38d8d 100644 --- a/.github/workflows/actions/test-core-screenshot/action.yml +++ b/.github/workflows/actions/test-core-screenshot/action.yml @@ -49,7 +49,7 @@ runs: # which is why we not using the upload-archive # composite step here. run: | - npm run test.e2e.docker.ci ${{ inputs.component }} -- --shard=${{ inputs.shard }}/${{ inputs.totalShards }} --update-snapshots + npm run test.e2e.docker.ci ${{ inputs.component }} -- --shard=${{ inputs.shard }}/${{ inputs.totalShards }} --update-snapshots='changed' git add src/\*.png --force mkdir updated-screenshots cd ../ && rsync -R --progress $(git diff --name-only --cached) core/updated-screenshots diff --git a/core/package.json b/core/package.json index ea13530c77..4d09cd1d05 100644 --- a/core/package.json +++ b/core/package.json @@ -93,13 +93,13 @@ "test": "npm run test.spec && npm run test.e2e", "test.spec": "stencil test --spec --max-workers=2", "test.e2e": "npx playwright test", - "test.e2e.update-snapshots": "npm run test.e2e -- --update-snapshots", + "test.e2e.update-snapshots": "npm run test.e2e -- --update-snapshots='changed'", "test.watch": "jest --watch --no-cache", "test.treeshake": "node scripts/treeshaking.js dist/index.js", "validate": "npm run lint && npm run test && npm run build && npm run test.treeshake", "docker.build": "docker build -t ionic-playwright .", "test.e2e.docker": "npm run docker.build && node ./scripts/docker.mjs", - "test.e2e.docker.update-snapshots": "npm run test.e2e.docker -- --update-snapshots", + "test.e2e.docker.update-snapshots": "npm run test.e2e.docker -- --update-snapshots='changed'", "test.e2e.docker.ci": "npm run docker.build && CI=true node ./scripts/docker.mjs", "test.e2e.script": "node scripts/testing/e2e-script.mjs" },