-
-
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 4 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,79 @@ | ||
| 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); | ||
|
|
||
| // Initially, control entry should show default interval (30s) | ||
| const controlEntry = page.getByTestId("generalconfig-control"); | ||
| await expect(controlEntry).toContainText("30"); | ||
|
Check failure on line 19 in tests/config-control.spec.ts
|
||
naltatis marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| // Open control modal | ||
| await controlEntry.getByRole("button", { name: "Edit" }).click(); | ||
|
|
||
| const modal = page.locator("#controlModal"); | ||
naltatis marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| await expectModalVisible(modal); | ||
|
|
||
| // Change interval to 60 seconds | ||
| const intervalInput = modal.getByLabel("Interval"); | ||
| await expect(intervalInput).toHaveValue("30"); | ||
| await intervalInput.fill("60"); | ||
|
|
||
| // Save the changes | ||
| await modal.getByRole("button", { name: "Save" }).click(); | ||
naltatis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| // Modal should close | ||
naltatis marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| await expectModalHidden(modal); | ||
|
|
||
| // The control entry should now show the new interval value (60s) without restart | ||
| await expect(controlEntry).toContainText("60"); | ||
| await expect(controlEntry).not.toContainText("30"); | ||
|
|
||
| // Verify by opening the modal again | ||
| 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); | ||
|
|
||
| // Open control modal | ||
| const controlEntry = page.getByTestId("generalconfig-control"); | ||
| await controlEntry.getByRole("button", { name: "Edit" }).click(); | ||
|
|
||
| const modal = page.locator("#controlModal"); | ||
| await expectModalVisible(modal); | ||
|
|
||
| // Get initial residual power value | ||
| const residualPowerInput = modal.getByLabel("Residual power"); | ||
| const initialValue = await residualPowerInput.inputValue(); | ||
|
|
||
| // Change residual power to 200W | ||
| await residualPowerInput.fill("200"); | ||
|
|
||
| // Save the changes | ||
| await modal.getByRole("button", { name: "Save" }).click(); | ||
|
|
||
| // Modal should close | ||
| await expectModalHidden(modal); | ||
|
|
||
| // Verify by opening the modal again | ||
| 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