-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
38 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"~:type": "~:validation", | ||
"~:code": "~:wrong-credentials" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,16 @@ test("Shows login page when going to index and user is logged out", async ({ pag | |
await page.goto("/"); | ||
|
||
await expect(page).toHaveURL(/auth\/login$/); | ||
await expect(page.getByText("Log into my account")).toBeVisible(); | ||
await expect(page.getByRole("heading", { name: "Log into my account" } )).toBeVisible(); | ||
}); | ||
|
||
test("User submit a wrong formated email ", async ({ page }) => { | ||
await interceptRPC(page, "get-profile", "get-profile-anonymous.json"); | ||
await page.goto("/"); | ||
await page.getByLabel("Email").fill("foo"); | ||
|
||
await expect(page).toHaveURL(/auth\/login$/); | ||
await expect(page.getByText("Enter a valid email please")).toBeVisible(); | ||
}); | ||
|
||
test("User logs in by filling the login form", async ({ page }) => { | ||
|
@@ -54,3 +63,18 @@ test("User logs in by filling the login form", async ({ page }) => { | |
|
||
await expect(page).toHaveURL(/dashboard/); | ||
}); | ||
|
||
test("User submits wrong credentials", async ({ page }) => { | ||
await interceptRPC(page, "get-profile", "get-profile-anonymous.json"); | ||
await interceptRPC(page, "login-with-password", "login-with-password-error.json", { status: 400 }); | ||
|
||
await page.goto("/"); | ||
|
||
await page.getByLabel("Email").fill("[email protected]"); | ||
await page.getByLabel("Password").fill("aaaa"); | ||
|
||
await page.getByRole("button", { name: "Login" }).click(); | ||
|
||
await expect(page.getByText("Email or password is incorrect")).toBeVisible(); | ||
await expect(page).toHaveURL(/auth\/login$/); | ||
}); |