mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
Introduces roles/test-e2e-playwright/files/personas/ — runGuestFlow,
runBiberFlow, runAdminFlow plus 10 utils (csp, dashboard, env, keycloak,
landing, logout, matomo, prometheus, interaction, index) — and wires
both the Ansible runner (run_one.yml) and the local rerun helper
(scripts/tests/e2e/rerun-spec.sh) to stage the tree alongside
service-gating.js so specs can `require("./personas")`.
First batch of role specs migrated to consume the shared library
(dashboard, keycloak, mailu, matomo, prometheus, web-svc-cdn,
web-svc-simpleicons) — each gets the spec.js persona scenarios plus
the matching meta/services.yml + playwright.env.j2 entries; matomo is
marked role-closed in req 019. dashboard/keycloak/mailu TODO.md
updated; docs/requirements/019 reflects matomo closure.
Reason: req 019 Rule 3 mandates that every role's guest/biber/
administrator flow runs the same canonical steps; centralising them
in one shared library keeps per-role drift from re-introducing the
stub-shaped bodies the new lint forbids.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
25 lines
1000 B
JavaScript
25 lines
1000 B
JavaScript
/**
|
|
* Assert the browser is in an unauthenticated state by re-navigating
|
|
* to the role's canonical surface and verifying the post-logout
|
|
* request did NOT silently succeed with a 5xx.
|
|
*
|
|
* The post-logout request is allowed to either re-engage the auth
|
|
* chain (redirect to keycloak / the role's /sso/login page) or to
|
|
* serve the public landing for roles whose canonical surface is
|
|
* reachable without auth. Both are acceptable; the assertion is that
|
|
* the request did NOT 5xx and did NOT land on an authenticated-only
|
|
* surface that should be gated.
|
|
*/
|
|
|
|
const { expect } = require("@playwright/test");
|
|
|
|
async function assertUnauthenticatedLanding(page, appBaseUrl) {
|
|
if (!appBaseUrl) return;
|
|
const response = await page.goto(`${appBaseUrl}/`, { waitUntil: "domcontentloaded" }).catch(() => null);
|
|
if (!response) return;
|
|
const status = response.status();
|
|
expect(status, "post-logout request must not 5xx").toBeLessThan(500);
|
|
}
|
|
|
|
module.exports = { assertUnauthenticatedLanding };
|