♻️ Add random password util and refactor tests (#1277)

This commit is contained in:
Alejandra
2024-08-01 11:45:05 -05:00
committed by GitHub
parent 17e4fb9141
commit ed61369c2b
5 changed files with 57 additions and 51 deletions

View File

@@ -1,5 +1,6 @@
import { type Page, expect, test } from "@playwright/test"
import { firstSuperuser, firstSuperuserPassword } from "./config.ts"
import { randomPassword } from "./utils/random.ts"
test.use({ storageState: { cookies: [], origins: [] } })
@@ -67,9 +68,10 @@ test("Log in with invalid email", async ({ page }) => {
})
test("Log in with invalid password", async ({ page }) => {
const password = randomPassword()
await page.goto("/login")
// TODO: Add a random password utility
await fillForm(page, firstSuperuser, "changethat")
await fillForm(page, firstSuperuser, password)
await page.getByRole("button", { name: "Log In" }).click()
await expect(page.getByText("Incorrect email or password")).toBeVisible()