fix(e2e): fix tag rename and flaky logout tests
Some checks failed
CI / Unit & Component Tests (pull_request) Successful in 2m11s
CI / Backend Unit Tests (pull_request) Successful in 2m7s
CI / E2E Tests (pull_request) Successful in 19m47s
CI / Unit & Component Tests (push) Successful in 2m2s
CI / Backend Unit Tests (push) Successful in 2m3s
CI / E2E Tests (push) Failing after 15m22s

admin.spec.ts: after clicking "Schlagwort bearbeiten", Svelte's {#if editingTagId}
replaces the span with a form, so familieRow (filtered by the span) no longer matches.
Find input[name="name"] and the save button directly instead.

auth.spec.ts: dropdown opens via {#if userMenuOpen} which renders asynchronously.
Wait for the Abmelden button to be visible before clicking to prevent a race condition.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit was merged in pull request #47.
This commit is contained in:
Marcel
2026-03-23 07:25:34 +01:00
parent f98792f10b
commit 6400cef390
2 changed files with 10 additions and 7 deletions

View File

@@ -187,9 +187,10 @@ test.describe('Admin — tag management', () => {
await familieRow.hover();
await familieRow.getByRole('button', { name: 'Schlagwort bearbeiten' }).click();
const nameInput = familieRow.locator('input[name="name"]');
await nameInput.fill('Familie (E2E)');
await familieRow.getByRole('button', { name: /Speichern/i }).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)');
await page.getByRole('button', { name: 'Speichern' }).click();
await expect(page.getByText('Familie (E2E)')).toBeVisible();
await page.screenshot({ path: 'test-results/e2e/admin-tag-renamed.png' });
@@ -208,9 +209,8 @@ test.describe('Admin — tag management', () => {
await renamedRow.hover();
await renamedRow.getByRole('button', { name: 'Schlagwort bearbeiten' }).click();
const nameInput = renamedRow.locator('input[name="name"]');
await nameInput.fill('Familie');
await renamedRow.getByRole('button', { name: /Speichern/i }).click();
await page.locator('input[name="name"]').fill('Familie');
await page.getByRole('button', { name: 'Speichern' }).click();
await expect(page.getByText('Familie')).toBeVisible();
await page.screenshot({ path: 'test-results/e2e/admin-tag-restored.png' });

View File

@@ -61,8 +61,11 @@ test.describe('Authentication', () => {
test('logout clears the session and redirects to /login', async ({ page }) => {
await login(page);
// Logout is inside the user avatar dropdown — open it first
// Logout is inside the user avatar dropdown — open it first.
// Wait for the dropdown button to be visible before clicking Abmelden,
// since the {#if userMenuOpen} block renders asynchronously in Svelte.
await page.locator('button[aria-haspopup="true"]').click();
await expect(page.getByRole('button', { name: 'Abmelden' })).toBeVisible();
await page.getByRole('button', { name: 'Abmelden' }).click();
await expect(page).toHaveURL(/\/login/);
// Confirm session is gone: navigating to / redirects back