From bc58d77f2cb67b60db381a6811d99daae4ac3f0f Mon Sep 17 00:00:00 2001 From: Marcel Date: Wed, 29 Apr 2026 09:04:59 +0200 Subject: [PATCH] test(e2e): uniquify person-mention doc title and tighten B21 card-suppression assertion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Sara #3: title was a fixed string; if beforeAll crashed before afterAll ran, the next run would collide. Append Date.now() so each run has a unique title. - Sara #2: B21 only asserted "no card present after tap" — but at that point we've already navigated to /persons/{id} and the card lives on the document page, so the assertion was vacuous. Move the toHaveCount(0) to before the tap so it actually proves touch-device suppression. Co-Authored-By: Claude Sonnet 4.6 --- frontend/e2e/person-mention-read.spec.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) 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(); }