feat: deplicate account test
This commit is contained in:
parent
d62f482c9c
commit
2f699f9fe8
1 changed files with 27 additions and 0 deletions
|
@ -44,6 +44,33 @@ test("Test registration error: password mismatch", async ({ page }) => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("Test registration error: dupe user", async ({ page }) => {
|
||||||
|
const user = new User("dupeuser");
|
||||||
|
|
||||||
|
// pre-register user for duplicate user test
|
||||||
|
await user.register(page);
|
||||||
|
await user.logout(page);
|
||||||
|
await expect(page).toHaveTitle("Forgejo: Beyond coding. We forge.");
|
||||||
|
|
||||||
|
await page.getByRole("link", { name: "Register" }).click();
|
||||||
|
await page.waitForURL("**/user/sign_up");
|
||||||
|
|
||||||
|
await page.getByLabel("Username").fill(user.username);
|
||||||
|
await page.getByLabel("Email Address").fill(user.email);
|
||||||
|
await page.getByLabel("Password", { exact: true }).fill(user.password);
|
||||||
|
await page.getByLabel("Confirm Password").fill(user.password);
|
||||||
|
|
||||||
|
await page.getByRole("button", { name: "Register Account" }).click();
|
||||||
|
|
||||||
|
await expect(page).toHaveTitle(
|
||||||
|
"Register - Forgejo: Beyond coding. We forge."
|
||||||
|
);
|
||||||
|
await page.locator(".negative > p:nth-child(1)").waitFor();
|
||||||
|
expect(page.locator(".negative > p:nth-child(1)")).toContainText(
|
||||||
|
"The username is already taken."
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test("Test successful registration", async ({ page }) => {
|
test("Test successful registration", async ({ page }) => {
|
||||||
const user = new User("register");
|
const user = new User("register");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue