Don't show boost button by default for ui-created loadpoints (#27504)
Some checks failed
Some checks failed
This commit is contained in:
parent
fced4194de
commit
d813989648
2 changed files with 42 additions and 10 deletions
|
|
@ -44,6 +44,7 @@ func SplitConfig(payload map[string]any) (DynamicConfig, map[string]any, error)
|
|||
DynamicConfig `mapstructure:",squash"`
|
||||
Other map[string]any `mapstructure:",remain"`
|
||||
}
|
||||
cc.BatteryBoostLimit = 100 // default: disabled
|
||||
|
||||
if err := util.DecodeOther(payload, &cc); err != nil {
|
||||
return DynamicConfig{}, nil, err
|
||||
|
|
|
|||
|
|
@ -1,21 +1,18 @@
|
|||
import { test, expect } from "@playwright/test";
|
||||
import { start, stop, baseUrl } from "./evcc";
|
||||
import { expectModalHidden } from "./utils";
|
||||
import { start, stop, restart, baseUrl } from "./evcc";
|
||||
import { expectModalHidden, newLoadpoint, addDemoCharger } from "./utils";
|
||||
test.use({ baseURL: baseUrl() });
|
||||
|
||||
test.beforeAll(async () => {
|
||||
await start("battery-settings.evcc.yaml");
|
||||
});
|
||||
test.afterAll(async () => {
|
||||
await stop();
|
||||
});
|
||||
const CONFIG_BATTERY = "battery-settings.evcc.yaml";
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto("/");
|
||||
test.afterEach(async () => {
|
||||
await stop();
|
||||
});
|
||||
|
||||
test.describe("boost", async () => {
|
||||
test("activate and deactivate boost in solar mode", async ({ page }) => {
|
||||
await start(CONFIG_BATTERY);
|
||||
await page.goto("/");
|
||||
const boostButton = page.getByTestId("battery-boost-button");
|
||||
await expect(boostButton).not.toBeVisible();
|
||||
await page
|
||||
|
|
@ -42,6 +39,8 @@ test.describe("boost", async () => {
|
|||
});
|
||||
|
||||
test("battery too low for boost when limit above soc", async ({ page }) => {
|
||||
await start(CONFIG_BATTERY);
|
||||
await page.goto("/");
|
||||
const boostButton = page.getByTestId("battery-boost-button");
|
||||
await page
|
||||
.getByTestId("mode")
|
||||
|
|
@ -60,6 +59,8 @@ test.describe("boost", async () => {
|
|||
});
|
||||
|
||||
test("boost button disabled in fast mode", async ({ page }) => {
|
||||
await start(CONFIG_BATTERY);
|
||||
await page.goto("/");
|
||||
const boostButton = page.getByTestId("battery-boost-button");
|
||||
// set a boost limit in solar mode so the boost button appears
|
||||
await page
|
||||
|
|
@ -78,4 +79,34 @@ test.describe("boost", async () => {
|
|||
await page.getByTestId("mode").first().getByRole("button", { name: "Fast" }).click();
|
||||
await expect(boostButton).toBeDisabled();
|
||||
});
|
||||
|
||||
test("boost default for ui-created loadpoint", async ({ page }) => {
|
||||
await start(CONFIG_BATTERY);
|
||||
|
||||
// create a second loadpoint via config UI
|
||||
await page.goto("/#/config");
|
||||
await newLoadpoint(page, "New Charger");
|
||||
await addDemoCharger(page);
|
||||
const lpModal = page.getByTestId("loadpoint-modal");
|
||||
await lpModal.getByRole("button", { name: "Save" }).click();
|
||||
await expectModalHidden(lpModal);
|
||||
|
||||
// restart evcc to apply new loadpoint
|
||||
await restart(CONFIG_BATTERY);
|
||||
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");
|
||||
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();
|
||||
const modal = page.getByTestId("loadpoint-settings-modal").last();
|
||||
await modal.getByTestId("battery-boost-limit").selectOption("50 %");
|
||||
await page.waitForLoadState("networkidle");
|
||||
await modal.getByLabel("Close").click();
|
||||
await expectModalHidden(modal);
|
||||
await expect(boostButton).toBeVisible();
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue