Commit Graph
3 Commits
Author SHA1 Message Date
kevinveenbirkenbachandClaude Opus 5 b582846ab3 fix(test-e2e-playwright): make the Keycloak redirect and login-control checks able to fail
performKeycloakLogin polled the page URL with toContain(canonicalDomain).
On the Keycloak auth page the app domain already sits in redirect_uri,
so the poll was satisfied before the login had completed. The denial
path and the biber/admin iframe checks used the same substring test.
All of them now compare hostnameOf(url) with the canonical domain, which
is a bare hostname (env.js reads it with /\.onion$/).

LOGIN_CONTROL_NAME never matched a login link that carries an
icon-font glyph: Playwright's accessible name includes the private-use
character, and the pattern only allowed whitespace before the text. The
post-login waitFor({state: "hidden"}) therefore passed at once, even
before oidc.js had swapped the link. The pattern now admits \p{Co}
before the text, so that wait really waits for the swap.

dom.test.js pins both: glyph-prefixed login controls match while Logout
and Accessories do not, an IdP URL carrying the app domain in
redirect_uri is rejected, a look-alike suffix is rejected, and
about:blank yields an empty host.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-11 11:15:10 +02:00
kevinveenbirkenbachandClaude Opus 5 a94a7ec73e fix(e2e): anchor the login-control name in the post-login gates
The gates that assert no sign-in affordance survived the OIDC round-trip
matched /log\s*in|sign\s*in|sso/i unanchored, so the pattern hit ordinary
navigation entries of an already authenticated page as substrings:
Accessories, Login Enabled, Blog inbox, Asset Login History. Any of them made
the gate report 'OIDC login did NOT establish a session' while the login had in
fact succeeded. Snipe-IT 2 of run 31340965955 failed exactly that way.

LOGIN_CONTROL_NAME anchors both ends and still admits the 'with ...' suffix, so
'Sign in with Keycloak' keeps matching and the pattern is not narrowed into
matching nothing.

The pre-login fallbacks in admin.js:58 and biber.js:79 stay deliberately broad:
they hunt for a sign-in control on the UNAUTHENTICATED landing page after the
anchored attempt misses, where no authenticated menu exists to collide with.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 13:56:57 +02:00
kevinveenbirkenbachandClaude Opus 4.7 eb7344cc04 refactor(playwright): share DOM + regex utility helpers
Five role specs (dashboard, nextcloud, odoo, pixelfed, taiga)
duplicated four small utility helpers across one-cluster-each
inline copies:

  - isVisible(locator)               — `locator.first().isVisible()`
                                       with the strict-mode / detached
                                       error swallowed.
  - waitForFrameUrl(iframe, ...)     — poll the embedded iframe URL
                                       until it contains a matcher.
  - findFirstVisibleCandidate(list)  — pick the first visible
                                       candidate from a label/locator
                                       list and return the resolved
                                       single-element locator.
  - escapeRegex(value)               — escape regex metacharacters
                                       so a raw string can be used as
                                       a `new RegExp(...)` source.

Changes
-------
- New `roles/test-e2e-playwright/files/personas/utils/dom.js` collects
  all four helpers (canonical 1-cluster bodies, byte-equivalent to the
  former inline copies).
- `personas/utils/index.js` re-exports the new module so callers reach
  the helpers via `require("./personas")`.
- The five specs strip their inline definitions and amend the
  destructuring with whichever helpers their body still references.

Drift handling
--------------
None. All four helpers were 1-cluster across the call sites; this is
mechanical substitution.

Verification
------------
- 419 passed / 1 skipped / 0 failed across `tests/lint/`,
  `tests/integration/roles/`, `tests/unit/plugins/lookup/`.
- `make lint-javascript`: 0 errors, 283 warnings (unchanged from
  baseline).
- 0 inline `function isVisible|waitForFrameUrl|findFirstVisibleCandidate|escapeRegex`
  definitions remain in any role spec.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 16:25:21 +02:00