36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
import { test, expect } from "@playwright/test";
|
|
import * as config from "./config";
|
|
import User from "./user";
|
|
|
|
test("Create admin fixture @setup", async ({ page }) => {
|
|
const admin = new User(config.ADMIN_USERNAME);
|
|
admin.setAdmin();
|
|
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 new Promise(r => setTimeout(r, 3000));
|
|
await page.waitForURL(config.INSTANCE_URL.toString());
|
|
|
|
await page.locator(".positive > p:nth-child(1)").waitFor();
|
|
|
|
expect(page.locator(".positive > p:nth-child(1)")).toContainText(
|
|
"Account was successfully created. Welcome!"
|
|
);
|
|
|
|
});
|