forked from evcc-io/evcc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.spec.js
62 lines (52 loc) · 2.31 KB
/
config.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import { test, expect } from "@playwright/test";
import { start, stop, baseUrl } from "./evcc";
import { enableExperimental } from "./utils";
const CONFIG_GRID_ONLY = "config-grid-only.evcc.yaml";
test.use({ baseURL: baseUrl() });
test.beforeAll(async () => {
await start(CONFIG_GRID_ONLY);
});
test.afterAll(async () => {
await stop();
});
test.describe("basics", async () => {
test("navigation to config", async ({ page }) => {
await page.goto("/");
await page.getByTestId("topnavigation-button").click();
await page.getByRole("link", { name: "Configuration" }).click();
await expect(page.getByRole("heading", { name: "Configuration" })).toBeVisible();
});
test.skip("alert box should always be visible", async ({ page }) => {
await page.goto("/#/config");
await enableExperimental(page);
await expect(page.getByRole("alert")).toBeVisible();
});
});
test.describe("general", async () => {
test("change site title", async ({ page }) => {
// initial value on main ui
await page.goto("/");
await expect(page.getByRole("heading", { name: "Hello World" })).toBeVisible();
// change value in config
await page.goto("/#/config");
await enableExperimental(page);
await expect(page.getByTestId("generalconfig-title")).toContainText("Hello World");
await page.getByTestId("generalconfig-title").getByRole("button", { name: "edit" }).click();
const modal = page.getByTestId("title-modal");
await expect(modal).toBeVisible();
await modal.getByLabel("Title").fill("Whoops World");
// close modal and ignore entry on cancel
await modal.getByRole("button", { name: "Cancel" }).click();
await expect(modal).not.toBeVisible();
await expect(page.getByTestId("generalconfig-title")).toContainText("Hello World");
// change and save value
await page.getByTestId("generalconfig-title").getByRole("button", { name: "edit" }).click();
await modal.getByLabel("Title").fill("Ahoy World");
await modal.getByRole("button", { name: "Save" }).click();
await expect(modal).not.toBeVisible();
await expect(page.getByTestId("generalconfig-title")).toContainText("Ahoy World");
// check changed value on main ui
await page.getByTestId("home-link").click();
await expect(page.getByRole("heading", { name: "Ahoy World" })).toBeVisible();
});
});