forked from evcc-io/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdynamicprice.spec.js
More file actions
50 lines (43 loc) · 1.29 KB
/
Copy pathdynamicprice.spec.js
File metadata and controls
50 lines (43 loc) · 1.29 KB
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
const { test } = require("@playwright/test");
import { loop } from "./utils/loop";
const { start, stop } = require("./utils/evcc");
const BASE_PATH = "features/screenshots";
test.beforeAll(async () => {
await start(["basics.evcc.yaml", "dynamicprice.evcc.yaml"], "password.sql");
});
test.afterAll(async () => {
await stop();
});
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
loop((screenshot) => {
test("smart grid charging", async ({ page }) => {
await page.goto("/");
await page.getByTestId("loadpoint-settings-button").nth(1).click();
await wait(300);
await page.locator("#smartCostLimit-1").selectOption("0.2");
await screenshot(
page,
`${BASE_PATH}/dynamicprice-modal`,
"#loadpointSettingsModal_1 .modal-body > .container > div:first-child",
{
all: 50,
top: 110,
right: 70,
},
);
});
test("charging plan", async ({ page }) => {
await page.goto("/");
await page.locator("[data-testid=charging-plan] button").first().click();
await wait(300);
await page.getByTestId("static-plan-energy").selectOption("30");
await screenshot(
page,
`${BASE_PATH}/dynamicprice-plan`,
"#chargingPlanModal_1 .modal-content",
{
all: 20,
},
);
});
});