Products › lamco-dsi-tools › Docs › How to test screen capture and input on Wayland in CI

How to test screen capture and input on Wayland in CI

Two desktops, or one desktop before and after an upgrade, compared, with the build failed on a regression.

You want an automated check that fails when a desktop regresses: One desktop before and after an upgrade, or two desktops that should behave alike. With lamco-dsi-tools (DSI: Desktop session interfaces) you'll take a capture of each, compare them with dsitell compare, and let its exit code and JUnit report fail the build. dsitell reads files and connects to nothing, so the comparison can run on any machine, including a CI runner with no desktop.

1. Take the captures

On the desktop, before the upgrade and after it:

dsisee observe --out before.json
# upgrade the compositor, the portal or PipeWire, and log in again
dsisee observe --out after.json

dsisee observe exits 0 once it has written the capture, whatever is in it, so taking the capture never fails the job by itself. Take both captures the same way: The same command, the same flags, from inside the graphical session. Add --wake-portal to both if the portal may not be running, or a portal that hadn't been started will be not examined on one side and counted under coverage.

For two desktops, take one capture on each (for example sway.json and gnome.json) and compare those.

2. Compare, and fail on a regression

dsitell compare before.json after.json --fail-on health,findings --junit compare.xml

The first capture is the baseline and the second the candidate. Without --fail-on the command exits 0 whatever differs. With it, the exit code is 1 when a class it names has a regression, and the CI step fails. The classes:

ClassCounts when
findingsThe candidate raises a finding of severity notice or problem that the baseline doesn't
healthA function or a route is in a worse state, in the order working, present, absent, broken
coverageSomething the baseline examined isn't examined in the candidate, or a dissector that ran in the baseline didn't
interfacesA Wayland global or a portal interface is gone from the candidate, or advertised at a lower version
timingA median that rests on --timing-min-count values or more in both (default 5) is longer by more than --timing-threshold percent (default 25)

--fail-on all names every class. The timing class is a policy, and the report prints its two numbers. To tighten it:

dsitell compare before.json after.json --fail-on timing --timing-threshold 10 --timing-min-count 20

A timing figure is a length measured inside one capture. Figures from two machines or two boots are set side by side, and the report says which they come from. A figure that's on different clocks in the two, or is time a person took to answer a dialog, isn't compared.

3. Check each capture by itself

A comparison says what changed. To also fail when a function a machine is meant to have isn't there:

dsitell health --fail-on-absent --junit health.xml after.json || exit 1

health exits 1 when an examined function is broken, or absent with --fail-on-absent. A function that wasn't examined never fails the command, and in the JUnit report it's a skipped case, never a pass.

4. What to look at

  • The JUnit file of compare has one test case per class: Failed when it was named and has a regression, passed when it was named and has none, and skipped when it wasn't named or had nothing to compare. A skipped class is never reported as a pass.
  • The text report lists what differs and counts what's the same. --json has every row, and failing is true exactly when the exit code is 1.
  • Read the regressions list before acting on it. A difference isn't a verdict, and a coverage regression often means the two captures weren't taken the same way.
  • For more than two desktops, dsitell matrix sway.json gnome.json kde.json --markdown sets them side by side as Markdown, one column each. It has no failing verdict.

Related