mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-07 05:52:28 -04:00
Improve Playwright/E2E testing setup (#5056)
Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
parent
01210ce88d
commit
3d9bbe1a62
6 changed files with 168 additions and 46 deletions
38
test/e2e/specs/example.spec.js
Normal file
38
test/e2e/specs/example.spec.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
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("change display timezone", async ({ page }, testInfo) => {
|
||||
await page.goto("./settings/general");
|
||||
await login(page);
|
||||
await page.getByLabel("Display Timezone").selectOption("Pacific/Fiji");
|
||||
await page.getByRole("button", { name: "Save" }).click();
|
||||
await screenshot(testInfo, page);
|
||||
|
||||
await page.goto("./dashboard");
|
||||
await page.goto("./settings/general");
|
||||
await expect(page.getByLabel("Display Timezone")).toHaveValue("Pacific/Fiji");
|
||||
});
|
||||
|
||||
test("database is reset after previous test", async ({ page }, testInfo) => {
|
||||
await page.goto("./settings/general");
|
||||
await login(page);
|
||||
|
||||
const timezoneEl = page.getByLabel("Display Timezone");
|
||||
await expect(timezoneEl).toBeVisible();
|
||||
await expect(timezoneEl).toHaveValue("auto");
|
||||
await screenshot(testInfo, page);
|
||||
});
|
||||
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue