mirror of
https://github.com/Matysh/houseplan-card
synced 2026-07-31 16:38: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.
44 lines
2.0 KiB
JavaScript
44 lines
2.0 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;
|
||
const sr = () => c.shadowRoot || c.renderRoot;
|
||
const devIcon = (id) => {
|
||
const idx = c._devices.filter((x) => x.space === c._space).findIndex((x) => x.id === id);
|
||
const el = sr().querySelectorAll('.dev')[idx];
|
||
return el?.querySelector('ha-icon')?.getAttribute('icon');
|
||
};
|
||
// 1) state-иконки: замок locked → mdi:lock; unlocked → lock-open-variant
|
||
out.lockLocked = devIcon('d_lock');
|
||
c.hass = { ...c.hass, states: { ...c.hass.states, 'lock.front_door': { ...c.hass.states['lock.front_door'], state: 'unlocked' } } };
|
||
await c.updateComplete;
|
||
out.lockUnlocked = devIcon('d_lock');
|
||
// окно: on → window-open
|
||
out.windowOpen = devIcon('d_window');
|
||
c.hass = { ...c.hass, states: { ...c.hass.states, 'binary_sensor.window': { ...c.hass.states['binary_sensor.window'], state: 'off' } } };
|
||
await c.updateComplete;
|
||
out.windowClosed = devIcon('d_window');
|
||
// лампа on → lightbulb-on
|
||
out.bulbOn = devIcon('d_light1');
|
||
// 2) display:value у термометра
|
||
c._serverCfg = { ...c._serverCfg, markers: [{ id: 'd_temp', binding: 'device:d_temp', display: 'value' }] };
|
||
c._regSignature = ''; c._maybeRebuildDevices(); c.requestUpdate(); await c.updateComplete;
|
||
const vd = [...sr().querySelectorAll('.dev.valonly')];
|
||
out.valonly = vd.length;
|
||
out.valText = vd[0]?.querySelector('.valtext')?.textContent.trim();
|
||
out.noSmallBadge = !vd[0]?.querySelector('.tval');
|
||
return out;
|
||
});
|
||
// значения зафиксированы прогоном на v1.43.1 и сверены с кодом (audit T1)
|
||
checkAll(res, {
|
||
"lockLocked": "mdi:lock",
|
||
"lockUnlocked": "mdi:lock-open-variant",
|
||
"windowOpen": "mdi:window-open",
|
||
"windowClosed": "mdi:window-closed",
|
||
"bulbOn": "mdi:lightbulb-on",
|
||
"valonly": 1,
|
||
"valText": "22.4°",
|
||
});
|
||
await finish(browser, res);
|