-
Notifications
You must be signed in to change notification settings - Fork 101
Document steps for updating prod screenshots in tests #469
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -247,6 +247,67 @@ On CI, we run all the acceptance tests in production mode, so the screenshots in | |
|
||
On the other hand, if the screenshot fails locally (in desktop environment), the screenshot `teachPage-diff.png` will be generated and stored inside a new folder `diff-snapshots` under `logged-out-user/dev-desktop-screenshots`. | ||
|
||
### Adding Prod screenshots for Acceptance Tests | ||
On making changes that affect a user journey tested through the acceptance tests or introduce a new feature, a contributor needs to update/add screenshots supporting their changes. | ||
It has been noted that screenshots obtained by running the Acceptance tests locally using the prod flag do not match those captured by the CI. To overcome this, you can commit any image in the prod screenshot folder and follow these steps: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Drop the first sentence, replace with: "These screenshots should be obtained from the CI (not local) run, so that the environment matches future runs." Update the second sentence to follow on from that. In the second sentence, what do you mean by "commit any image in the prod screenshot folder"? |
||
1. Go to the failing run and click on the 'uploading diff screenshots as an artifact' section: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Capitalize "uploading" "click on the" --> "open the" |
||
<img width="349" height="35" alt="image" src="https://github.com/user-attachments/assets/827d8557-3346-443a-aaf8-1fd0168a3f24" /> | ||
|
||
2. Then download the artifact from the artifact download url: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Highlight that URL in the image. |
||
<img width="1221" height="301" alt="image" src="https://github.com/user-attachments/assets/c2caa55f-b4f9-40cc-a47a-7ddc2de9a479" /> | ||
|
||
3. Extract the contents of the artifact. There will be a folder with an image. The image will be like this: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. be like this --> look like this |
||
<img width="2250" height="1334" alt="skillWithWorkedExamplePreview-diff" src="https://github.com/user-attachments/assets/fcb62376-8a05-4604-bf05-2f5543967f0d" /> | ||
|
||
The left side is the current reference image on the repo. The right side is the screenshot that was taken while running the test on the CI with your changes. The middle is the difference between the two. | ||
|
||
We want to update the current reference as it is incorrect. Generally we do not want to do this as we expect the reference screenshots to be correct. Only do this after asking a maintainer. | ||
|
||
4. Go to https://splitter.imageonline.co/ | ||
|
||
5. Upload the diff image from the artifact you extracted: | ||
<img width="699" height="705" alt="image" src="https://github.com/user-attachments/assets/dc83a1d4-c093-4d43-b28e-cffeb4a36faa" /> | ||
|
||
6. Choose Split into pieces: | ||
<img width="699" height="191" alt="image" src="https://github.com/user-attachments/assets/207fb140-740a-4cf1-bc12-8823a9b1e3b8" /> | ||
|
||
7. Set rows as 3 and columns as 1: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strange ... this is definitely correct, right? I would have thought the terminology would be splitting the image into 3 columns, so just checking. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, the site splits the images the way we want only when we change the rows value. I found it a bit weird as well. |
||
<img width="699" height="191" alt="image" src="https://github.com/user-attachments/assets/19ae5e5e-1a90-4b0d-bb88-59e75b3d53ce" /> | ||
|
||
8. Click on split image | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. split image --> "SPLIT IMAGE" (follow the screenshot) |
||
|
||
9. You will get 3 split images: | ||
<img width="710" height="410" alt="image" src="https://github.com/user-attachments/assets/b0821688-05db-4148-8768-17eca0d0cbc0" /> | ||
|
||
10. Right click on the rightmost one and use 'Save Image as...'. Choose any random name. | ||
|
||
11. Navigate to where you have saved the Oppia repo on your local machine. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Combine this with the next step. |
||
|
||
12. Go to oppia/core/tests/puppeteer-acceptance-tests/specs | ||
|
||
13. The spec will be mentioned in the artifact folder you downloaded: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In which step did I download this "artifact folder"? Maybe refer to it. |
||
|
||
<img width="368" height="64" alt="Screenshot from 2025-08-20 16-37-52" src="https://github.com/user-attachments/assets/d1a45271-c1f1-49d9-8874-f5ac95d37dce" /> | ||
|
||
(Its curriculum-admin in this case) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does "Its" refer to? Also note that "its" is the possessive, and "it's" means "it is". |
||
|
||
14. Navigate to the spec | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is unclear, please specify what you mean by "spec". How do they figure out which spec to navigate to? |
||
|
||
15. Check if the failure was for desktop or mobile based on the screenshot or the subfolder in the artifact: | ||
<img width="102" height="127" alt="image" src="https://github.com/user-attachments/assets/c1b902ee-5ccb-4218-a247-d4e19da9d3ed" /> | ||
|
||
16. Go to the prod-desktop-screenshots/prod-mobile-screenshots folder depending on your failure | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use "or" instead of "/" to avoid ambiguity, since a slash is a folder name separator too |
||
|
||
17. Paste the image we split. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refer to the step number where the splitting action was taken |
||
|
||
18. Check the name of the image from the artifact. It will be {screenshot_name}-diff.png | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you can combine steps 18-21 into something along the lines of "replace the old screenshot with the new one" |
||
|
||
19. Delete the screenshot with {screenshot_name}-snap.png from the folder you are currently in. | ||
|
||
20. Rename the pasted image to {screenshot_name}-snap.png | ||
|
||
21. Check that the correct image got replaced, commit and push your changes! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Commit and push your changes" should be a separate step Maybe at the end you can also ask them to do a self-review of the PR to verify that the correct images are used. |
||
|
||
## Acceptance Tests for Mobile | ||
|
||
Similar to desktop, we also have acceptance tests for mobile to ensure responsiveness and uninterrupted user journeys on small screen devices. While the tests themselves remain largely the same for both desktop and mobile, there are some differences. For instance, large full menus on desktop may be converted to dropdowns, hamburger menus, or other shortcuts on mobile, requiring additional actions to complete the tests. | ||
|
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.
On --> When