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