Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions Acceptance-Tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,63 @@ 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
When 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.
These screenshots should be obtained from the CI (not local) run, so that the environment matches future runs. To do this, you can commit a random image in the prod screenshot folder and follow these steps:
1. Go to the failing run and open the 'Uploading diff screenshots as an artifact' section:
<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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Highlight that URL in the image.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

<img width="1221" height="301" alt="479966282-c2caa55f-b4f9-40cc-a47a-7ddc2de9a479" src="https://github.com/user-attachments/assets/facc7fc7-39a5-485c-86f4-37ab1e76bffd" />

3. Extract the contents of the artifact. There will be a folder with an image. The image will 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:
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Member Author

Choose a reason for hiding this comment

The 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".

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 and go to oppia/core/tests/puppeteer-acceptance-tests/specs

12. The spec will be mentioned in the artifact folder you downloaded in Step 2:

<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" />

(The spec is curriculum-admin in this case)

13. Navigate to the test spec folder based on the above step.

14. 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" />

15. Go to the prod-desktop-screenshots or prod-mobile-screenshots folder depending on your failure.

16. Check the name of the image from the artifact. It will be {screenshot_name}-diff.png

17. Replace the screenshot having the name {screenshot_name}-snap.png with the split image we saved in step 10. (Make sure to rename the pasted screenshot to {screenshot_name}-snap.png)

18. Check that the correct image got replaced.

19. Commit and push your changes! Self review your PR to verify that the correct image(s) were 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.
Expand Down