backdesk

backdesk Examples: Fixture Form, 7-Zip, LibreOffice Calc and Untested Patterns

The fixture form workflow below was run through the CLI and the output is real, trimmed, with machine paths and ids replaced by placeholders. The 7-Zip and LibreOffice Calc scripts were run and passed. The patterns at the end were not run.

Fixture Form Workflow (Run, CLI)

The fixture is a small Windows Forms test app in this repository. It is not shipped. This run used backdesk call --hold, which keeps one connection open so the lease persists. Each request is one JSON line on standard input. Each reply is one JSON line. Replies are shown trimmed.

Start the connection:

<path-to>\backdesk.exe call --hold

1. Start a session. Only the fixture exe is allowed to launch. Paths must be absolute.

{"id":"2","op":"session_start","args":{"allowedApps":["<path-to>\\backdesk-fixture.exe"],"readableFolders":["<work>"],"writableFolders":["<work>"]}}
{"id":"2","ok":true,"result":{"machineId":"<machine-id>","sessionId":"<session-id>","backend":"hidden-desktop","state":"running","leaseHolder":null,"windows":0}}

2. Take the lease and launch the app.

{"id":"3","op":"lease_acquire","args":{"sessionId":"<session-id>","agentId":"docs-demo"}}
{"id":"4","op":"app_launch","args":{"sessionId":"<session-id>","leaseId":"<lease-id>","path":"<path-to>\\backdesk-fixture.exe","args":["form","--state","<work>\\state.json","--out","<work>\\out.json"]}}
{"id":"3","ok":true,"result":{"leaseId":"<lease-id>","agentId":"docs-demo","sessionId":"<session-id>","expiresAt":"<time, 15 s later>"}}
{"id":"4","ok":true,"result":{"pid":<pid>,"window":{"hwnd":<hwnd>,"title":"Backdesk Fixture Form","bounds":{"x":60,"y":60,"width":496,"height":339},"dpi":96,"isDialog":false}}}

3. Read the control tree and observe. window_list with tree returns the controls and their nodeId values (not shown). observe records what the window looks like and gives an observationId.

{"id":"6","op":"observe","args":{"sessionId":"<session-id>","hwnd":<hwnd>,"includeImage":false}}
{"id":"6","ok":true,"result":{"observation":{"observationId":"<observation-id>","coordinateSpace":"window-px","bounds":{"x":60,"y":60,"width":496,"height":339},"dpi":96},"frame":{"width":496,"height":339,"route":"printwindow-full"}}}

4. Fill the form. Set the name through the control, click the notes box, type into it, tick the check box, press Save.

{"id":"7","op":"set_text","args":{"sessionId":"<session-id>","leaseId":"<lease-id>","hwnd":<hwnd>,"nodeId":"<name-edit-node>","text":"Ada Lovelace"}}
{"id":"8","op":"click","args":{"sessionId":"<session-id>","leaseId":"<lease-id>","hwnd":<hwnd>,"observationId":"<observation-id>","x":130,"y":110}}
{"id":"9","op":"type_text","args":{"sessionId":"<session-id>","leaseId":"<lease-id>","hwnd":<hwnd>,"text":"Invoice 42"}}
{"id":"10","op":"invoke","args":{"sessionId":"<session-id>","leaseId":"<lease-id>","hwnd":<hwnd>,"nodeId":"<agree-node>"}}
{"id":"11","op":"invoke","args":{"sessionId":"<session-id>","leaseId":"<lease-id>","hwnd":<hwnd>,"nodeId":"<save-node>"}}

Receipts, with the target and isolation fields trimmed:

