uptime-kuma/test/e2e/specs/setup-process.once.js
artshllaku a309cf0e2c
Some checks are pending
Auto Test / auto-test (18, ARM64) (push) Blocked by required conditions
Auto Test / auto-test (18, macos-latest) (push) Blocked by required conditions
Auto Test / auto-test (18, ubuntu-latest) (push) Blocked by required conditions
Auto Test / auto-test (18, windows-latest) (push) Blocked by required conditions
Auto Test / auto-test (20.5, ARM64) (push) Blocked by required conditions
Auto Test / auto-test (20.5, macos-latest) (push) Blocked by required conditions
Auto Test / auto-test (20.5, ubuntu-latest) (push) Blocked by required conditions
Auto Test / auto-test (20.5, windows-latest) (push) Blocked by required conditions
Auto Test / armv7-simple-test (18, ARMv7) (push) Blocked by required conditions
Auto Test / armv7-simple-test (20, ARMv7) (push) Blocked by required conditions
Auto Test / check-linters (push) Waiting to run
Auto Test / e2e-test (push) Blocked by required conditions
CodeQL / Analyze (go) (push) Waiting to run
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
Merge Conflict Labeler / Labeling (push) Waiting to run
json-yaml-validate / json-yaml-validate (push) Waiting to run
tests: improve playwright test readability (#5149)
2024-10-03 11:20:27 +02:00

56 lines
1.8 KiB
JavaScript

import { test } from "@playwright/test";
import { getSqliteDatabaseExists, login, screenshot, takeSqliteSnapshot } from "../util-test";
test.describe("Uptime Kuma Setup", () => {
test.skip(() => getSqliteDatabaseExists(), "Must only run once per session");
test.afterEach(async ({ page }, testInfo) => {
await screenshot(testInfo, page);
});
/*
* Setup
*/
test("setup sqlite", async ({ page }, testInfo) => {
await page.goto("./");
await page.getByText("SQLite").click();
await page.getByRole("button", { name: "Next" }).click();
await screenshot(testInfo, page);
await page.waitForURL("/setup"); // ensures the server is ready to continue to the next test
});
test("setup admin", async ({ page }) => {
await page.goto("./");
await page.getByPlaceholder("Username").click();
await page.getByPlaceholder("Username").fill("admin");
await page.getByPlaceholder("Username").press("Tab");
await page.getByPlaceholder("Password", { exact: true }).fill("admin123");
await page.getByPlaceholder("Password", { exact: true }).press("Tab");
await page.getByPlaceholder("Repeat Password").fill("admin123");
await page.getByRole("button", { name: "Create" }).click();
});
/*
* All other tests should be run after setup
*/
test("login", async ({ page }) => {
await page.goto("./dashboard");
await login(page);
});
test("logout", async ({ page }) => {
await page.goto("./dashboard");
await login(page);
await page.getByText("A", { exact: true }).click();
await page.getByRole("button", { name: "Log out" }).click();
});
test("take sqlite snapshot", async ({ page }) => {
await takeSqliteSnapshot(page);
});
});