forked from evcc-io/evcc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbasics.spec.js
73 lines (63 loc) · 2.7 KB
/
basics.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
63
64
65
66
67
68
69
70
71
72
73
const { test, expect } = require("@playwright/test");
const { start, stop } = require("./evcc");
test.beforeAll(async () => {
await start("basics.evcc.yaml");
});
test.afterAll(async () => {
await stop();
});
test.beforeEach(async ({ page }) => {
await page.goto("/");
});
test.describe("main screen", async () => {
test("site title", async ({ page }) => {
await expect(page.getByRole("heading", { name: "Hello World" })).toBeVisible();
});
test("visualization", async ({ page }) => {
const locator = page.getByTestId("visualization");
await expect(locator).toBeVisible();
await expect(locator).toContainText("1.0 kW");
});
test("one loadpoint", async ({ page }) => {
await expect(page.getByTestId("loadpoint")).toHaveCount(1);
});
test("loadpoint title", async ({ page }) => {
await expect(page.getByRole("heading", { name: "Carport" })).toBeVisible();
});
test("guest vehicle", async ({ page }) => {
await expect(page.getByRole("heading", { name: "Guest vehicle" })).toBeVisible();
});
});
test.describe("session info", async () => {
test("default", async ({ page }) => {
await expect(page.getByTestId("sessionInfoLabel").first()).toContainText("Duration");
});
test("change value", async ({ page }) => {
// by select
await page.getByTestId("sessionInfoSelect").first().selectOption({ label: "Solar" });
await expect(page.getByTestId("sessionInfoLabel").first()).toContainText("Solar");
// by click on value
await page.getByTestId("sessionInfoValue").first().click();
await expect(page.getByTestId("sessionInfoLabel").first()).toContainText("Duration");
});
test("keep selection on reload", async ({ page }) => {
await expect(page.getByTestId("sessionInfoLabel").first()).toContainText("Duration");
await page.getByTestId("sessionInfoSelect").first().selectOption({ label: "Solar" });
await expect(page.getByTestId("sessionInfoLabel").first()).toContainText("Solar");
await page.reload();
await expect(page.getByTestId("sessionInfoLabel").first()).toContainText("Solar");
});
});
test.describe("loadpoint settings", async () => {
test("phase selection", async ({ page }) => {
await page.getByTestId("loadpoint-settings-button").nth(1).click();
await expect(page.getByLabel("auto-switching")).not.toBeVisible();
await expect(page.getByLabel("3 phase")).toBeChecked();
await expect(page.getByLabel("1 phase")).not.toBeChecked();
await expect(page.getByText("~ 11.0 kW")).toBeVisible();
await expect(page.getByText("~ 4.1 kW")).toBeVisible();
await page.getByLabel("1 phase").click();
await expect(page.getByText("~ 3.7 kW")).toBeVisible();
await expect(page.getByText("~ 1.4 kW")).toBeVisible();
});
});