{"id":"7", ...,"receipt":{"operation":"set_text","route":"win32-control","dispatched":["WM_SETTEXT (text length 12)"],"observed":{"frameChanged":true,"textDiff":"length 0 -> 12"},"durationMs":209,"accessibility":"win32"}}
{"id":"8", ...,"receipt":{"operation":"click","route":"posted-message","dispatched":["WM_MOUSEMOVE(10,27)","WM_LBUTTONDOWN(10,27)","WM_LBUTTONUP(10,27)"],"activated":true,"observed":{"frameChanged":true},"durationMs":191}}
{"id":"9", ...,"receipt":{"operation":"type_text","route":"posted-message","dispatched":["WM_CHAR x10 (text length 10)"],"observed":{"frameChanged":true,"textDiff":"length 0 -> 10"},"durationMs":305}}
{"id":"10",...,"receipt":{"operation":"invoke","route":"win32-control","dispatched":["BM_CLICK"],"target":{"title":"I agree"},"durationMs":201}}
{"id":"11",...,"receipt":{"operation":"invoke","route":"win32-control","dispatched":["BM_CLICK"],"target":{"title":"Save"},"observed":{"frameChanged":false},"durationMs":201}}

Every receipt also carried "isolation":{"ok":true,"passed":[...],"failed":[]} and an unverified list saying the app's own behavior was not checked. The Save receipt reports frameChanged: false, so the receipt alone does not show that the save happened. The next step checks the file.

5. Verify the result on disk, release and stop.

{"id":"12","op":"wait_for","args":{"sessionId":"<session-id>","condition":{"type":"file_exists","path":"<work>\\out.json"},"timeoutMs":5000}}
{"id":"13","op":"lease_release","args":{"sessionId":"<session-id>","leaseId":"<lease-id>"}}
{"id":"14","op":"session_stop","args":{"sessionId":"<session-id>"}}
{"id":"12","ok":true,"result":{"satisfied":true,"elapsedMs":0,"detail":"<work>\\out.json"}}
{"id":"13","ok":true,"result":{"released":true}}
{"id":"14","ok":true,"result":{"sessionId":"<session-id>","state":"stopped"}}

The file the fixture wrote:

{"name":"Ada Lovelace","notes":"Invoice 42","agree":true,"color":"Red","city":"","via":"button","count":1}

Then stop the daemon with backdesk daemon-stop. The app ran on the session's hidden desktop.

7-Zip File Manager 25.01 (Run, Passed)

Script: examples/third-party/sevenzip.py (Python standard library; helper bd.py). Usage: python sevenzip.py <backdesk.exe> <7zFM.exe> <work-folder containing a.txt>.

Verified: F7 opens the new-folder dialog, typing a name and pressing Enter creates the folder on disk. Selecting a file, clicking the toolbar Add button by coordinates, and pressing Enter in the "Add to Archive" dialog creates a.7z on disk containing the file.

LibreOffice Calc 25.8.2.2 (Run, Passed 3 of 3)

Script: examples/third-party/calc.py. Usage: python calc.py <backdesk.exe> <scalc.exe> <work-folder containing sheet.csv>. It uses a separate LibreOffice profile (-env:UserInstallation) so a LibreOffice on your own desktop is never reused.

Verified: open a copied CSV, accept the Text Import dialog with Enter, type a row, press Ctrl+S, confirm keeping the CSV format, and the file on disk contains the new row.

Limits seen:

Nothing else has been run. Blender, Obsidian, browsers, Electron and Chromium apps, WinUI and UWP apps and games are untested.

Patterns That Were Not Run

These are sketches of how the operations could combine. Untested. Check each against your app before you rely on it, and verify the result outside the app, as the fixture run does.

Kind of workSketchStatus
Formsset_text or type_text into fields, invoke the submit button, wait_for the saved file.untested pattern (the fixture form is the one tested form)
Filesapp_launch a file manager, use key and type_text for dialogs, wait_for file_exists in a folder listed in the session spec.partly run with 7-Zip; other file managers untested
SpreadsheetsType cells with type_text and key, save with Ctrl+S, read the file.run with LibreOffice Calc only
Creative appsDrive menus and tool palettes with click and drag.untested; apps that read raw input may not respond
GUI testingLaunch the app under test, run a fixed sequence, compare the receipts and the saved output.untested pattern

API, recovery, limitations.