fix(e2e): goTo wartet auf h1 statt nav fuer zuverlaessigere Hydration
Root cause der 16 overview-Failures: goTo kehrte zu frueh zurueck weil nav sofort sichtbar ist (SSR), aber der Main-Content (Projektstatus etc.) erst nach API-Fetch rendert. Jetzt wartet goTo auf h1 (das erst nach dem project-Fetch erscheint) + 1s Buffer. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -68,11 +68,12 @@ async function dismissCookieBanner(page: Page) {
|
|||||||
async function goTo(page: Page, path: string) {
|
async function goTo(page: Page, path: string) {
|
||||||
await page.goto(`${BASE}${path}`, { waitUntil: 'domcontentloaded', timeout: 30000 })
|
await page.goto(`${BASE}${path}`, { waitUntil: 'domcontentloaded', timeout: 30000 })
|
||||||
await dismissCookieBanner(page)
|
await dismissCookieBanner(page)
|
||||||
// Wait for React hydration + API fetches by checking for sidebar nav
|
// Wait for React hydration + API fetches — the h1 element is rendered
|
||||||
|
// after the project data loads, so wait for any h1 to appear
|
||||||
try {
|
try {
|
||||||
await page.locator('nav').first().waitFor({ state: 'visible', timeout: 10000 })
|
await page.locator('h1').first().waitFor({ state: 'visible', timeout: 15000 })
|
||||||
} catch { /* nav may not be present on all pages */ }
|
} catch { /* h1 may not appear if page errors */ }
|
||||||
await page.waitForTimeout(2000)
|
await page.waitForTimeout(1000)
|
||||||
await dismissCookieBanner(page)
|
await dismissCookieBanner(page)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user