evcc-io/tests/battery-settings-co2.spec.ts
andig 7761979913
Add co2 grid charge tests (#22444)
Co-authored-by: Michael Geers <michael@geers.tv>
2025-07-28 10:01:55 +02:00

35 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { test, expect } from "@playwright/test";
import { start, stop, baseUrl } from "./evcc";
import { expectModalVisible, expectModalHidden, openTopNavigation } from "./utils";
test.use({ baseURL: baseUrl() });
test.beforeAll(async () => {
await start("battery-settings-co2.evcc.yaml");
});
test.afterAll(async () => {
await stop();
});
test.describe("battery settings co2", async () => {
test("grid charging", async ({ page }) => {
await page.goto("/");
await openTopNavigation(page);
await page.getByTestId("topnavigation-battery").click();
const modal = page.getByTestId("battery-settings-modal");
await expectModalVisible(modal);
await modal.getByRole("link", { name: "Grid charging" }).click();
await modal.getByLabel("CO₂ limit").selectOption({ label: "≤ 150 g/kWh" });
await expect(modal).toContainText("20 g – 150 g");
await page.getByRole("button", { name: "Close" }).click();
await expectModalHidden(modal);
await page.getByTestId("energyflow").click();
await page.getByRole("button", { name: "grid charging active (≤ 150 g)" }).click();
await expectModalVisible(modal);
await modal.getByLabel("CO₂ limit").selectOption({ label: "≤ 40 g/kWh" });
await modal.getByRole("button", { name: "Close" }).click();
await expectModalHidden(modal);
await expect(modal).not.toBeVisible();
await expect(page.getByRole("button", { name: "grid charging when ≤ 40 g" })).toBeVisible();
});
});