test(e2e): uniquify person-mention doc title and tighten B21 card-suppression assertion
Some checks failed
CI / Unit & Component Tests (pull_request) Failing after 3m33s
CI / OCR Service Tests (pull_request) Successful in 47s
CI / Backend Unit Tests (pull_request) Failing after 3m21s
CI / Unit & Component Tests (push) Failing after 3m32s
CI / OCR Service Tests (push) Successful in 46s
CI / Backend Unit Tests (push) Failing after 3m10s

- 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 <noreply@anthropic.com>
This commit was merged in pull request #371.
This commit is contained in:
Marcel
2026-04-29 09:04:59 +02:00
parent 515fa03088
commit bc58d77f2c

View File

@@ -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();
}