import type { Dict } from '@/i18n/types' import type { Page } from '@playwright/test' import { expect } from './browser' import type { SandboxAccount } from './sandbox' /** Signs in through the login form; resolves on the dashboard once the profile answered. */ export async function signIn(page: Page, account: SandboxAccount, dict: Dict) { await page.goto('/login') await page.getByLabel(dict['auth.email']).fill(account.email) await page .getByLabel(dict['auth.password'], { exact: true }) .fill(account.password) await page.getByRole('button', { name: dict['auth.login.submit'] }).click() await expect(page).toHaveURL(/\/app\/?$/) // The greeting needs the profile: the session and the first REST call went through. await expect(page.locator('main h1')).toContainText(account.displayName) }