From 53b482c5f24688ca3426d434c832e8d24acfee4c Mon Sep 17 00:00:00 2001 From: Marcel Date: Fri, 27 Mar 2026 11:34:42 +0100 Subject: [PATCH] fix(e2e): fix admin tag test (use existing tag) and annotation locator - Admin tag test: "Familie" never existed in the database; use "Fest" which is a real seeded tag, with a matching rename-back to restore state - Annotation hash test: the broad `[data-testid^="annotation-"]` locator also matched `annotation-side-panel` (always in DOM, even when off-screen); extend the :not() exclusion list to cover it Co-Authored-By: Claude Sonnet 4.6 --- frontend/e2e/admin.spec.ts | 22 +++++++++++----------- frontend/e2e/documents.spec.ts | 6 ++++-- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/frontend/e2e/admin.spec.ts b/frontend/e2e/admin.spec.ts index 57682eec..aad5ff85 100644 --- a/frontend/e2e/admin.spec.ts +++ b/frontend/e2e/admin.spec.ts @@ -180,19 +180,19 @@ test.describe('Admin — tag management', () => { // Wait for the tags list to render after the tab switch await page.waitForSelector('ul > li'); - // Hover over the "Familie" row to reveal the opacity-0 action buttons - const familieRow = page + // Hover over the "Fest" row to reveal the opacity-0 action buttons + const festRow = page .locator('ul > li') - .filter({ has: page.locator('span', { hasText: /^Familie$/ }) }); - await familieRow.hover(); - await familieRow.getByRole('button', { name: 'Schlagwort bearbeiten' }).click(); + .filter({ has: page.locator('span', { hasText: /^Fest$/ }) }); + await festRow.hover(); + await festRow.getByRole('button', { name: 'Schlagwort bearbeiten' }).click(); // After clicking edit, {#if editingTagId} replaces the span with a form — - // the familieRow filter no longer matches, so we find the input directly. - await page.locator('input[name="name"]').fill('Familie (E2E)'); + // the festRow filter no longer matches, so we find the input directly. + await page.locator('input[name="name"]').fill('Fest (E2E)'); await page.getByRole('button', { name: 'Speichern' }).click(); - await expect(page.getByText('Familie (E2E)')).toBeVisible(); + await expect(page.getByText('Fest (E2E)')).toBeVisible(); await page.screenshot({ path: 'test-results/e2e/admin-tag-renamed.png' }); }); @@ -205,14 +205,14 @@ test.describe('Admin — tag management', () => { const renamedRow = page .locator('ul > li') - .filter({ has: page.locator('span', { hasText: /^Familie \(E2E\)$/ }) }); + .filter({ has: page.locator('span', { hasText: /^Fest \(E2E\)$/ }) }); await renamedRow.hover(); await renamedRow.getByRole('button', { name: 'Schlagwort bearbeiten' }).click(); - await page.locator('input[name="name"]').fill('Familie'); + await page.locator('input[name="name"]').fill('Fest'); await page.getByRole('button', { name: 'Speichern' }).click(); - await expect(page.getByText('Familie')).toBeVisible(); + await expect(page.getByText('Fest')).toBeVisible(); await page.screenshot({ path: 'test-results/e2e/admin-tag-restored.png' }); }); }); diff --git a/frontend/e2e/documents.spec.ts b/frontend/e2e/documents.spec.ts index 5fc7fa17..06fe9aef 100644 --- a/frontend/e2e/documents.spec.ts +++ b/frontend/e2e/documents.spec.ts @@ -461,9 +461,11 @@ test.describe('PDF annotations — file hash versioning', () => { await page.waitForSelector('[data-hydrated]'); await page.locator('canvas').first().waitFor({ state: 'visible', timeout: 20000 }); - // Use :not() to exclude the outdated-notice element whose testid also starts with "annotation-" + // Use :not() to exclude the outdated-notice and side-panel elements whose testid also starts with "annotation-" await expect( - page.locator('[data-testid^="annotation-"]:not([data-testid="annotation-outdated-notice"])') + page.locator( + '[data-testid^="annotation-"]:not([data-testid="annotation-outdated-notice"]):not([data-testid="annotation-side-panel"])' + ) ).toHaveCount(0, { timeout: 8000 }); await expect(page.locator('[data-testid="annotation-outdated-notice"]')).toBeVisible({ timeout: 5000