Create, search, edit, archive, archived filter, restore; pages of 25; keyboard only; two accounts; a concurrent edit; a retry after a lost answer sends the same request id; network failures; the leave guard; a change of language; FR/EN, desktop and 375 px, axe on every state. signIn shared.
18 lines
818 B
TypeScript
18 lines
818 B
TypeScript
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)
|
|
}
|