Skip to content

Add regtest GUI tests for liana-gui - #2144

Open
starius wants to merge 5 commits into
wizardsardine:masterfrom
starius:gui-tests
Open

Add regtest GUI tests for liana-gui#2144
starius wants to merge 5 commits into
wizardsardine:masterfrom
starius:gui-tests

Conversation

@starius

@starius starius commented May 17, 2026

Copy link
Copy Markdown

Summary

This PR adds the first native GUI end-to-end tests for liana-gui in
regtest mode.

  • add a gui-tests Nix dev shell with the X11, OCR, file picker, Bitcoin
    backend, and Python dependencies needed for GUI automation
  • add an Xvfb/openbox/xdotool/tesseract harness that launches liana-gui,
    captures logs/screenshots, clicks visible text, and leaves artifacts on
    failure
  • add GUI wallet fixtures that prepare a regtest wallet datadir and read
    embedded daemon state from sqlite
  • add smoke coverage for opening a wallet, visiting all top-level menus, and
    visiting Settings subpages
  • add Receive coverage for generating an address through the GUI and confirming
    a deposit to a GUI-generated address
  • add a CI job that builds liana-gui from the checked-out source and runs the
    GUI tests against that binary via LIANA_GUI_PATH

The tests perform user-facing actions through the native GUI. Setup and final
state assertions still reuse the existing regtest test framework where that is
more deterministic than OCR.

Testing

nix --extra-experimental-features "nix-command flakes" \
  develop .#default \
  -c cargo build -p liana-gui

nix --extra-experimental-features "nix-command flakes" \
  develop .#gui-tests \
  -c env LIANA_GUI_PATH="$PWD/target/debug/liana-gui" \
    pytest tests/gui -vv -s --tb=short

Result:

3 passed in 118.17s

starius added 5 commits May 17, 2026 01:06
Introduce a dedicated Nix development shell for GUI automation. The
shell provides regtest Bitcoin backends, X11 automation tools, file
picker support, graphical runtime libraries, and a pinned Python
environment matching the existing functional-test dependencies plus
screenshot/image tooling.

The GUI binary is selected by `LIANA_GUI_PATH` or `PATH`, so tests can
run against a freshly built checkout or an explicit alternate binary.
Add the reusable X11 automation layer for liana-gui tests. The harness
owns an Xvfb/openbox desktop, launches the GUI through a test wrapper
with deterministic runtime variables and tiny-skia software rendering,
captures logs and screenshots, and exposes OCR-backed text clicking plus
keyboard/mouse helpers for end-to-end user flows.

The driver tolerates sparse Tesseract TSV rows, prefers exact OCR-line
matches before substring matches, avoids synchronous mouse moves, and
treats window activation as best-effort because some window managers do
not advertise _NET_ACTIVE_WINDOW.
Add pytest fixtures and datadir builders for native liana-gui tests.
Shared regtest fixtures are re-exported, and pytest owns X11 sessions
and GUI processes. Generated wallet datadirs live directly under the
session temp root to keep embedded-daemon Unix socket paths short.

The wallet fixture writes GUI settings, embedded-daemon configuration,
and sqlite-backed helpers for receive indexes, addresses, sync height,
and confirmed coins. This lets GUI tests assert daemon state without a
JSON-RPC server from the embedded daemon.
Cover the first executable GUI workflows: opening a seeded regtest
wallet, visiting every top-level menu and Settings subpage, generating a
receive address through the GUI, and confirming that a GUI-generated
address receives funds on regtest.

The smoke test uses visible labels from the checked-out source, returns
from Settings subpages through the breadcrumb, and relies on stable page
text rather than button OCR where contrast is brittle. Receive tests
drive the native GUI while assertions read wallet state through the
sqlite helpers.
Add a self-hosted CI job that installs Nix, builds `liana-gui` from the
checked-out source, then enters the `gui-tests` Nix shell with
`LIANA_GUI_PATH` pointing at the fresh binary. The job exercises the
virtual X11 harness and uploads GUI artifacts when a failure leaves
screenshots or logs behind.

Keep the legacy functional-test matrix focused on non-GUI tests by
excluding `tests/gui`; those tests require the dedicated Nix/X11 shell.
@pythcoiner

Copy link
Copy Markdown
Collaborator

Hi @starius, that's something interesting! I built a basic GUI test framework ~2 years ago for this exact purpose: https://github.com/pythcoiner/gui_test_framework, the approach was different, using a custom theme in order to make it easier to differentiate different widget types.
If you want to chat about this, feel free to ping me on our telegram or discord (https://discord.gg/9rAqZHwkv6)

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