diff --git a/frontend/e2e/person-mention-read.spec.ts b/frontend/e2e/person-mention-read.spec.ts index b1a01bb4..17b23c7a 100644 --- a/frontend/e2e/person-mention-read.spec.ts +++ b/frontend/e2e/person-mention-read.spec.ts @@ -44,8 +44,14 @@ test.describe('Person mention — read mode', () => { personId = person.id; // 2. Document with a PDF so the transcription panel is mountable. + // Sara #3: timestamp the title so a previous run that crashed in beforeAll + // (and therefore skipped afterAll cleanup) cannot collide with this one. + const uniqueSuffix = Date.now(); const docRes = await request.post('/api/documents', { - multipart: { title: 'E2E Person Mention Read', documentDate: '1945-05-08' } + multipart: { + title: `E2E Person Mention Read ${uniqueSuffix}`, + documentDate: '1945-05-08' + } }); if (!docRes.ok()) throw new Error(`Create document failed: ${docRes.status()}`); const doc = await docRes.json(); @@ -54,7 +60,7 @@ test.describe('Person mention — read mode', () => { await request.put(`/api/documents/${docId}`, { multipart: { - title: doc.title, + title: doc.title as string, documentDate: '1945-05-08', file: { name: 'minimal.pdf', @@ -143,10 +149,13 @@ test.describe('Person mention — read mode', () => { const link = touchPage.locator(`a.person-mention[data-person-id="${personId}"]`).first(); await expect(link).toBeVisible({ timeout: 5000 }); - await link.tap(); - // The card never mounted — the tap navigated directly per spec - await expect(touchPage).toHaveURL(new RegExp(`/persons/${personId}`)); + // Sara #2: assert no card *before* the tap so the test actually proves + // the touch device suppression worked, not just that we navigated away. await expect(touchPage.getByTestId('person-hover-card')).toHaveCount(0); + + await link.tap(); + // The card never mounted — the tap navigated directly per spec. + await expect(touchPage).toHaveURL(new RegExp(`/persons/${personId}`)); } finally { await context.close(); }