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.
35 lines
1.7 KiB
JavaScript
35 lines
1.7 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 calls = [];
|
||
c.hass = { ...c.hass, callService: (d, s, data) => { calls.push([d, s, data.entity_id]); return Promise.resolve(); } };
|
||
await c.updateComplete;
|
||
c._setMode('view'); await c.updateComplete;
|
||
// лампа (primary light) без явного действия → клик = toggle
|
||
const lamp = c._devices.find((d) => d.primary?.startsWith('light.') && !d.tapAction);
|
||
out.hasLamp = !!lamp;
|
||
c._infoCard = null;
|
||
c._clickDevice(new MouseEvent('click'), lamp);
|
||
out.lampToggles = JSON.stringify(calls.at(-1)) === JSON.stringify(['homeassistant', 'toggle', lamp.primary]);
|
||
// устройство с не-light primary (сенсор) → клик = инфо
|
||
const sensorDev = c._devices.find((d) => d.primary?.startsWith('sensor.') && !d.tapAction);
|
||
const n = calls.length;
|
||
c._infoCard = null;
|
||
c._clickDevice(new MouseEvent('click'), sensorDev);
|
||
out.sensorInfo = calls.length === n && !!c._infoCard;
|
||
c._infoCard = null;
|
||
// явный info у лампы отключает дефолт
|
||
const cfgm = { id: lamp.id, binding: lamp.bindingKind + ':' + lamp.bindingRef, tap_action: 'info' };
|
||
c._serverCfg = { ...c._serverCfg, markers: [...(c._serverCfg.markers || []).filter((m) => m.id !== lamp.id), cfgm] };
|
||
c._regSignature = ''; c._maybeRebuildDevices(); await c.updateComplete;
|
||
const lamp2 = c._devices.find((d) => d.id === lamp.id);
|
||
const n2 = calls.length;
|
||
c._clickDevice(new MouseEvent('click'), lamp2);
|
||
out.explicitInfoWins = calls.length === n2 && !!c._infoCard;
|
||
return out;
|
||
});
|
||
checkAll(res);
|
||
await finish(browser, res);
|