summaryrefslogtreecommitdiffstats
path: root/test/e2e/specs/setup-process.once.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2024-11-26 09:28:28 +0100
committerDaniel Baumann <daniel@debian.org>2024-11-26 12:25:58 +0100
commita1882b67c41fe9901a0cd8059b5cc78a5beadec0 (patch)
tree2a24507c67aa99a15416707b2f7e645142230ed8 /test/e2e/specs/setup-process.once.js
parentInitial commit. (diff)
downloaduptime-kuma-upstream.tar.xz
uptime-kuma-upstream.zip
Adding upstream version 2.0.0~beta.0+dfsg.upstream/2.0.0_beta.0+dfsgupstream
Signed-off-by: Daniel Baumann <daniel@debian.org>
Diffstat (limited to 'test/e2e/specs/setup-process.once.js')
-rw-r--r--test/e2e/specs/setup-process.once.js55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/e2e/specs/setup-process.once.js b/test/e2e/specs/setup-process.once.js
new file mode 100644
index 0000000..f1bdf2b
--- /dev/null
+++ b/test/e2e/specs/setup-process.once.js
@@ -0,0 +1,55 @@
+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);
+ });
+
+});