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.
33 lines
1.9 KiB
JavaScript
33 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;
|
|
const sr = () => c.shadowRoot || c.renderRoot;
|
|
// 1) первый запуск: базлайн засеян молча, точек нет
|
|
out.baselineSeeded = Array.isArray(c._serverCfg.settings.known_devices) && c._serverCfg.settings.known_devices.length > 0;
|
|
out.noDotsOnFirstRun = sr().querySelectorAll('.newdot').length === 0;
|
|
// 2) в HA появилось новое устройство
|
|
const h = { ...c.hass };
|
|
h.devices = { ...h.devices, d_new: { id: 'd_new', name: 'Brand new plug', model: 'Smart Plug', area_id: 'kitchen', identifiers: [['demo', 'd_new']] } };
|
|
h.entities = { ...h.entities, 'switch.newplug': { entity_id: 'switch.newplug', device_id: 'd_new', platform: 'demo' } };
|
|
h.states = { ...h.states, 'switch.newplug': { state: 'off', attributes: { friendly_name: 'Brand new plug' } } };
|
|
c.hass = h; await c.updateComplete; c.requestUpdate(); await c.updateComplete;
|
|
out.flagged = c._serverCfg.settings.new_device_ids?.includes('d_new');
|
|
out.dotShown = sr().querySelectorAll('.newdot').length === 1;
|
|
// 3) существующие не флагуются
|
|
out.onlyOne = (c._serverCfg.settings.new_device_ids || []).length === 1;
|
|
// 4) открытие редактора снимает флаг
|
|
const dev = c._devices.find((d) => d.id === 'd_new');
|
|
c._setMode('devices');
|
|
c._openMarkerDialog(dev); await c.updateComplete;
|
|
c._markerDialog = null; c._setMode('view'); await c.updateComplete;
|
|
out.ackCleared = !(c._serverCfg.settings.new_device_ids || []).includes('d_new');
|
|
out.dotGone = sr().querySelectorAll('.newdot').length === 0;
|
|
// 5) known растёт, повторно не флагуется
|
|
out.stillKnown = c._serverCfg.settings.known_devices.includes('d_new');
|
|
return out;
|
|
});
|
|
checkAll(res);
|
|
await finish(browser, res);
|