Files
computer-playbook/roles/web-app-matomo/files/playwright/playwright.spec.js
kevinveenbirkenbachandClaude Opus 5 f09a05e69c fix(matomo/e2e): drop the unused resolveTimeout import
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>
2026-07-30 06:47:15 +02:00

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");
});