import { Page, expect } from '@playwright/test'; export async function waitForApp(page: Page) { await page.waitForLoadState('networkidle', { timeout: 15_000 }).catch(() => {}); await page.waitForTimeout(300); } export async function loginAs(page: Page, email: string, password: string) { await page.goto('/login'); await page.locator('input[type="email"], input[name="email"], input[placeholder*="@"]').first().fill(email); await page.locator('input[type="password"]').first().fill(password); await page.getByRole('button', { name: 'Sign in', exact: true }).click(); await expect(page).not.toHaveURL(/\/login/, { timeout: 20_000 }); await waitForApp(page); }