← full-stack-fastapi-template  /  frontend/tests/auth.setup.ts

1
import { test as setup } from "@playwright/test"
2
import { firstSuperuser, firstSuperuserPassword } from "./config.ts"
3
4
const authFile = "playwright/.auth/user.json"
5
6
setup("authenticate", async ({ page }) => {
7
  await page.goto("/login")
8
  await page.getByTestId("email-input").fill(firstSuperuser)
9
  await page.getByTestId("password-input").fill(firstSuperuserPassword)
10
  await page.getByRole("button", { name: "Log In" }).click()
11
  await page.waitForURL("/")
12
  await page.context().storageState({ path: authFile })
13
})
14