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.
62 lines
3.6 KiB
JavaScript
62 lines
3.6 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;
|
||
// 1) дефолт (план есть): границ и лейблов нет
|
||
out.defaultStyled = sr().querySelectorAll('.room.styled').length;
|
||
out.defaultLabels = sr().querySelectorAll('.roomlabel').length;
|
||
// 2) включаем границы+имена+заливку по свету
|
||
c._serverCfg = { ...c._serverCfg, spaces: c._serverCfg.spaces.map((s) => s.id !== 'f1' ? s : {
|
||
...s, settings: { show_borders: true, show_names: true, room_color: '#ff8800', room_opacity: 0.8, fill_mode: 'light' },
|
||
})};
|
||
c.requestUpdate(); await c.updateComplete;
|
||
out.styled = sr().querySelectorAll('.room.styled').length;
|
||
out.labels = [...sr().querySelectorAll('.roomlabel')].map((l) => l.textContent.trim());
|
||
const liv = [...sr().querySelectorAll('.room.styled')][0];
|
||
out.livingStyle = liv.getAttribute('style');
|
||
// living: ceiling on → жёлтая; kitchen: нет light-сущностей → без заливки; bedroom light off → серая
|
||
const styles = [...sr().querySelectorAll('.room.styled')].map((r) => r.getAttribute('style'));
|
||
out.hasYellow = styles.some((s) => s.includes('#ffd45c'));
|
||
out.hasGrey = styles.some((s) => s.includes('#9aa0a6'));
|
||
out.kitchenNoFill = styles.some((s) => s.includes('--room-fill:transparent'));
|
||
// 3) lqi-заливка
|
||
c._serverCfg = { ...c._serverCfg, spaces: c._serverCfg.spaces.map((s) => s.id !== 'f1' ? s : {
|
||
...s, settings: { ...s.settings, fill_mode: 'lqi' },
|
||
})};
|
||
c.requestUpdate(); await c.updateComplete;
|
||
out.lqiFills = [...sr().querySelectorAll('.room.styled')].filter((r) => (r.getAttribute('style') || '').includes('hsl(')).length;
|
||
// 4) drag лейбла → layout rl_ (только в редакторе плана, с v1.25)
|
||
c._setMode('plan'); await c.updateComplete;
|
||
const lbl = sr().querySelector('.roomlabel');
|
||
c._labelDown({ preventDefault(){}, stopPropagation(){}, clientX: 100, clientY: 100, target: { setPointerCapture(){} }, pointerId: 5 },
|
||
c._spaceModel().rooms[0], 'f1');
|
||
c._labelMove({ clientX: 160, clientY: 140 }, c._spaceModel().rooms[0], 'f1');
|
||
c._labelUp(c._spaceModel().rooms[0]);
|
||
out.labelSaved = !!c._layout['rl_r1'];
|
||
// 5) диалог: create + draw
|
||
c._openSpaceDialog('create'); await c.updateComplete;
|
||
c._spaceDialog = { ...c._spaceDialog, title: 'Attic', source: 'draw', orientation: 'square' };
|
||
await c.updateComplete;
|
||
out.saveEnabled = !sr().querySelector('.dialog .btn.on[disabled]');
|
||
await c._saveSpaceDialog(); await c.updateComplete;
|
||
const attic = c._serverCfg.spaces.find((s) => s.title === 'Attic');
|
||
out.atticAspect = attic?.aspect;
|
||
out.atticSettings = attic?.settings;
|
||
out.atticNoPlan = attic ? attic.plan_url === null : null;
|
||
return out;
|
||
});
|
||
// значения зафиксированы прогоном на v1.43.1 и сверены с кодом (audit T1)
|
||
checkAll(res, {
|
||
"defaultStyled": 0,
|
||
"defaultLabels": 0,
|
||
"styled": 4,
|
||
"labels": ["Living room", "Kitchen", "Bedroom", "Hallway"],
|
||
"livingStyle": "--room-stroke:#ff8800;--room-stroke-op:0.8;--room-fill:#ffd45c;--room-fill-op:0.180",
|
||
"lqiFills": 0,
|
||
"atticAspect": 1,
|
||
"atticSettings": {"show_borders": true, "show_names": true, "room_color": "#3ea6ff", "room_opacity": 0.55, "fill_mode": "none", "temp_min": 20, "temp_max": 25, "show_lqi": true, "label_temp": false, "label_hum": false, "label_lqi": false, "label_light": false},
|
||
});
|
||
await finish(browser, res);
|