Skip to content

OEL-4248: VRT Backstop - #535

Open
AaronGilMartinez wants to merge 15 commits into
1.xfrom
OEL-4248-backstop
Open

OEL-4248: VRT Backstop#535
AaronGilMartinez wants to merge 15 commits into
1.xfrom
OEL-4248-backstop

Conversation

@AaronGilMartinez

Copy link
Copy Markdown
Contributor

Jira issue(s):

@AaronGilMartinez AaronGilMartinez changed the title Oel 4248 backstop OEL-4248: VRT Backstop Mar 17, 2026
Comment thread README.md
Comment thread README.md

### Prerequisites

- A running Drupal site reachable at `http://localhost:8080/build`. Override the target with the `VRT_BASE_URL` environment variable if needed.

@donquixote donquixote Apr 22, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's only start this conversation once we are happy with what we have.

Comment thread README.md
- `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.

@donquixote donquixote Apr 22, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

When reading this, I would like to immediately understand in which category each of these commands fall, and when to run each of them:

  1. I need to run this command as install / preparation before doing anything else.
  2. I want to verify that the current appearance matches the captured snapshots.
  3. 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:build before 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:reference to update the snapshots after I changed the patterns.
  • I can run vrt:test to see if snapshots match current appearance. As a side effect this creates some tmp files.
  • I can run vrt:approve after vrt:test. Together, these achieve the same effect as vrt:reference. It is just a shortcut to avoid repeating the expensive calculation.

Comment thread README.md

### 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`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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)

@donquixote

Copy link
Copy Markdown
Contributor

Rebased on 1.x.
Interestingly, github action only runs if there are no merge conflicts.
Gitlab tests run either way.

- name: Install dependencies
run: |
npm install
npx playwright install --with-deps

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We might want to split this step into two steps, simply to make it easier to see the output from each step in isolation.

Comment thread README.md
### 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`.

@donquixote donquixote Apr 22, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread README.md

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I tried this.
How would I look at the output from this test, if there are failures? Which file do I look at?

Comment thread README.md
- `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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we run these commands targeting a specific snapshot or pattern?

@AaronGilMartinez
AaronGilMartinez force-pushed the OEL-4248-backstop branch 2 times, most recently from bd9a536 to e296861 Compare June 3, 2026 07:58
Comment thread .gitattributes
*.jpg -text diff
*.otf -text diff
*.phar -text diff
*.png filter=lfs diff=lfs merge=lfs -text

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I played a bit with LFS myself.
This is great! Let's go with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants