Files
SnapOtter/tests/e2e-analytics/privacy-page.spec.ts
T
SnapOtter fc8b549d78 fix: gate captureException on user consent and fix HEIC PII scrubbing
captureException now checks isRequestOptedIn before forwarding errors
to Sentry, closing a gap where server errors leaked to an external
service even when no user had consented. The PII scrubbing regex is
also fixed: he[ic]f? failed to match .heic due to word-boundary
behavior and is replaced with hei[cf]? which correctly covers .heic,
.heif, and .hei.

Adds 88 new analytics tests across unit, integration, and e2e layers
proving PostHog/Sentry are never invoked when analytics is disabled or
users have not consented, plus full 7-day reminder lifecycle coverage.
2026-04-29 23:47:19 +08:00

41 lines
1.4 KiB
TypeScript

import { expect, test } from "./helpers";
test.describe("Privacy Policy Page", () => {
test("renders at /privacy", async ({ loggedInPage: page }) => {
await page.goto("/privacy");
await expect(page.getByText(/privacy/i).first()).toBeVisible({ timeout: 5_000 });
});
test("mentions PostHog as analytics provider", async ({ loggedInPage: page }) => {
await page.goto("/privacy");
await expect(page.getByText(/posthog/i)).toBeVisible({ timeout: 5_000 });
});
test("mentions Sentry as error tracking provider", async ({ loggedInPage: page }) => {
await page.goto("/privacy");
await expect(page.getByText(/sentry/i)).toBeVisible({ timeout: 5_000 });
});
test("describes local processing", async ({ loggedInPage: page }) => {
await page.goto("/privacy");
await expect(page.getByText(/processed locally|locally on your server/i)).toBeVisible({
timeout: 5_000,
});
});
test("describes user choice for analytics", async ({ loggedInPage: page }) => {
await page.goto("/privacy");
await expect(page.getByText(/opt.in|your choice|consent|choose/i)).toBeVisible({
timeout: 5_000,
});
});
test("no auth required to access privacy page", async ({ page }) => {
// Use a fresh browser with no stored auth
await page.goto("/privacy");
// Should NOT redirect to login
await page.waitForTimeout(2000);
expect(page.url()).toContain("/privacy");
});
});