Compare commits

..
Author SHA1 Message Date
dank ee9eb353fb fix(e2e): judge only body-carrying script responses in the ABS SSO spec
A 304 carries no Content-Type by spec, and the OIDC bounce revalidates the entry script (Cache-Control: max-age=0 + ETag), so the blanket MIME assertion failed on a healthy bundle. The HTML-stub class is still caught: 200s are still judged, and the count floor now runs on the same filtered set.
2026-11-03 01:39:39 -08:00
dank df597bb1b1 Merge pull request 'fix(abs-guard): audiobooks.franksdank.cloud completes OIDC (forwarded scheme + provider OAuth defaults)' (#131) from fix/abs-guard-oauth-defaults into main 2026-11-03 01:26:32 -08:00
@@ -26,11 +26,11 @@ test("SSO round trip boots the SPA and grants a real Audiobookshelf session", as
}) => {
test.setTimeout(180_000);
const scripts: { url: string; type: string }[] = [];
const scripts: { url: string; type: string; status: number }[] = [];
page.on("response", (res) => {
const u = new URL(res.url());
if (u.host === HOST && u.pathname.endsWith(".js")) {
scripts.push({ url: u.pathname, type: res.headers()["content-type"] ?? "" });
scripts.push({ url: u.pathname, type: res.headers()["content-type"] ?? "", status: res.status() });
}
});
@@ -59,8 +59,11 @@ test("SSO round trip boots the SPA and grants a real Audiobookshelf session", as
// Defect 1 gate: nothing the app loaded may be HTML dressed as a script. The render proof
// is the SSO button above — it only exists once the bundle has executed, so no DOM-shape
// guess is needed (the shell's own mount markup says nothing about whether it booted).
expect(scripts.length, "the SPA loaded no JavaScript").toBeGreaterThan(2);
for (const s of scripts) {
// Only responses that carried a body can be judged: the OIDC bounce re-validates the entry
// script (Cache-Control: max-age=0 + ETag) and a 304 carries no Content-Type by spec.
const bodies = scripts.filter((s) => s.status === 200);
expect(bodies.length, "the SPA loaded no JavaScript").toBeGreaterThan(2);
for (const s of bodies) {
expect(s.type, `${s.url} arrived as ${s.type}`).toContain("javascript");
}