import type { Page } from "@playwright/test"; export async function login(page: Page, email: string, password: string) { await page.goto("/login"); await page.getByLabel("Email").fill(email); await page.getByLabel("Password").fill(password); await page.getByRole("button", { name: "Sign in" }).click(); await page.waitForURL("/"); const waitGroups = page.waitForResponse(res => res.url().includes("/api/groups") && res.request().method() === "GET"); const waitActive = page.waitForResponse(res => res.url().includes("/api/groups/active") && res.request().method() === "GET"); await page.reload(); await Promise.all([waitGroups, waitActive]); }