diff --git a/tests/e2e/helpers.ts b/tests/e2e/helpers.ts index 7e66317f4..30add2d06 100644 --- a/tests/e2e/helpers.ts +++ b/tests/e2e/helpers.ts @@ -141,7 +141,10 @@ export async function loginViaAPI( /** * Navigue vers un path et attend que l'app soit prete. - * STRICT: echoue si la page ne charge pas (main element must appear). + * STRICT: echoue si la page ne charge pas — accepts any of the + * standard "page rendered" signals so a page that uses sidebar + * layouts without a dedicated
(e.g. /social, /chat, some + * settings subroutes) still passes the readiness probe. */ export async function navigateTo(page: Page, path: string): Promise { const url = path.startsWith('http') ? path : `${CONFIG.baseURL}${path}`; @@ -149,8 +152,14 @@ export async function navigateTo(page: Page, path: string): Promise { await page.waitForLoadState('networkidle', { timeout: 5_000 }).catch(() => { // networkidle can legitimately timeout on pages with websockets/polling — not a test failure }); - // App must render a main content area - await page.locator('main, [role="main"]').first().waitFor({ + // App must render some substantive root content. v1.0.7-rc1-day2: + // widened from `main, [role="main"]` to also accept the app sidebar + // (rendered on every authenticated route, and stable against layout + // refactors that may or may not use semantic
) and any + // element marked `data-page-root` for explicit opt-in pages. + await page.locator( + 'main, [role="main"], [data-testid="app-sidebar"], [data-page-root]', + ).first().waitFor({ state: 'visible', timeout: 20_000, });