Page MenuHomePhabricator

[MEX][SPIKE] Investigate using 'pixel' for visual regression testing
Closed, ResolvedPublic

Description

We recently had the case in MEX that a small CSS change caused a substantial regression for RTL users: T428246 T427661 T427655 T427658 . This slipped by in part because none of our existing tests are watching for visual / layout regressions.

The foundation's pixel(2) tool is used by other teams to run automated tests for visual regressions. The tool seems to be in somewhat active use - you can see recent test runs on the pixel server, but it seems that for some projects the snapshots are out of date and substantial failures have not been resolved.

There are clear and plausible instructions for adding a new project in the docs / source. From a quick inspection, it seems to be possible to define which extensions should be available, to provide a database snapshot, and to define what views / actions should be tested.

Investigate adding wikidata as a project for pixel, with some basic tests of wbui2025 in rtl and lrt configurations.

Acceptance Criteria

  • Wikidata is added as a project to Pixel(2), or the steps to do so are sketched
    • If this cannot be achieved in the time, blockers, next steps and a time estimate for completing the work are added to this ticket, or a recommendation to abandon this approach is made

Details

Other Assignee
HasanAkgun_WMDE
Related Changes in GitLab:
TitleReferenceAuthorSource BranchDest Branch
Add Wikibase wbui2025repos/test-platform/pixel!26haakT428862main
Customize query in GitLab

Event Timeline

Task Time: does it capture only the default screen or also the edit screens?

Initial Timebox: 16h

It should capture whatever screens we set it up to capture - as far as I can see you can write Javascript fixtures to drive the user-agent.

HasanAkgun_WMDE subscribed.

I've followed the instructions from the README file to register wikibase wbui2025 to pixel.

  • Created a MySQL backup file including:
    • Item:Q1 and Property:P1
    • English and Arabic labels
    • A long statement value
    • A qualifier and reference
  • Added four scenarios:
    • English LTR item view
    • Arabic RTL item view
    • English LTR statement-edit modal
    • Arabic RTL statement-edit modal

It should capture whatever screens we set it up to capture - as far as I can see you can write Javascript fixtures to drive the user-agent.

This is also true, backstopJs can run js/puppeteer instructions before capture. I did it via wbui2025 implementation.
Scenarios and hashtags are defined in config/wbui2025/backstop.js; the browser-driving steps are in runners/backstop/src/engine-scripts/wbui2025.js and are triggered inside onReady.js.

Since I couldn't directly create a branch and push to the original repo, I've forked it and pushed there, here is the branch:

https://gitlab.wikimedia.org/haak/pixel/-/commits/T428862

Merged!

It'll show up on https://pixel.wmcloud.org after the next full run cycle, so roughly 3-4 hours from now.

One non-blocking follow-up noted on the MR: the item-view scenarios capture at viewport height, so the screenshot stops above the statement UI. https://gitlab.wikimedia.org/repos/test-platform/pixel/-/merge_requests/26#note_242253

@Mhurd amazing - thanks so much! We'll follow up with those request changes, and probably some more tests.

Moving this task to Tech Verification, since Pixel for wbui2025 is now running and subtasks have been filed.