OEL-4248: VRT Backstop - #535
Conversation
deed894 to
09f114a
Compare
|
|
||
| ### Prerequisites | ||
|
|
||
| - A running Drupal site reachable at `http://localhost:8080/build`. Override the target with the `VRT_BASE_URL` environment variable if needed. |
There was a problem hiding this comment.
I think we should simply point to the regular install steps.
The tests should pass on a fresh install following the steps above (docker-compose up, composer install, drupal:site-install).
There is no need to customize in the default case.
If you want to document these env vars, you could make a separate section about customization.
There was a problem hiding this comment.
We might want to check with QA if we can run this in gitlab.
But I am more than happy to first have it here in github, where we can control it all with code.
There was a problem hiding this comment.
Let's only start this conversation once we are happy with what we have.
| - `docker compose exec web npm run vrt:build` – scrapes the UI Patterns catalog and generates `tests/vrt/scenarios/patterns.json` plus `tests/vrt/backstop.generated.json`. | ||
| - `docker compose exec web npm run vrt:reference` – captures fresh reference screenshots into `tests/vrt/bitmaps_reference`. | ||
| - `docker compose exec web npm run vrt:test` – compares the current UI against the references, writing results to `tests/vrt/bitmaps_test` and `tests/vrt/html_report`. | ||
| - `docker compose exec web npm run vrt:approve` – promotes the latest passing screenshots to the reference set. |
There was a problem hiding this comment.
When reading this, I would like to immediately understand in which category each of these commands fall, and when to run each of them:
- I need to run this command as install / preparation before doing anything else.
- I want to verify that the current appearance matches the captured snapshots.
- I want to update the snapshots to align with changes in twig or CSS.
So here is what I understand:
- I always need to run
vrt:buildbefore anything else, because the two json files are not tracked in git. I also need to run this any time after I created, deleted or renamed patterns. - I can run
vrt:referenceto update the snapshots after I changed the patterns. - I can run
vrt:testto see if snapshots match current appearance. As a side effect this creates some tmp files. - I can run
vrt:approveaftervrt:test. Together, these achieve the same effect asvrt:reference. It is just a shortcut to avoid repeating the expensive calculation.
|
|
||
| ### Available commands | ||
|
|
||
| - `docker compose exec web npm run vrt:build` – scrapes the UI Patterns catalog and generates `tests/vrt/scenarios/patterns.json` plus `tests/vrt/backstop.generated.json`. |
There was a problem hiding this comment.
When I run this, it tell me to run npx playwright install first.
I also see that the github action does this.
We could add this to the regular install commands, perhaps using runner.yml.dist.
| - name: Install dependencies | ||
| run: | | ||
| npm install | ||
| npx playwright install --with-deps |
There was a problem hiding this comment.
I notice that in README.md we run this npm stuff in web container, but here we run it in the root machine.
Nothing wrong, just an observation :)
(click "resolve" if this is as intended)
164f022 to
f2853bf
Compare
|
Rebased on 1.x. |
| - name: Install dependencies | ||
| run: | | ||
| npm install | ||
| npx playwright install --with-deps |
There was a problem hiding this comment.
We might want to split this step into two steps, simply to make it easier to see the output from each step in isolation.
| ### Available commands | ||
|
|
||
| - `docker compose exec web npm run vrt:build` – scrapes the UI Patterns catalog and generates `tests/vrt/scenarios/patterns.json` plus `tests/vrt/backstop.generated.json`. | ||
| - `docker compose exec web npm run vrt:reference` – captures fresh reference screenshots into `tests/vrt/bitmaps_reference`. |
There was a problem hiding this comment.
I get a huge diff when I run this. But the images look the same.
Also, when I run it repeatedly, the files remain the same.
So maybe we just need to update once to make this PR green.
|
|
||
| - `docker compose exec web npm run vrt:build` – scrapes the UI Patterns catalog and generates `tests/vrt/scenarios/patterns.json` plus `tests/vrt/backstop.generated.json`. | ||
| - `docker compose exec web npm run vrt:reference` – captures fresh reference screenshots into `tests/vrt/bitmaps_reference`. | ||
| - `docker compose exec web npm run vrt:test` – compares the current UI against the references, writing results to `tests/vrt/bitmaps_test` and `tests/vrt/html_report`. |
There was a problem hiding this comment.
I tried this.
How would I look at the output from this test, if there are failures? Which file do I look at?
| - `docker compose exec web npm run vrt:build` – scrapes the UI Patterns catalog and generates `tests/vrt/scenarios/patterns.json` plus `tests/vrt/backstop.generated.json`. | ||
| - `docker compose exec web npm run vrt:reference` – captures fresh reference screenshots into `tests/vrt/bitmaps_reference`. | ||
| - `docker compose exec web npm run vrt:test` – compares the current UI against the references, writing results to `tests/vrt/bitmaps_test` and `tests/vrt/html_report`. | ||
| - `docker compose exec web npm run vrt:approve` – promotes the latest passing screenshots to the reference set. |
There was a problem hiding this comment.
Can we run these commands targeting a specific snapshot or pattern?
bd9a536 to
e296861
Compare
e957323 to
8e5abfe
Compare
| *.jpg -text diff | ||
| *.otf -text diff | ||
| *.phar -text diff | ||
| *.png filter=lfs diff=lfs merge=lfs -text |
There was a problem hiding this comment.
I played a bit with LFS myself.
This is great! Let's go with it.
Jira issue(s):