Skip to content
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

Add ability to filter scenarios and watch Backstop runs as they execute #354

Merged
merged 12 commits into from
Jul 11, 2024

Conversation

montehurd
Copy link
Collaborator

@montehurd montehurd commented Jul 4, 2024

Adds two new debugging env vars, WATCH_MODE and SCENARIO_FILTER

Usage

Watch mode:

Lets you watch BackstopJS as it loads pages in Chrome while it takes its screenshots

WATCH_MODE=1 ./pixel reference

Scenario filter:

Lets you easily/codelessly zero in on specific scenario(s)

SCENARIO_FILTER="Sticky header with unpinned TOC" ./pixel.js reference

Notes

Both of these should work with any Pixel command kicking off Backstop run(s)

The novnc container only ever starts if the WATCH_MODE flag is used, so this shouldn't affect anything on the server

Usage:

WATCH_MODE=1 ./pixel reference|test
@montehurd montehurd changed the title Env var to watch backstop runs (WIP) Env var to watch backstop runs as they execute (WIP) Jul 4, 2024
@montehurd montehurd changed the title Env var to watch backstop runs as they execute (WIP) Env var to watch Backstop runs as they execute (WIP) Jul 4, 2024
@montehurd montehurd changed the title Env var to watch Backstop runs as they execute (WIP) Add ability to watch Backstop runs as they execute (WIP) Jul 5, 2024
@@ -73,6 +86,8 @@ services:
working_dir: /pixel
env_file:
- .env
environment:
- DISPLAY=novnc:0
Copy link
Collaborator Author

@montehurd montehurd Jul 5, 2024

Choose a reason for hiding this comment

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

As a reminder, this line makes the magic happen

It causes the visual-regression container to use the novnc container as its display

The Backstop process (including Chrome) still runs in the visual-regression container, but the display window for Chrome appears on the novnc desktop

We then can see the novnc container's desktop because the novnc program lets make a vnc connection from a any modern browser, in this case most frequently from the host

The novnc container's desktop is using xfce4 atop an xvfb virtual frame buffer

websockify lets the host connect to the novnc container's novnc

Copy link
Collaborator Author

@montehurd montehurd Jul 8, 2024

Choose a reason for hiding this comment

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

Here's a subtle point I needed clarifying on even after getting this all working:

( for context, when I say "this all works" below, I had given Claude this PR's branch as a diff )

346711337-be0f9689-a42e-4e3c-8f13-66d5d27d36eb

@montehurd montehurd changed the title Add ability to watch Backstop runs as they execute (WIP) Add ability to filter scenarios and watch Backstop runs as they execute Jul 8, 2024
README.md Outdated

To quickly restrict which scenario runs without modifying any code, you can use the `FILTER` env var:

`FILTER="Sticky header with unpinned TOC" ./pixel.js reference`
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Considering changing FILTER to SCENARIO_FILTER to be explicit...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@bernardwang bernardwang self-requested a review July 11, 2024 20:30
Copy link
Collaborator

@bernardwang bernardwang left a comment

Choose a reason for hiding this comment

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

+1 Works locally for me, but looks like tests need to be fixed

@montehurd
Copy link
Collaborator Author

@bernardwang Thanks! I think I know what's happening with the tests! The https://github.com/wikimedia/pixel/blob/main/.github/workflows/push.yml action is failing even if any of the screenshot comparisons fail, which we obviously don't want. Can fix in a follow-up since it's not specific to this PR's changes

@montehurd montehurd merged commit 87283e0 into wikimedia:main Jul 11, 2024
1 check failed
@montehurd montehurd deleted the watch-tests-execute-alpine-xfce4 branch July 11, 2024 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants