fix: boost button only if connected (#27506)

This commit is contained in:
Michael Geers 2026-02-19 10:17:28 +01:00 • committed by GitHub
parent d813989648
commit 0149242ec9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 21 additions and 9 deletions

View file

@ -202,7 +202,7 @@ export default defineComponent({
return this.collectProps(ChargingPlan);
},
showBoostButton(): boolean {
return this.batteryBoostAvailable && this.batteryBoostLimit < 100;
return this.connected && this.batteryBoostAvailable && this.batteryBoostLimit < 100;
},
batteryBoostButtonProps() {
return this.collectProps(BatteryBoostButton);

View file

@ -1,6 +1,6 @@
import { test, expect } from "@playwright/test";
import { start, stop, restart, baseUrl } from "./evcc";
import { expectModalHidden, newLoadpoint, addDemoCharger } from "./utils";
import { expectModalHidden, newLoadpoint, addDemoCharger, ChargerStatus } from "./utils";
test.use({ baseURL: baseUrl() });
const CONFIG_BATTERY = "battery-settings.evcc.yaml";
@ -83,10 +83,10 @@ test.describe("boost", async () => {
test("boost default for ui-created loadpoint", async ({ page }) => {
await start(CONFIG_BATTERY);
// create a second loadpoint via config UI
// create a second loadpoint
await page.goto("/#/config");
await newLoadpoint(page, "New Charger");
await addDemoCharger(page);
await addDemoCharger(page, undefined, ChargerStatus.Connected);
const lpModal = page.getByTestId("loadpoint-modal");
await lpModal.getByRole("button", { name: "Save" }).click();
await expectModalHidden(lpModal);
@ -96,12 +96,14 @@ test.describe("boost", async () => {
await page.goto("/");
await expect(page.getByTestId("loadpoint")).toHaveCount(2);
// boost button on new loadpoint should not be visible (batteryBoostLimit defaults to 100 = disabled)
const boostButton = page.getByTestId("battery-boost-button");
const lp = page.getByTestId("loadpoint").last();
// not visible by default
const boostButton = lp.getByTestId("battery-boost-button");
await expect(boostButton).not.toBeVisible();
// set boost limit to 50% on new loadpoint and verify button appears
await page.getByTestId("loadpoint-settings-button").last().click();
// visible after setting limit
await lp.getByTestId("loadpoint-settings-button").last().click();
const modal = page.getByTestId("loadpoint-settings-modal").last();
await modal.getByTestId("battery-boost-limit").selectOption("50 %");
await page.waitForLoadState("networkidle");

View file

@ -63,9 +63,16 @@ export enum LoadpointType {
Heating = "heating",
}
export enum ChargerStatus {
Disconnected = "A",
Connected = "B",
Charging = "C",
}
export async function addDemoCharger(
page: Page,
type: LoadpointType = LoadpointType.Charging
type: LoadpointType = LoadpointType.Charging,
status?: ChargerStatus
): Promise<void> {
const lpModal = page.getByTestId("loadpoint-modal");
await lpModal
@ -77,6 +84,9 @@ export async function addDemoCharger(
await modal
.getByLabel("Manufacturer")
.selectOption(type === LoadpointType.Heating ? "Demo heat pump" : "Demo charger");
if (status) {
await modal.getByLabel("Charge status").selectOption(status);
}
await modal.getByRole("button", { name: "Save" }).click();
await expectModalHidden(modal);
await expectModalVisible(lpModal);