Skip to content

Dev-only tgui test harness - #524

Merged
Jackriip merged 5 commits into
masterfrom
feature/ui-test-harness
Nov 11, 2026
Merged

Jackriip merged 5 commits into
masterfrom
feature/ui-test-harness

Conversation

@Jackriip

@Jackriip Jackriip commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Dev-only tgui test harness

Lets a local test build drive tgui windows in a real client: click, type, scroll, press keys and read back what the window shows. Clicks are real DOM events inside the page, so each interface's own handlers and ui_act checks run as they would for a player.

How it works

  • Compiled only with -DUI_HARNESS. A normal build contains none of it; a harness build prints a #warn.
  • voidcrew/modules/ui_harness/ui_harness.dm adds a ui_harness keyword to world/Topic that answers only connections from 127.0.0.1. Commands: list, open, click, type, key, scroll, query. Each waits up to 15 s for the page's reply.
  • tgui/packages/tgui/harness.ts acts only after the server enables it, finds elements by text, selector, placeholder or position, fires the events and returns a short summary of the page.
  • Works for any /datum/tgui_window, including skin-embedded ones.

Safety

  • Normal builds: the overrides don't exist.
  • Harness builds: non-local Topic callers are refused. Replies are accepted only for a pending command sent to that exact window, capped in size and JSON-checked.
  • The harness only drives a client's own windows, so it can't do anything a click in that window couldn't.

Upstream edits (marked VOIDCREW EDIT)

  • tgui/packages/tgui/index.tsx: one import and one setup call.
  • code/_compile_options.dm: a commented //#define UI_HARNESS line.
  • tgstation.dme: one include.

Shown working

Preferences window driven through the harness on a local client: open the Quirks tab, scroll the list, type into the search box.

Harness proof

Builds compiled with -DUI_HARNESS let local tools click, type, press keys,
scroll and read a client's tgui windows through world/Topic from 127.0.0.1.
The page fires real DOM events so interfaces' own handlers run, and replies
in chunks. Normal builds compile none of the server side, and the page side
stays idle unless a harness build enables it.
@Jackriip
Jackriip merged commit aa98d98 into master Nov 11, 2026
4 checks passed
@Jackriip
Jackriip deleted the feature/ui-test-harness branch November 11, 2026 05:33
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.

1 participant