mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
The spec navigates through gotoOnion and carries no timeout literals of its own, so the import had no consumer and failed eslint's no-unused-vars, which took the whole CI lint job down. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
31 lines
1.3 KiB
JavaScript
31 lines
1.3 KiB
JavaScript
const { test, expect } = require("@playwright/test");
|
|
|
|
const { appBaseUrl, canonicalDomain, attachDiagnostics, setupMatomoPage } = require("./_shared");
|
|
const { assertCspMetaParity, assertCspResponseHeader, expectNoCspViolations, gotoOnion } = require("./personas");
|
|
|
|
test.use({ ignoreHTTPSErrors: true });
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
await setupMatomoPage(page);
|
|
});
|
|
|
|
test("matomo enforces Content-Security-Policy and exposes canonical domain from applications lookup", async ({ page }) => {
|
|
const diagnostics = attachDiagnostics(page);
|
|
|
|
const response = await gotoOnion(page, `${appBaseUrl}/`);
|
|
expect(response, "Expected Matomo login response").toBeTruthy();
|
|
expect(response.status(), "Expected Matomo login response to be successful").toBeLessThan(400);
|
|
|
|
const directives = assertCspResponseHeader(response, "matomo login");
|
|
await assertCspMetaParity(page, directives, "matomo login");
|
|
|
|
const documentHtml = await response.text();
|
|
const documentUrl = response.url();
|
|
expect(
|
|
documentHtml.includes(canonicalDomain) || documentUrl.includes(canonicalDomain),
|
|
`Expected canonical domain "${canonicalDomain}" (from applications lookup) to appear in the Matomo login document`
|
|
).toBe(true);
|
|
|
|
await expectNoCspViolations(page, diagnostics, "matomo login");
|
|
});
|