2024-08-28 14:18:04 -07:00
|
|
|
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);
|
|
|
|
});
|
|
|
|
|
2024-08-31 17:20:55 -07:00
|
|
|
test("set up monitor", async ({ page }, testInfo) => {
|
|
|
|
await page.goto("./add");
|
2024-08-28 14:18:04 -07:00
|
|
|
await login(page);
|
|
|
|
|
2024-08-31 17:20:55 -07:00
|
|
|
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);
|
2024-08-28 14:18:04 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
test("database is reset after previous test", async ({ page }, testInfo) => {
|
2024-08-31 17:20:55 -07:00
|
|
|
await page.goto("./dashboard");
|
2024-08-28 14:18:04 -07:00
|
|
|
await login(page);
|
|
|
|
|
2024-08-31 17:20:55 -07:00
|
|
|
await expect(page.getByTestId("monitor-list")).not.toContainText("example.com");
|
2024-08-28 14:18:04 -07:00
|
|
|
await screenshot(testInfo, page);
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|