-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Config UI: publish updated sponsor and interval values, reboot hint #25038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
4b26c68
496d43d
cd97fe7
829bb56
d8dd007
e7566c9
828302f
65c1943
fb55037
cfc1d5c
3d26eeb
5aaa62d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| import { test, expect } from "@playwright/test"; | ||
| import { start, stop, baseUrl } from "./evcc"; | ||
| import { enableExperimental, expectModalVisible, expectModalHidden } from "./utils"; | ||
|
|
||
| test.use({ baseURL: baseUrl() }); | ||
|
|
||
| test.afterEach(async () => { | ||
| await stop(); | ||
| }); | ||
|
|
||
| test.describe("control settings (interval)", () => { | ||
| test("interval is immediately visible after save without restart", async ({ page }) => { | ||
| await start(); | ||
| await page.goto("/#/config"); | ||
| await enableExperimental(page); | ||
|
|
||
| const controlEntry = page.getByTestId("generalconfig-control"); | ||
| await expect(controlEntry).toContainText("30 s"); | ||
|
Check failure on line 18 in tests/config-control.spec.ts
|
||
|
|
||
| await controlEntry.getByRole("button", { name: "Edit" }).click(); | ||
|
|
||
| const modal = page.getByTestId("control-modal"); | ||
| await expectModalVisible(modal); | ||
|
|
||
| const intervalInput = modal.getByLabel("Interval"); | ||
| await expect(intervalInput).toHaveValue("30"); | ||
| await intervalInput.fill("60"); | ||
|
|
||
| await modal.getByRole("button", { name: "Save" }).click(); | ||
naltatis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| await expectModalHidden(modal); | ||
|
|
||
| await expect(page.getByTestId("restart-needed")).toBeVisible(); | ||
|
|
||
| await expect(controlEntry).toContainText("60 s"); | ||
| await expect(controlEntry).not.toContainText("30 s"); | ||
|
|
||
| await controlEntry.getByRole("button", { name: "Edit" }).click(); | ||
| await expectModalVisible(modal); | ||
| await expect(intervalInput).toHaveValue("60"); | ||
| }); | ||
|
|
||
| test("residual power is immediately visible after save", async ({ page }) => { | ||
| await start(); | ||
| await page.goto("/#/config"); | ||
| await enableExperimental(page); | ||
|
|
||
| const controlEntry = page.getByTestId("generalconfig-control"); | ||
| await controlEntry.getByRole("button", { name: "Edit" }).click(); | ||
|
|
||
| const modal = page.getByTestId("control-modal"); | ||
| await expectModalVisible(modal); | ||
|
|
||
| const residualPowerInput = modal.getByLabel("Residual power"); | ||
| const initialValue = await residualPowerInput.inputValue(); | ||
|
|
||
| await residualPowerInput.fill("200"); | ||
|
|
||
| await modal.getByRole("button", { name: "Save" }).click(); | ||
|
|
||
| await expectModalHidden(modal); | ||
|
|
||
| await expect(page.getByTestId("restart-needed")).toBeVisible(); | ||
|
Check failure on line 63 in tests/config-control.spec.ts
|
||
|
|
||
| await controlEntry.getByRole("button", { name: "Edit" }).click(); | ||
| await expectModalVisible(modal); | ||
| await expect(residualPowerInput).toHaveValue("200"); | ||
| await expect(residualPowerInput).not.toHaveValue(initialValue); | ||
| }); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imho we should move this and the channel handling into a
sponsorfunction.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can refactor this into a helper function. Would you prefer a function in the
sponsorpackage that handles both the database save and websocket publish, or a local helper in the handler file?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot move this saving and publishing logic to the
sponsorpackage. Pass uiChan to package on init.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 5aaa62d. Moved sponsor token saving and publishing logic to the
sponsorpackage:sponsor.Init(valueChan)called inRegisterSystemHandlersponsor.SaveToken()andsponsor.DeleteToken()functions that handle database persistence and websocket publishing