18 lines
604 B
TypeScript
Raw Normal View History

2025-01-09 18:07:02 +02:00
import { test as setup, expect } from "@playwright/test";
2025-01-09 18:07:02 +02:00
const authFile = "playwright/.auth/user.json";
const ROOT_URL = "http://localhost:8082";
const LOGIN_PASSWORD = "demo1234";
2024-12-22 15:45:54 +02:00
// Reference: https://playwright.dev/docs/auth#basic-shared-account-in-all-tests
setup("authenticate", async ({ page }) => {
await page.goto(ROOT_URL);
await expect(page).toHaveURL(`${ROOT_URL}/login`);
await page.getByRole("textbox", { name: "Password" }).fill(LOGIN_PASSWORD);
2025-01-09 18:07:02 +02:00
await page.getByRole("button", { name: "Login" }).click();
2024-12-22 15:45:54 +02:00
await page.context().storageState({ path: authFile });
});