Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/routes/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { PasswordInput } from "@/components/ui/password-input"
import useAuth, { isLoggedIn } from "@/hooks/useAuth"

const formSchema = z.object({
username: z.email(),
username: z.email({ message: "Invalid email address" }),
password: z
.string()
.min(1, { message: "Password is required" })
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/routes/recover-password.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import useCustomToast from "@/hooks/useCustomToast"
import { handleError } from "@/utils"

const formSchema = z.object({
email: z.email(),
email: z.email({ message: "Invalid email address" }),
})

type FormData = z.infer<typeof formSchema>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/routes/signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import useAuth, { isLoggedIn } from "@/hooks/useAuth"

const formSchema = z
.object({
email: z.email(),
email: z.email({ message: "Invalid email address" }),
full_name: z.string().min(1, { message: "Full Name is required" }),
password: z
.string()
Expand Down
6 changes: 6 additions & 0 deletions frontend/tests/reset-password.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ test("User can reset password successfully using the link", async ({
await page.getByTestId("email-input").fill(email)

await page.getByRole("button", { name: "Continue" }).click()
await expect(
page.getByText("Password recovery email sent successfully"),
).toBeVisible()

const emailData = await findLastEmail({
request,
Expand Down Expand Up @@ -98,6 +101,9 @@ test("Weak new password validation", async ({ page, request }) => {
await page.goto("/recover-password")
await page.getByTestId("email-input").fill(email)
await page.getByRole("button", { name: "Continue" }).click()
await expect(
page.getByText("Password recovery email sent successfully"),
).toBeVisible()

const emailData = await findLastEmail({
request,
Expand Down
12 changes: 7 additions & 5 deletions frontend/tests/sign-up.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,21 @@ test("Sign up with existing email", async ({ page }) => {

// Sign up with an email
await page.goto("/signup")

await fillForm(page, fullName, email, password, password)
await page.getByRole("button", { name: "Sign Up" }).click()

// Wait for first signup to complete (navigates to /login on success)
await page.waitForURL("/login")

// Sign up again with the same email
await page.goto("/signup")

await fillForm(page, fullName, email, password, password)
await page.getByRole("button", { name: "Sign Up" }).click()

await page
.getByText("The user with this email already exists in the system")
.click()
// Properly assert error message is visible
await expect(
page.getByText("The user with this email already exists in the system"),
).toBeVisible()
})

test("Sign up with weak password", async ({ page }) => {
Expand Down
4 changes: 3 additions & 1 deletion frontend/tests/utils/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export async function signUpNewUser(
await page.getByTestId("password-input").fill(password)
await page.getByTestId("confirm-password-input").fill(password)
await page.getByRole("button", { name: "Sign Up" }).click()
await page.goto("/login")

// Wait for signup to complete (redirects to /login on success)
await page.waitForURL("/login")
}

export async function logInUser(page: Page, email: string, password: string) {
Expand Down
Loading