uptime-kuma/test/e2e/specs/example.spec.js
Shaun c567e8eb8e
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
Status Page E2E spec (#5068)
2024-09-01 02:20:55 +02:00

40 lines
1.4 KiB
JavaScript

import { expect, test } from "@playwright/test";
import { login, restoreSqliteSnapshot, screenshot } from "../util-test";
test.describe("Example Spec", () => {
test.beforeEach(async ({ page }) => {
await restoreSqliteSnapshot(page);
});
test("dashboard", async ({ page }, testInfo) => {
await page.goto("./dashboard");
await login(page);
await screenshot(testInfo, page);
});
test("set up monitor", async ({ page }, testInfo) => {
await page.goto("./add");
await login(page);
await expect(page.getByTestId("monitor-type-select")).toBeVisible();
await page.getByTestId("monitor-type-select").selectOption("http");
await page.getByTestId("friendly-name-input").fill("example.com");
await page.getByTestId("url-input").fill("https://www.example.com/");
await page.getByTestId("save-button").click();
await page.waitForURL("/dashboard/*"); // wait for the monitor to be created
await expect(page.getByTestId("monitor-list")).toContainText("example.com");
await screenshot(testInfo, page);
});
test("database is reset after previous test", async ({ page }, testInfo) => {
await page.goto("./dashboard");
await login(page);
await expect(page.getByTestId("monitor-list")).not.toContainText("example.com");
await screenshot(testInfo, page);
});
});