evcc-io/tests/logs.spec.js
2024-10-16 14:24:26 +02:00

48 lines
1.8 KiB
JavaScript

import { test, expect } from "@playwright/test";
import { start, stop, baseUrl } from "./evcc";
import { login } from "./utils";
test.use({ baseURL: baseUrl() });
test.beforeAll(async () => {
await start("basics.evcc.yaml", "password.sql");
});
test.afterAll(async () => {
await stop();
});
test.describe("opening logs", async () => {
test("via config", async ({ page }) => {
await page.goto("/");
await page.getByTestId("topnavigation-button").click();
await page.getByRole("link", { name: "Configuration" }).click();
await login(page);
await page.getByRole("link", { name: "Logs" }).click();
await expect(page.getByRole("heading", { name: "Logs", exact: false })).toBeVisible();
});
test("via notifications", async ({ page }) => {
await page.goto("/");
await page.evaluate(() => window.app.raise({ message: "Fake Error" }));
await page.getByTestId("notification-icon").click();
await page.getByRole("link", { name: "View full logs" }).click();
await login(page);
await expect(page.getByRole("heading", { name: "Logs", exact: false })).toBeVisible();
});
test("via need help", async ({ page }) => {
await page.goto("/");
await page.getByTestId("topnavigation-button").click();
await page.getByRole("button", { name: "Need Help?" }).click();
await page.getByRole("link", { name: "View logs" }).click();
await login(page);
await expect(page.getByRole("heading", { name: "Logs", exact: false })).toBeVisible();
});
});
test.describe("features", async () => {
test("content", async ({ page }) => {
await page.goto("/#/log");
await login(page);
await page.getByTestId("log-search").fill("listening at");
await expect(page.getByTestId("log-content")).toContainText("listening at");
});
});