-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump Remix and add Registration e2e test
- Loading branch information
1 parent
cdb2b43
commit 9e9737a
Showing
7 changed files
with
1,567 additions
and
761 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
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,39 @@ | ||
import { test, expect } from "@playwright/test"; | ||
import { userData } from "prisma/fixtures"; | ||
|
||
test("can log in successfully", async ({ page }) => { | ||
await page.goto("/"); | ||
|
||
await page.getByRole("link", { name: "Log in" }).click(); | ||
await page.getByRole("main").getByRole("link", { name: "Log in" }).click(); | ||
await page.locator("#login-identifier-form-emailOrUsername").click(); | ||
|
||
await page | ||
.locator("#login-identifier-form-emailOrUsername") | ||
.fill(userData.email); | ||
await page.getByRole("button", { name: "Next" }).click(); | ||
|
||
expect(page.getByText("Welcome back " + userData.username)).toBeVisible(); | ||
|
||
await page.locator("#login-challenge-form-password").click(); | ||
|
||
await page.locator("#login-challenge-form-password").fill(userData.password); | ||
|
||
await page.getByRole("button", { name: "Log in" }).click(); | ||
|
||
await page.waitForURL("/"); | ||
|
||
expect(await page.getByRole("button", { name: "User avatar" })).toBeVisible(); | ||
}); | ||
|
||
test("shows an error if no username or email is input", async ({ page }) => { | ||
await page.goto("/"); | ||
|
||
await page.getByRole("link", { name: "Log in" }).click(); | ||
await page.getByRole("main").getByRole("link", { name: "Log in" }).click(); | ||
|
||
await page.locator("#login-identifier-form-emailOrUsername").click(); | ||
await page.getByRole("button", { name: "Next" }).click(); | ||
|
||
expect(page.getByText("Email or username is required")).toBeVisible(); | ||
}); |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import { faker } from "@faker-js/faker"; | ||
import { test, expect } from "@playwright/test"; | ||
import { userData } from "prisma/fixtures"; | ||
|
||
test("can successfully register", async ({ page }) => { | ||
await page.goto("/"); | ||
|
@@ -28,11 +29,11 @@ test("cannot register if the username or email are taken", async ({ page }) => { | |
await page.getByRole("link", { name: "Log in" }).click(); | ||
|
||
await page.getByLabel("Username").click(); | ||
await page.getByLabel("Username").fill("TestUser"); | ||
await page.getByLabel("Username").fill(userData.username); | ||
await page.getByLabel("Username").press("Tab"); | ||
await page.getByLabel("Email").fill("[email protected]"); | ||
await page.getByLabel("Email").fill(userData.email); | ||
await page.getByLabel("Email").press("Tab"); | ||
await page.getByLabel("Password").fill("password"); | ||
await page.getByLabel("Password").fill(userData.password); | ||
|
||
await page.getByRole("button", { name: "Sign up" }).click(); | ||
|
||
|
@@ -50,11 +51,11 @@ test("can recover from an error state", async ({ page }) => { | |
await page.getByRole("link", { name: "Log in" }).click(); | ||
|
||
await page.getByLabel("Username").click(); | ||
await page.getByLabel("Username").fill("TestUser"); | ||
await page.getByLabel("Username").fill(userData.username); | ||
await page.getByLabel("Username").press("Tab"); | ||
await page.getByLabel("Email").fill("[email protected]"); | ||
await page.getByLabel("Email").fill(userData.email); | ||
await page.getByLabel("Email").press("Tab"); | ||
await page.getByLabel("Password").fill("password"); | ||
await page.getByLabel("Password").fill(userData.password); | ||
|
||
await page.getByRole("button", { name: "Sign up" }).click(); | ||
|
||
|
Oops, something went wrong.