test(e2e): fix notification-deep-link — relative paths, afterAll cleanup, accurate J10 comment

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-05 19:08:57 +02:00
parent 64110033bd
commit 5518122b69

View File

@@ -25,15 +25,13 @@ let commentId: string;
test.describe('Notification deep-link scroll', () => {
test.beforeAll(async ({ request }) => {
const baseURL = process.env.E2E_BASE_URL ?? 'http://localhost:3000';
const createRes = await request.post('/api/documents', {
multipart: { title: 'E2E Deep-Link Test', documentDate: '1945-05-08' }
});
if (!createRes.ok()) throw new Error(`Create document failed: ${createRes.status()}`);
const doc = await createRes.json();
docId = doc.id;
docHref = `${baseURL}/documents/${docId}`;
docHref = `/documents/${docId}`;
const uploadRes = await request.put(`/api/documents/${docId}`, {
multipart: {
@@ -74,6 +72,10 @@ test.describe('Notification deep-link scroll', () => {
commentId = comment.id;
});
test.afterAll(async ({ request }) => {
if (docId) await request.delete(`/api/documents/${docId}`);
});
async function openDeepLink(page: Page) {
const url = `${docHref}?commentId=${commentId}&annotationId=${annotationId}`;
await page.goto(url);
@@ -119,16 +121,17 @@ test.describe('Notification deep-link scroll', () => {
// ── Notification bell — J10 ────────────────────────────────────────────────
//
// Verifies the notification bell in the global header: clicking it opens the
// dropdown, an unread notification is visible, clicking it marks it as read
// and navigates to the target document.
// dropdown and it closes on Escape. Full mark-as-read and navigation flows are
// tracked in a follow-up issue.
test.describe('Notification bell', () => {
let bellDocId: string;
test.beforeAll(async ({ request }) => {
const stamp = Date.now().toString(36);
// Seed a document + comment to ensure the notification list has content to render.
const createRes = await request.post('/api/documents', {
multipart: { title: 'E2E Bell Test Doc', documentDate: '1930-01-01' }
multipart: { title: `E2E Bell Test Doc ${stamp}`, documentDate: '1930-01-01' }
});
if (!createRes.ok()) throw new Error(`Create document failed: ${createRes.status()}`);
const doc = await createRes.json();
@@ -140,6 +143,10 @@ test.describe('Notification bell', () => {
if (!commentRes.ok()) throw new Error(`Create comment failed: ${commentRes.status()}`);
});
test.afterAll(async ({ request }) => {
if (bellDocId) await request.delete(`/api/documents/${bellDocId}`);
});
test('bell opens dropdown, shows notifications list', async ({ page }) => {
test.setTimeout(30_000);