From 52bb766a04f355aac55288adbc6db3e4a4bbcc57 Mon Sep 17 00:00:00 2001 From: Benjamin Admin Date: Sun, 10 May 2026 15:04:51 +0200 Subject: [PATCH] fix(e2e): Revert extra waits, zurueck zu goTo 2s + 20s toBeVisible Extra waitForTimeout(3000) pro Test verdoppelte Laufzeit und verursachte mehr Timeouts. Zurueck zum funktionierenden Ansatz: goTo wartet auf h1 + 2s, dann 20s toBeVisible Timeout pro Assertion. Co-Authored-By: Claude Opus 4.6 (1M context) --- admin-compliance/e2e/specs/iace-module.spec.ts | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/admin-compliance/e2e/specs/iace-module.spec.ts b/admin-compliance/e2e/specs/iace-module.spec.ts index 99d3796..76958b3 100644 --- a/admin-compliance/e2e/specs/iace-module.spec.ts +++ b/admin-compliance/e2e/specs/iace-module.spec.ts @@ -68,12 +68,12 @@ async function dismissCookieBanner(page: Page) { async function goTo(page: Page, path: string) { await page.goto(`${BASE}${path}`, { waitUntil: 'domcontentloaded', timeout: 30000 }) await dismissCookieBanner(page) - // Wait for React hydration + API fetches — the h1 element is rendered - // after the project data loads, so wait for any h1 to appear + // Wait for React hydration — h1 appears after project fetch try { await page.locator('h1').first().waitFor({ state: 'visible', timeout: 15000 }) - } catch { /* h1 may not appear if page errors */ } - await page.waitForTimeout(1000) + } catch { /* ignore */ } + // Give the overview sections time to render after h1 + await page.waitForTimeout(2000) await dismissCookieBanner(page) } @@ -129,10 +129,8 @@ for (const project of PROJECTS) { test.setTimeout(60_000) // ------ Overview ------ - // Overview tests need extra wait — React hydration + 2 parallel API fetches test('overview page loads', async ({ page }) => { await goTo(page, `/sdk/iace/${project.id}`) - await page.waitForTimeout(3000) // Extra wait for overview API fetches // React hydration error #418 is a known issue (SSR renders "Kein Projekt" before API fetch) // so we only check that the project name appears eventually, not assertNoAppError await expect(page.locator(`text=${project.name}`).first()).toBeVisible({ timeout: 20000 }) @@ -140,7 +138,6 @@ for (const project of PROJECTS) { test('overview — status workflow visible', async ({ page }) => { await goTo(page, `/sdk/iace/${project.id}`) - await page.waitForTimeout(3000) await expect( page.locator('text=Projektstatus').or(page.locator('text=Risikozusammenfassung')).or(page.locator('text=CE-Prozessschritte')) ).toBeVisible({ timeout: 20000 }) @@ -148,7 +145,6 @@ for (const project of PROJECTS) { test('overview — risk summary or process info', async ({ page }) => { await goTo(page, `/sdk/iace/${project.id}`) - await page.waitForTimeout(3000) await expect( page.locator('text=Risikozusammenfassung').or(page.locator('text=Maschineninformationen')).or(page.locator('text=CE-Prozessschritte')) ).toBeVisible({ timeout: 20000 }) @@ -163,7 +159,6 @@ for (const project of PROJECTS) { test('overview — completeness gates section', async ({ page }) => { await goTo(page, `/sdk/iace/${project.id}`) - await page.waitForTimeout(3000) // Completeness may be called "Completeness Gates" or shown as progress percentage await expect( page.locator('text=Completeness Gates').or(page.locator('text=Projektfortschritt')).or(page.locator('text=CE-Prozessschritte')) @@ -172,7 +167,6 @@ for (const project of PROJECTS) { test('overview — quick actions or nav present', async ({ page }) => { await goTo(page, `/sdk/iace/${project.id}`) - await page.waitForTimeout(3000) // Quick actions or IACE sidebar navigation should be visible await expect( page.locator('text=Schnellzugriff').or(page.locator('text=Komponenten').first()) @@ -235,7 +229,6 @@ for (const project of PROJECTS) { // Click the "Risikobewertung" toggle await page.locator('button', { hasText: 'Risikobewertung' }).click() // Wait for the RiskAssessmentTable to render (fetches mitigations) - await page.waitForTimeout(3000) await assertNoAppError(page) // Risk assessment table renders