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.
47 lines
2.6 KiB
JavaScript
47 lines
2.6 KiB
JavaScript
import { launch, checkAll, finish } from './serve.mjs';
|
||
const { page, browser } = await launch({ width: 640, height: 980 }, 2);
|
||
const res = await page.evaluate(async () => {
|
||
const out = {};
|
||
const c = window.__card;
|
||
const sr = () => c.shadowRoot || c.renderRoot;
|
||
c.hass = { ...c.hass, locale: { language: 'ru' } };
|
||
await c.updateComplete;
|
||
// заливка temp вкл → класс filled и тултип с температурой
|
||
c._serverCfg = { ...c._serverCfg, spaces: c._serverCfg.spaces.map((s) => s.id !== 'f1' ? s : ({ ...s,
|
||
settings: { show_borders: true, show_names: true, fill_mode: 'temp', temp_min: 20, temp_max: 25 } })) };
|
||
c._regSignature=''; c._maybeRebuildDevices(); c.requestUpdate(); await c.updateComplete;
|
||
out.filledClass = sr().querySelectorAll('.room.styled.filled').length; // только living (термометр)
|
||
out.unfilled = sr().querySelectorAll('.room.styled:not(.filled)').length;
|
||
// тултип комнаты: средняя температура
|
||
const room = sr().querySelector('.room');
|
||
room.dispatchEvent(new MouseEvent('mousemove', { bubbles: true, composed: true, clientX: 200, clientY: 200 }));
|
||
await c.updateComplete;
|
||
out.tipTemp = c._tip?.temp;
|
||
out.tipHasTempLine = (sr().querySelector('.tip')?.textContent || '').includes('средняя температура');
|
||
c._tip = null;
|
||
// диалог: радио заливки, компактные поля, ширина
|
||
c._openSpaceDialog('edit', 'f1'); await c.updateComplete;
|
||
out.fillRadios = sr().querySelectorAll('input[name="fillmode"]').length;
|
||
out.tempInputs = sr().querySelectorAll('.temprange .tempin').length;
|
||
out.dialogWide = !!sr().querySelector('.dialog.wide .srcrow');
|
||
out.dialogWidth = Math.round(sr().querySelector('.dialog').getBoundingClientRect().width);
|
||
// NaN-защита: пустой ввод не ломает границы
|
||
const before = c._spaceDialog.tempMax;
|
||
const fakeEv = { target: { value: '' } };
|
||
// симулируем input с пустым значением через обработчик радио-строки — парсер должен сохранить старое
|
||
const n = parseFloat('');
|
||
out.nanGuard = !Number.isFinite(n) && c._spaceDialog.tempMax === before;
|
||
return out;
|
||
});
|
||
await page.screenshot({ path: '/tmp/ux_dialog.png' });
|
||
// значения зафиксированы прогоном на v1.43.1 и сверены с кодом (audit T1)
|
||
checkAll(res, {
|
||
"filledClass": 1,
|
||
"unfilled": 3,
|
||
"tipTemp": 22.4,
|
||
"fillRadios": 5,
|
||
"tempInputs": 2,
|
||
"dialogWidth": 502,
|
||
});
|
||
await finish(browser, res);
|