UI: don't show setup-screen on slow connections (#21306)

Co-authored-by: Michael Geers <michael@geers.tv>
This commit is contained in:
StefanSchoof 2025-05-20 10:28:45 +02:00 • committed by GitHub
parent 92ef228af9
commit 0f4c16aac9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 44 additions and 0 deletions

View file

@ -1,5 +1,6 @@
<template>
<Site
v-if="state.startup"
:notifications="notifications"
v-bind="state"
:selected-loadpoint-index="selectedLoadpointIndex"

43
tests/ws.spec.js Normal file
View file

@ -0,0 +1,43 @@
import { test, expect } from "@playwright/test";
import { start, stop, baseUrl } from "./evcc";
test.use({ baseURL: baseUrl() });
test.beforeAll(async () => {
await start("basics.evcc.yaml");
});
test.afterAll(async () => {
await stop();
});
test("show loadpoint with connect websocket", async ({ page }) => {
await page.routeWebSocket("/ws", (ws) => {
const server = ws.connectToServer();
ws.onMessage((message) => {
server.send(message);
});
server.onMessage((message) => {
ws.send(message);
});
});
await page.goto("/");
await expect(page.getByRole("link", { name: "Let's start configuration" })).toBeHidden();
await expect(page.getByText("Not connected to a server.")).toBeHidden();
await expect(page.getByTestId("loadpoint")).toBeVisible();
});
test("show no config screen while startup", async ({ page }) => {
await page.routeWebSocket("/ws", () => {
// connect, but don't send any messages
});
await page.goto("/");
await expect(page.getByRole("link", { name: "Let's start configuration" })).toBeHidden();
});
test("show offline when websocket is closed", async ({ page }) => {
await page.routeWebSocket("/ws", (ws) => {
ws.close();
});
await page.goto("/");
await expect(page.getByText("Not connected to a server.")).toBeVisible();
await expect(page.getByRole("link", { name: "Let's start configuration" })).toBeHidden();
});