Add regtest GUI tests for liana-gui - #2144
Open
starius wants to merge 5 commits into
Open
Conversation
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.
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds the first native GUI end-to-end tests for
liana-guiinregtest mode.
gui-testsNix dev shell with the X11, OCR, file picker, Bitcoinbackend, and Python dependencies needed for GUI automation
liana-gui,captures logs/screenshots, clicks visible text, and leaves artifacts on
failure
embedded daemon state from sqlite
visiting Settings subpages
a deposit to a GUI-generated address
liana-guifrom the checked-out source and runs theGUI tests against that binary via
LIANA_GUI_PATHThe 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
Result: