mirror of
https://github.com/Matysh/houseplan-card
synced 2026-07-31 08:28:31 +00:00
T1: demo/serve.mjs exports check/checkAll/finish — all 48 smokes now assert named facts and exit non-zero on a mismatch or an uncaught in-card exception (verified by breaking the kiosk guard on purpose). Informational values were frozen from a v1.43.1 run and cross-read against the source; timings assert budgets, not exact numbers. T2: new CI job 'smoke' gated on 'frontend', builds a FRESH bundle before running (the committed demo/srv/assets copy is a snapshot) and uploads per-file logs on failure. T3: [auto] now means 'a named failing check exists' and each line names it (43 lines); 72 aspirational markers honestly downgraded to [manual]. Fixed the 'ZERO edit buttons' contradiction (wrong since v1.30.1) and the opening-click line (true again since v1.43.1). Three smokes carried pre-v1.39.0/v1.25 expectations and were testing old behaviour: tap defaults for lights, card-wide tap action, label drag requiring plan mode. DEVELOPMENT.md documents the harness contract.
41 lines
1.9 KiB
JavaScript
41 lines
1.9 KiB
JavaScript
import { launch, checkAll, finish } from './serve.mjs';
|
||
const { page, browser } = await launch();
|
||
const res = await page.evaluate(async () => {
|
||
const out = {};
|
||
const c = window.__card;
|
||
// счётчики вызовов тяжёлой геометрии
|
||
let pairsCalls = 0, buildCalls = 0;
|
||
const origPairs = c._computeOpenPairs.bind(c);
|
||
c._computeOpenPairs = (...a) => { pairsCalls++; return origPairs(...a); };
|
||
const origBuild = c._buildModel.bind(c);
|
||
c._buildModel = (...a) => { buildCalls++; return origBuild(...a); };
|
||
// открыть границу, чтобы pairs было что считать
|
||
const sp = c._curSpaceCfg;
|
||
const r1 = sp.rooms[0], r2 = sp.rooms[1];
|
||
r1.open_to = [r2.id]; r2.open_to = [r1.id];
|
||
c._saveConfig(); c.requestUpdate(); await c.updateComplete;
|
||
pairsCalls = 0; buildCalls = 0;
|
||
// 10 «пушей состояния» от HA без изменения конфига
|
||
for (let i = 0; i < 10; i++) {
|
||
c.hass = { ...c.hass, states: { ...c.hass.states } };
|
||
await c.updateComplete;
|
||
}
|
||
out.pairsPerRender = pairsCalls; // должно быть 0: кэш живёт между рендерами
|
||
out.modelBuildsPer10Renders = buildCalls;
|
||
// правка конфига обязана инвалидировать кэш
|
||
const before = pairsCalls;
|
||
const r3 = sp.rooms[2] || sp.rooms[0];
|
||
r3.open_to = [r1.id]; r1.open_to = [r2.id, r3.id];
|
||
c._saveConfig(); c.requestUpdate(); await c.updateComplete;
|
||
out.invalidatesOnEdit = pairsCalls > before;
|
||
// геометрия по-прежнему правильная: пунктир на месте
|
||
out.dashesStillRendered = (c.shadowRoot || c.renderRoot).querySelectorAll('.openwall').length > 0;
|
||
return out;
|
||
});
|
||
// значения зафиксированы прогоном на v1.43.1 и сверены с кодом (audit T1)
|
||
checkAll(res, {
|
||
"pairsPerRender": 0,
|
||
"modelBuildsPer10Renders": 0,
|
||
});
|
||
await finish(browser, res);
|