Menu Diff & Visual Regression
Fileroutes.jsonFilecrawl.jsonTwo ways to see what a change did to a plugin's menus. A menu diff compares two crawls as data: titles, items, names, lore, styles and where each click leads. Visual regression renders every crawled screen to PNG and compares it pixel by pixel with a baseline. Both start from a crawl.
Menu diff
Take a snapshot, change the plugin, take another, compare:
curl "localhost:8767/diff/snapshot?name=before&bot=CrawlBot&root=/zadmin%20gui%20creator-main&depth=1"
# change the plugin's config, then /zadmin reload
curl "localhost:8767/diff/snapshot?name=after&bot=CrawlBot&root=/zadmin%20gui%20creator-main&depth=1"
curl "localhost:8767/diff/compare?a=before&b=after&format=text"Menus before -> after: 2 changes (15 -> 15 menus)
~ menu arena-creator-gui-test-crawlbot [/zadmin gui creator-main]
slot 12 name: "✔ Max Players 4" -> "✔ Player Limit 4"
~ menu gateways [/zadmin gui creator-main > #28]
title: "ɢᴀᴛᴇꜱ" -> "ɢᴀᴛᴇᴡᴀʏꜱ"- Menus are matched by the route that reaches them, so a renamed menu shows as a title change and not as one removed and one added.
- Per slot it compares material, count, name, lore, their styles, glint, head and where the click leads.
- Snapshots are JSON files in
snapshotsin the data dir. format=textis the listing above,format=htmlgives a page for a browser,format=jsonthe list of changes.
The Crawl page has the same: a snapshot name field, Save snapshot and Compare snapshots.
| Endpoint | Parameters | Returns |
|---|---|---|
/diff/snapshot | name, then job or the /crawl parameters | crawls (or takes a finished crawl) and saves it under the name |
/diff/list | saved snapshots | |
/diff/compare | a, b, format=json|text|html | what changed from a to b |
Visual regression
Every crawled menu, page and dialog is rendered to PNG by the GUI Studio render API (POST /api/gui/render on the website) and compared pixel by pixel with a baseline folder.
Write the baseline
Crawl with
--update-baseline. The renders become the baseline.Change the plugin
Make the change and reload the plugin.
Check against it
Crawl again with
--visual-baselinepointing at the same folder. Every screen that moved fails, with before, after and diff images.--visual-reportonly sets where those images go.
java -jar IgniteTestTool.jar --crawl "root=/zadmin gui creator-main|/zadmin gui enemy-creator-main&depth=2" --crawl-bot CrawlBot --visual-baseline tests/visual --update-baseline
# change the plugin, reload it
java -jar IgniteTestTool.jar --crawl "root=/zadmin gui creator-main|/zadmin gui enemy-creator-main&depth=2" --crawl-bot CrawlBot --visual-baseline tests/visual --visual-report build/visual FAIL screen player-limit: 1.166 % of pixels changed, renamed from max-players, see diff/player-limit.png
FAIL screen pick-a-weapon: 0.065 % of pixels changed, see diff/pick-a-weapon.pngBaselines
Fileroutes.jsonBaselines are <screen id>.png plus routes.json, which maps each screen to the route that reaches it. A renamed menu is found by its route and compared with its old image.
--update-baseline writes the renders as the new baseline instead of failing, and removes stale images.
When a screen fails
- More than
--visual-tolerancepercent of its pixels changed. The default is0, since the renders are exact. - A pixel counts when a channel moved by more than 24.
- New screens fail, and so do baseline images no crawl reached.
The report
Config keyindex.htmlFilecrawl.jsonThe report folder has before, after and diff images and an index.html with them side by side, changed screens first. A diff image is the new render in grey with the changed pixels in red. crawl.json next to them is the crawl that was rendered.
What the render sees
- Session ids in titles are masked before rendering, so they never count as a change.
- Gradient titles that come back as one run per letter are turned back into a
<gradient>, so the text stays short. - The render shows icons, counts, glint and the title. Names and lore only show in tooltips, so a renamed item is not a visual change. The menu diff above covers text.
Flags
| Flag | Meaning |
|---|---|
--visual-baseline <dir> | render the crawled screens and fail on changes against the PNGs there |
--update-baseline | write the renders as the new baseline |
--render-url <url> | GUI Studio render API, default https://ignitedstudios.dev |
--visual-report <dir> | where the images and index.html go, default visual-report |
--visual-tolerance <percent> | changed pixels a screen may have, default 0 |
In CI mode the visual check is one more test suite with a test case per screen.
Over HTTP
curl "localhost:8767/visual/check?job=crawl-1&baseline=D:/tests/visual"| Endpoint | Parameters | Returns |
|---|---|---|
/visual/check | job or snapshot, baseline (folder), update=1, renderUrl, report (folder), tolerance=0 (percent), threshold=24, scale=2 | the visual report |