New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(visual-regression): add script to update ground truths #29204
base: main
Are you sure you want to change the base?
Conversation
…ual-regression-script
…ual-regression-script
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Also adding Liam and Brandy as reviewers since they've worked on the visual regression changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am running into the following error when running this branch locally:
$ npm run test.e2e.script
> @ionic/[email protected] test.e2e.script
> sh src/utils/test/playwright/e2e-script.sh
Do you want to update your local ground truths? (y/n)
y
Enter the base branch name (default: main):
Updating the base branch...
From https://github.com/ionic-team/ionic-framework
* branch main -> FETCH_HEAD
Successfully rebased and updated refs/heads/visual-regression-script.
Building core...
....
Enter the component or path you want to test (e.g. chip, src/components/chip). Or leave empty to test all components:
chip
Updating local ground truths...
fatal: invalid reference: origin/
Running e2e tests...
…ual-regression-script
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
…ual-regression-script
@brandyscarney ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking really good! I added a few comments. I am not sure if they should block this being merged. Let me know your thoughts!
|
||
// Ask user if they want to open the Playwright report. | ||
const shouldOpenReport = await confirm({ | ||
message: 'Do you want to open the Playwright report?', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// User chose to open the Playwright report. | ||
if (shouldOpenReport) { | ||
await execAsync('npx playwright show-report').catch(() => { | ||
console.error('Error: Failed to open the Playwright report or user closed the report'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error doesn't seem to print when I close the report
else { | ||
// Update the local ground truths for all components. | ||
await execAsync(`git checkout origin/${baseBranch} -- src/components/*/test/*/*.e2e.ts-snapshots/*-linux.png`).catch((error) => { | ||
updateGroundTruth.stop('Failed to update local ground truths'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
// User chose to open the Playwright report. | ||
if (shouldOpenReport) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we print the npx playwright show-report
command if they say "No" in case they want to view it later?
Issue number: N/A
What is the current behavior?
Devs would have to manually generate the ground truths from their desired base branch. This causes a dev to checkout the base branch and pull the latest screenshots. They would then return to their working branch and start the E2E tests.
What is the new behavior?
A script has been created to automate this process using Docker as mentioned in the design doc:
Does this introduce a breaking change?
Other information
How to test:
npm run test.e2e.script