=test_update_homework_tests_and_work_log
Some checks failed
CI / build-deploy (push) Has been cancelled
Some checks failed
CI / build-deploy (push) Has been cancelled
This commit is contained in:
27
tests/e2e/auth-business-flow.spec.ts
Normal file
27
tests/e2e/auth-business-flow.spec.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { expect, test } from "@playwright/test"
|
||||
|
||||
test.describe("auth business flow", () => {
|
||||
test("register then login and reach protected area", async ({ page }) => {
|
||||
test.skip(!process.env.DATABASE_URL, "requires DATABASE_URL for write-flow verification")
|
||||
|
||||
const id = Date.now()
|
||||
const email = `e2e.user.${id}@example.com`
|
||||
const password = "e2e-pass-123456"
|
||||
|
||||
await page.goto("/register")
|
||||
await page.getByLabel("Full Name").fill("E2E User")
|
||||
await page.getByLabel("Email").fill(email)
|
||||
await page.getByLabel("Password").fill(password)
|
||||
await page.getByRole("button", { name: "Create Account" }).click()
|
||||
await expect(page).toHaveURL(/\/login(?:$|[/?#])/)
|
||||
|
||||
await page.getByLabel("Email").fill(email)
|
||||
await page.getByLabel("Password").fill(password)
|
||||
await page.getByRole("button", { name: "Sign In with Email" }).click()
|
||||
|
||||
await expect(page).toHaveURL(/\/(dashboard|student\/dashboard)(?:$|[/?#])/)
|
||||
const profileResponse = await page.goto("/profile")
|
||||
expect(profileResponse?.status() ?? 200).toBeLessThan(500)
|
||||
await expect(page).not.toHaveURL(/\/login(?:$|[/?#])/)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user