forgejo-frontend-integration/tests/create-admin.spec.ts

37 lines
1.3 KiB
TypeScript
Raw Normal View History

2024-01-10 17:49:14 +05:30
// 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();
2024-01-10 20:51:16 +05:30
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));
2024-01-10 20:51:16 +05:30
await page.waitForURL(config.INSTANCE_URL.toString());
await page.locator(".positive > p:nth-child(1)").waitFor();
2024-01-10 20:51:16 +05:30
expect(page.locator(".positive > p:nth-child(1)")).toContainText(
"Account was successfully created. Welcome!"
);
2024-01-10 17:49:14 +05:30
});