···155155make test-e2e-sqlite#example
156156```
157157158158-### Visual testing
159159-160160-> **Warning**
161161-> This is not currently used by most Forgejo contributors.
162162-> Your help to improve the situation and allow for visual testing is appreciated.
163163-164164-Although the main goal of e2e is assertion testing, we have added a framework for visual regression testing. If you are working on front-end features, please use the following:
165165- - Check out `main`, `make clean frontend`, and run e2e tests with `VISUAL_TEST=1` to generate outputs. This will initially fail, as no screenshots exist. You can run the e2e tests again to assert that it passes.
166166- - Check out your branch, `make clean frontend`, and run e2e tests with `VISUAL_TEST=1`. You should be able to assert that your front-end changes don't break any other tests unintentionally.
167167-168168-`VISUAL_TEST=1` will create screenshots in tests/e2e/test-snapshots. The test will fail the first time this is enabled (until we get visual test image persistence figured out), because it will be testing against an empty screenshot folder.
169169-170170-`ACCEPT_VISUAL=1` will overwrite the snapshot images with new images.
171171-172158173159## Tips and tricks
174160···215201~~~js
216202await page.waitForURL('**/target.html');
217203~~~
204204+205205+### Visual testing
206206+207207+Due to size and frequent updates, we do not host screenshots in the Forgejo repository.
208208+However, it is good practice to ensure that your test is capable of generating relevant and stable screenshots.
209209+Forgejo is regularly tested against visual regressions in a dedicated repository which contains the screenshots:
210210+https://code.forgejo.org/forgejo/visual-browser-testing/
211211+212212+For tests that consume only the `page`,
213213+screenshots are automatically created at the end of each test.
214214+215215+If your test visits different relevant screens or pages during the test,
216216+or creates a custom `page` from context
217217+(e.g. for tests that require a signed-in user)
218218+calling `await save_visual(page);` explicitly in relevant positions is encouraged.
219219+220220+Please confirm locally that your screenshots are stable by performing several runs of your test.
221221+When screenshots are available and reproducible,
222222+check in your test without the screenshots.
223223+224224+When your screenshots differ between runs,
225225+for example because dynamic elements (e.g. timestamps, commit hashes etc)
226226+change between runs,
227227+mask these elements in the `save_visual` function in `utils_e2e.ts`.
228228+229229+#### Working with screenshots
230230+231231+The following environment variables control visual testing:
232232+233233+`VISUAL_TEST=1` will create screenshots in tests/e2e/test-snapshots.
234234+ The test will fail the first time,
235235+ because the screenshots are not included with Forgejo.
236236+ Subsequent runs will comopare against your local copy of the screenshots.
237237+238238+`ACCEPT_VISUAL=1` will overwrite the snapshot images with new images.
218239219240### Only sign in if necessary
220241