fix: admin account creation
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
Aravinth Manivannan 2024-01-10 20:51:16 +05:30
parent b09d5ce6c4
commit 47120c40b0
Signed by: realaravinth
GPG key ID: F8F50389936984FF

View file

@ -9,8 +9,25 @@ import User from "./user";
test("Create admin fixture @setup", async ({ page }) => {
const admin = new User(config.ADMIN_USERNAME);
admin.setAdmin();
await admin.register(page);
await admin.logout(page);
await expect(page).toHaveTitle("Forgejo: Beyond coding. We forge.");
console.log("looks like admin is already registered");
await page.goto(config.INSTANCE_URL.toString());
await page.getByRole("link", { name: "Register" }).click();
await page.waitForURL("**/user/sign_up");
await page.getByLabel("Username").clear();
await page.getByLabel("Email Address").clear();
await page.getByLabel("Password", { exact: true }).clear();
await page.getByLabel("Confirm Password").clear();
await page.getByLabel("Username").fill(admin.username);
await page.getByLabel("Email Address").fill(admin.email);
await page.getByLabel("Password", { exact: true }).fill(admin.password);
await page.getByLabel("Confirm Password").fill(admin.password);
await page.getByRole("button", { name: "Register Account" }).click();
await page.waitForURL(config.INSTANCE_URL.toString());
expect(page.locator(".positive > p:nth-child(1)")).toContainText(
"Account was successfully created. Welcome!"
);
});