Files
rustguac/tests/e2e
Jad Seifeddine 6fbf590c1d pages: one navigation on every page, with the caller's role baked into the served page
pages: bake the caller's role into the served page, version the logo

The header flashed on every navigation: gated links (Sessions, Reports,
Tokens, Admin) were hidden in the markup and shown after /api/me
answered, the logo was revalidated on each page load, and the nav
differed between pages, so switching tabs reflowed the header.

Serve each page in five variants, one per role level, that differ only
in a data-role-level attribute on <html>; optional auth now runs on the
page routes so a logged-in request gets its variant with the navigation
already right on first paint. The ETag is per variant. The logo joins
scripts and stylesheets in content-addressed, immutable caching.

Part of #254

pages: one navigation for every page, gated by role in CSS

Every page carries the same eight links in the same order, including
the Credentials entry (which opens the dialog on the connections page
and deep-links to it from elsewhere), with data-min-role on the gated
ones instead of inline display:none. rustguac.css shows them from the
data-role-level the server writes on <html>; the pages set that
attribute themselves from /api/me for API-key users, whose page GET
carries no credential. Admin-only controls follow the same gate, so
nothing pops in after the first paint. Recordings shows "host (Tenant)"
entry names as the host over a quieter tenant line.

Part of #254

tests: one navigation on every page, gated by data-role-level
(cherry picked from commit 5eed92c6ec)
2026-10-17 08:23:16 +11:00
..

End-to-end tests

Playwright specs that drive the real pages in static/ against a stubbed API. Nothing here needs Vault, guacd, Docker or a browser session: serve.mjs serves the static tree over HTTP and every spec installs lib/api.mjs, which answers /api/* from a small fixture address book (two named tenants and twenty generic ones, two sessions, two recordings) and records every request the page makes so a spec can assert on what was sent.

cd tests/e2e
npm ci
npx playwright install chromium   # once
npm test                          # all specs
npx playwright test specs/global-search.spec.mjs
npx playwright test --ui          # step through a spec

PW_CHROMIUM=/path/to/chrome runs against an already installed Chromium instead of the one Playwright downloads. CI runs the suite in the e2e job.

One spec per change, named after the branch that introduced it:

spec pins
tables-1710 #252: no horizontal overflow at 1710px on Connections, Recordings and Reports, with short and with long unbreakable names
connections-sidebar #254: independent sidebar scroll, selected row marked and kept in view
connections-folder-filter #254: live filter box, ARIA tree, arrow keys, f shortcut
connections-app-shell #254: clipped body, two scroll panes, folder change scrolls the pane not the page
role-nav one nav on every page, gated by data-role-level

The fixture suppresses the first-visit onboarding tour (options.onboarding re-enables it) and defaults to the admin role; pass role to test gating.