20 lines
667 B
TypeScript
20 lines
667 B
TypeScript
import { type Page, expect } from "@playwright/test";
|
|
|
|
export async function loginViaUi(page: Page): Promise<void> {
|
|
const email = process.env.E2E_USER_EMAIL;
|
|
const password = process.env.E2E_USER_PASSWORD;
|
|
|
|
if (!(email && password)) {
|
|
throw new Error(
|
|
"Identity E2E requires E2E_USER_EMAIL and E2E_USER_PASSWORD in apps/server/.env.e2e."
|
|
);
|
|
}
|
|
|
|
await page.goto("/login");
|
|
await page.locator("#login-email").fill(email);
|
|
await page.locator("#login-password").fill(password);
|
|
await page.locator("#login-submit").click();
|
|
await expect(page).not.toHaveURL(/\/login(?:\?|$)/);
|
|
await expect(page.locator("#account-menu")).toBeVisible();
|
|
}
|