mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
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.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
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");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user