Testing and CI¶
Every pull request is checked on GitHub Actions before it is merged. Most of the checks exist because a mistake of that kind once reached a release, or could have without anyone noticing: the TV gives little feedback when something is wrong, and Home Assistant and the TV's own browser fail quietly.
On every pull request¶
test-apphosts.js checks old jail copies, launch resets, new jails and
recreated etc directories, missed watches, atomic writes, symlink refusal,
write failures, file modes and restoring marked copies when blocking ends.
It covers restrictive umasks, short writes, descriptor and temporary-file
cleanup after a partial write fails, and restoration retries both when blocking
ends and at startup with it off. Rechecking stops once restoration succeeds.
Metadata failures (EIO and EACCES) at the jail, etc and hosts file keep
restoration pending without delaying other jails; missing paths (ENOENT
and ENOTDIR) do not keep retries running.
Unreadable jail-root metadata leaves the active fallback running.
Initial source read failures (EIO, ENOENT), empty files and incomplete
tables recover through the fallback with blocking on or off, without changing
jail copies before recovery. Successful restoration stops the recovery timer.
It checks real filesystem notifications as well as injected watch events
(on macOS with a 1 s recheck behind them, as FSEvents can drop an event that
comes just after a watch starts),
including etc and jail resets that reuse their inodes, and verifies that callbacks
arriving after shutdown cannot restart watching.
test-audiolevels.js feeds audiolevels.js generated tones in place of
arecord, through init: a 100 Hz tone fills the 80-160 Hz band and not the
2.5 kHz one, bass that comes and goes counts beats, a second of quiet reads
silent, capture runs on the "App" capture device and stops once nobody asks,
a failed start waits before trying again, and a TV without the device says
so and starts nothing.
test-beattrack.js feeds beattrack.js frames of a 120 BPM bar (kick on
each beat, clap on 2 and 4, hats between, a crash on 1): the tempo is found
within 1.5 BPM, the beat clock within 25 ms, beat 1 and the claps in the
pattern where they are; bars without bass are a breakdown counting down to a
phrase line with the tempo held, the bass coming back is a drop, a bar
without bass is neither, and a tempo locked at half moves up once the kick
lands on every beat.
test-privacy-apphosts.js exercises the real synchronizer with simulated
mounts: clock sync both before and after mounting, tier and custom-list
changes, learned countries, update-only blocking, disabling and a failed
mount. It never runs a mount command. Debounce and fallback timings come
through init; the filesystem checks wait for the changed file.
test-picture-export.js checks the read-only picture export through the LG
settings module and the HTTP handler: values kept as read, keys the TV left
out omitted, the per-app settings read for the app on screen and left out
without one, context, authentication, controls disabled, rejected methods and
read failures. It asserts that only one current-picture read is made per
export, without writes or cache invalidation. test-picture-export-ui.js
checks the web download and its file name, duplicate clicks, object URL
cleanup and error handling; it runs on Node 8
and later, where the web dashboard's JavaScript parses.
test-privacy.js checks that mtalk.google.com is sinkholed on IPv4 and IPv6
only in the Everything tier, and stays out of the Ads & telemetry and off tables.
Regional platform checks cover the reported German and European hosts,
ThinQ's hyphenated prefixes, a country outside the fallback list and an
unknown or invalid country. They check IPv4/IPv6 blocking only in Everything,
without duplicate names, and leave connectivity checks unblocked.
The reported UEI, OCP, content CDN aliases and Google's
FCM provisioning endpoint are covered on both address families only in
Everything; shared Google service hosts, including www.googleapis.com and
clients1.google.com through clients4.google.com, stay out. The
nextlgsdp.com, ibs, ibsstat and known WiseLG platform and CDN names,
including dev-ruc-ngfts.tv.wiselg.com, wait for clock sync, then enter the
table on both address families. AirPlay's MFi key check is skipped, through /tmp/mfi_key_requested, only while the table blocks the TV's country's time server: with Everything once the clock is set, not with Ads & telemetry or before the clock, a file left by the daemon gives way to the directory, and switching off removes Glasshouse's folder but leaves one still holding another tool's. Other blockers' sinkholes are carried over
from a file Glasshouse did not write and from under the table's own # Kept
from /etc/hosts header, including with only TV updates blocked, and stay when
a tier is switched off while the tier's own names go.
Content Store interface and recommendation hosts are blocked on both address families only in Everything, before and after clock sync. Tests cover bare hosts, the saved country, uppercase country codes, missing or invalid country fallbacks, and the absence of unselected countries and LG region prefixes. The privacy/app-hosts integration check verifies that tier and country changes also replace these entries in running app copies.
Additional domain coverage checks advertising, ACR and APM hosts on both tiers,
and Home, ThinQ and LG Channels dependencies only in Everything, on IPv4 and
IPv6. SmartAd country entries follow the saved country. SDP macro-regions,
WiseLG's RUC name and documented country7 variants remain reachable until
clock sync; tests cover US, Australian and German settings, uppercase codes,
missing or invalid countries and the omission of undocumented variants.
The integration check verifies that the new service and clock entries reach
existing jail copies, leave them on a tier change and follow a country change.
test-appdns.js checks that an app's DNS servers are written into its jail's
resolv.conf, written again when a watch sees the jailer's copy, taken out
again for the TV's, and set at start for a jail made later; that the boot
hook's copies in appdns/ follow each change; that only installed
apps with a jail are offered; and that addresses are checked, three at most.
test-doh.js checks the DNS server that sends lookups on over HTTPS: a query
over UDP and over TCP goes on with ID 0 and comes back with its own, a failure
comes back as SERVFAIL with the error kept, an answer too long for UDP sends
the resolver to TCP, and an address no longer used is closed.
test-appdns-ui.js runs the Apps tab's renderer for it on Node 8 and later:
hidden without app sandboxes, a row per app with its servers escaped, the
editor filled in, and a refused address shown beside the field.
test-remotebattery.js checks LG's mrcu/getDeviceInfo responses (numeric and
stepped "HIGH" / "MID" / "LOW", which take precedence over Bluetooth),
Bluetooth GATT fallback on webOS 9 and 10 when getDeviceInfo returns "-",
short and full service UUIDs, missing or unreadable battery characteristics,
unavailable service enumeration, mismatched or ambiguous paired remotes,
disconnect cleanup, read throttling, and readings cached by Bluetooth address.
test-remote-battery-ui.js runs the dashboard's Magic Remote card renderer
against its markup on Node 16 and later, checking that the card is hidden when
no reading is available, shows the percentage and last-read time when present,
and renders 0% and standby/connected states.
test-audio.js exercises the public audio endpoint with captured G3/Marantz
declarations: receiver formats remain separate from TV capabilities, an eARC
EDID flag does not promote ARC, stale driver values do not become live audio,
and corrupt or missing evidence remains unknown. Additional driver-fallback cases
verify both Realtek (Connect=HDMI0 with kHz SamplingRate=48) and
HDMI_PORT* (Hz SamplingRate=48000) incoming HDMI audio. A named read of the sound output
wins over a stale whole-category read, and a refused one leaves the category's
values. Synthetic C9 cases cover dimension.input, HAWK2's native EDID, invalid
checksums/lengths/bytes, failed native reads without family fallback, and
omission of unspecified, disconnected or unstable channel metadata. They check
logical input parameters and that native-app playback never reads an arbitrary
HDMI port. Channel metadata does not establish a codec, playback or eARC
negotiation. Additional C9 cases identify one connected CEC audio system when
the ARC service is unavailable; failed, disconnected, non-audio, negative ARC
flags and ambiguous devices do not choose a receiver. Explicit inactive ARC
state remains inactive despite CEC presence. test-audio-detection-ui.js checks
receiver naming, escaping and the distinction between device detection,
unknown live status and negotiated transport.
The suite also checks that wrong targets, unverified helpers, read-only mode and cross-origin requests cannot launch the privileged helper. On a mocked OLED83G54LW with the native package, it checks that HD payload is reported only with every readiness signal, that leftover changes ask for restoration, that a receiver or link not fit for the mode is refused before the controller runs, and that a failed or incomplete disable is not confirmed. Hardware qualification of a DTS override still requires a source-to-receiver trial.
The dashboard check opens both Audio tabs: the sound settings come first and are gone from the TV app's System tab, experimental forwarding asks for a second OK to enable and stops in one, and unsupported, read-only and failed-read states offer no override. Helper writes are intercepted in the browser; this does not qualify forwarding on hardware. Both tabs render C9 source channel metadata separately from incoming audio. The web tab also rejects a late pre-change snapshot, removes stale controls after a failed read and restores them after a successful retry.
test-lgsettings.js checks that picture writes refuse hidden settings and
inactive choices, alongside locked rows and values outside the TV's range, and
that a TV which describes none of its picture settings is offered none, and
that colour management follows Colour adjustment where the TV offers User
Selection and is greyed out in Game mode. Sound settings read again by name
win over the whole category's, only keys the whole read returned are named,
and a failed named read leaves the category's values.
The TV dashboard check adjusts two picture sliders before the first write answers. Both changes must be sent, including when the first write is refused or its connection fails. With no picture settings offered, neither dashboard shows the Picture tab.
checks.yml runs these on each pull request and each merge to main.
| Check | What it catches |
|---|---|
check-es5.py |
Newer JavaScript in the on-TV server or the TV app. webOS 2 runs node 0.10 and webOS 4 (the B8) 0.12, where it is a parse error and the server never starts. |
Modules parse |
A syntax error in tvweb.js or a server module. |
check-ui-ids.py |
An element the dashboard's script reaches for that the page no longer has. |
check-module-calls.py |
A call to something a server module no longer exports, such as a caller left behind by a rename. TypeScript reads it as any in JavaScript, so only this finds it. |
check-strings.py |
Dashboard text without a translation key, English joined from pieces with +, and translations made from English that has since changed. Translating the dashboards has the rules. |
check-screensavers.py |
Screen saver QML that the TV's QtQuick version cannot load, entityList manifest bounds, and placeholders (level, stats, choice, ha, ha-list, color) a folder's uses does not name. |
check-drift.py |
The entity reference out of step with the entities the server publishes, and a dashboard file missing from deploy.sh's list, which would never be installed. |
check-entity-stability.py |
A Home Assistant entity from the last release that has gone, been renamed or changed domain, which leaves it unavailable and stops every automation that used it. A deliberate removal is listed in scripts/retired-entities.txt with the reason. |
shellcheck |
Mistakes in deploy.sh, tvwebctl, the boot script, check-all.sh and tv.sh. |
TypeScript |
Type errors, from the JSDoc types in the server's JavaScript. |
check-entities.py |
A Home Assistant entity reading a field the TV's telemetry does not have, checked against a B8's real telemetry. A field read with a fallback (else, or or another field) may be absent. |
check-upgrade.js |
A release the updater already installed on a TV would refuse. The updaters of the latest release and the oldest still in use install the change in place, from a local copy, as a TV does when it updates; 0.82.0 and 0.82.1 could not be installed that way (#586). |
Package build |
The Homebrew Channel .ipk still builds, and passes the Homebrew Channel's own compatibility check for webOS 2.2 and later, the oldest confirmed (a 49LF632V). |
Unit tests |
Each part of the server, and one suite that starts the whole server against a fake TV and MQTT broker, with a TV that answers, one that answers late, wrongly or not at all, MQTT disabled, and a Glasshouse Home file missing, and checking the dashboard keeps answering and telemetry keeps flowing. |
No unit test runs a TV's own commands on the computer it runs on. A module
that restarts LG's services, such as apps.js and samrescan.js, takes the
function that runs them from its init, and the tests pass one that records
the command instead: run for real, the sam restart in test-apps.js asked a
Linux computer for a password and could end a Mac's own processes (#918).
On each supported TV's node¶
The unit tests run on node 0.10 (webOS 2, a 49LF632V), 0.12 (webOS 4, the B8), 8.12 (webOS 6), 16
(webOS 9, the C2), 20 and 24, each in parallel in the tv-node job. A computer's node
accepts calls an older one lacks.
Now and then a unit-test job's runner stops answering: the job is cancelled at 10 minutes and GitHub keeps no log of it. So while the tests run, scripts/ci-heartbeat.sh copies run-all's status line, which run-all writes to RUN_ALL_STATUS at each suite's start and finish, into a check run of its own on the commit, "Test heartbeat (Node …)", at most every 10 s, which keeps it to about 35 API calls a run. It is created finished, as neutral, so it never shows as pending, and its title is the last status posted, with the machine's process count, load and free memory, and the time and a link to the run in its summary. For a job that froze, that names the suites running when it did. A pull request from a fork has no token to post it with, and runs without. The heartbeats of the runners that froze last showed tvwebctl running, beside server-boot or on its own. That suite drives the real watchdog, which finds what to stop by pid file and by pattern across every process it can see, so CI leaves it out of run-all (TEST_SKIP=tvwebctl) and runs it in a step of its own, in a process namespace (unshare --pid --mount-proc) where it sees and can stop only its own processes. Its release of LG's Home is a stub there (TVWEB_RELEASE), so the runner never runs the TV's. The step runs as root, which the runner cannot stop at the job's time limit, so timeout ends the suite after 150 s and lists the processes left with what each waits on, and each tvwebctl command it runs fails it after 30 s.
So the tests run on node 0.10 as well, and use none of what it lacks: no
execSync, spawnSync, fs.mkdtempSync, zlib's sync calls or Buffer#equals
unless a fallback is in place. test/test-syslog.js and test/test-logs.js
make temporary folders without mkdtempSync, and test/test-installer.js
gzips without zlib.gzipSync. The suites that run the repository's own scripts
through execSync, test-module-calls.js, test-tvwebctl.js and
test-remote-worker.js, skip on node 0.10.
Some of what node 0.10 lacks only fails when the call is made, on a TV. It
takes 'inherit' only as a child's whole stdio, not in the list, which kept
the remote's buttons from reaching Home Assistant on webOS 2;
test-spawn-stdio.js fails on one in the server's code.
test-installer.js checks that Glasshouse's own package install holds the
restart and install guards, then releases both before reporting success or failure.
test-remote-worker.js runs the remote-button worker's Python tests
(test/test_remote_buttons.py) under Python 3: a disconnected device and one at
EOF are dropped rather than read in a busy loop, a device with nothing to read
yet is kept, a device that comes back is reopened and its buttons arrive, and
pointer movement is reported at most once a second.
The worker itself stays Python 2.7 compatible for the TV.
Remote-key log checks include the first press immediately after assigning a key: the reader polls from its saved byte offset, so the press is not lost before its first read.
test-repo.js checks declared source URLs from the Homebrew Channel and added catalogs, including missing, malformed and unsafe addresses, GitHub downloads mapped to their repository, and other .ipk downloads omitted without changing installation URLs. test-catalog-ui.js checks source-link escaping, new-tab attributes, placement beside the primary action using the idle pill style, and availability across app states and disabled controls in both lists, including corrected and omitted download links.
test-saver-manifests.js reads screen saver folders, checks that brightness keeps the Bright and Dim levels at 100% and 65% with a layer between and below, the order and ids, a folder with something wrong listed with the reason, staging, the stats and audio addresses a built-in is given, translated names, and what one added on the TV does past the screen. An installed homebrew app's screen saver is listed from its app, by either file name, with the same checks, an app without one is left out, only its QML is staged, and one whose app has gone counts as LG's.
test-homeassistant.js checks /api/homeassistant, the one answer a screen saver gets for all the values it declares: that it takes the token every other read takes, that it reads each declared entity once and answers with only those, under the saver's own short names and with no calendar, that the staged QML is handed the single address with the token and no placeholder is left, that a saver which declares nothing is served nothing without asking Home Assistant again, and that an API switched off is reported as unconfigured rather than retried.
test-screensaver-showing.js checks that a switch made while a screen saver is on screen closes it with Back before sam rereads the app and asks for the new one only after, that one which will not close leaves the switch undone, and that tvpower stuck at Screen Saver Ready is reported as stuck. test-screensaver-shadowed.js checks that the start-up clean-up leaves a staged screen saver alone while it is mounted over LG's app, even when the app saver it names reads as gone, and still clears one that is not mounted. test-screensaver-video.js checks that on a TV whose stock screen saver is Flutter a screen saver that plays video puts the app in screenmanager's manual mode, asked for again until screenmanager answers, that an app's other QML files count for this without being staged, but not those in its node_modules or past the limit on entries looked through, that any other and LG's own put it back to auto, and that a TV whose stock one is QML is not asked. test-screensaver-choices.js checks that a screen saver's options are listed under their groups, and that the one picked is filled into its QML and an unknown one is its default.
test-remote-buttons.js checks the codes of the buttons reported to Home Assistant, that the Python worker that reads the devices has the same codes as remotebuttons.js, and that the Remote Button entity declares every reported button as an event type. test-remotekeys.js also checks that Power off requests standby once on release, works with the panel blank, and does not switch off after a press that wakes the TV; test-remotekeys-webos11.js checks that native filters neither offer nor accept it. test-remotekeys.js checks that the Home Assistant choice is offered only with MQTT on and for those buttons, and that the filter keeps a key set to it from the TV. test-remotekeys-webos11.js also checks active regional streaming buttons (Ivi, Okko, Kinopoisk and LG Shop), app assignment, disabling and restoring each original entry without changing other buttons.
test-screensaver-dropped.js covers a refused request's fallback, remote dismissal and restart recovery, failed closes, delayed replies, and playback or source changes that must prevent a launch, that a video screen saver the TV ends within 6 s of starting it, with no key since, is launched again directly where LG's screen saver is Flutter, and not after a key, after longer, for one without video or on the QML runner, and that the pointer moving or clicking ends a Glasshouse screen saver the TV started, once for a stream of movement, while LG's own is left to end itself. test-remote-buttons.js checks that Home, coloured buttons and ordinary keys reach the dismissal handler through both parsed events and the worker stream, including split lines, and that pointer reports reach their handler.
test-services-account.js checks that LG Account is offered only where webOS 10's service block list is, that switching it off adds it to that list beside LG's own entries and switching it on or uninstalling takes it off, and that it is added again at start if gone.
test-saver-entity-slots.js checks that a Home Assistant screen saver's entity slot declared blank, as Ambient's are, is saved, labelled and cleared, and that a slot the screen saver does not declare is refused.
test-home.js also checks that AV and Component inputs, as a 32LM637B reports them, are listed beside HDMI with their connection and open through their own apps, and that Screen Share opens Home Hub's guide where Home Hub's script has it, and is not offered elsewhere. test-homebar.js checks that choosing Glasshouse Bar gives LG's Home its place back, installs its app and points the Home key at it, then keeps it preloaded, that a refused Home key removes the app again, that it is not offered where the input bar is not, and that switching it off gives the Home key back and removes the app. It also checks that a remote key set to open the Bar keeps it preloaded, and that its app stays when the Bar stops being the launcher while a key opens it.
test-home.js also checks that a port whose tile changes once a CEC device on it is listed has the view draw its tiles again, and that the tile drawn before still opens that port, and only that port.
test-bootwake.js checks that LG's bootd config is copied with the Wake-on-LAN reasons opening Home, written again when LG's changes, left alone where it already maps them or someone else's file is in place, and removed again only when written here.
test-home.js also checks that apps take card icons from the card icon folder by title, or by a part of their app id only where the title has it, or the one chosen for them, that only names an app title can match are listed or served, that the card and pulse switches are saved only when sent as true or false, that the sound as focus moves is one Home has and that the two it ships with are there, that card transparency keeps to steps of ten from 0 to 90, and that card icons and the own sound uploaded from a dashboard are held to a card icon name, a PNG of at most 1280 × 720, and an OGG, WAV or MP3 file, that a new sound replaces the last whatever its kind, and that removing an icon clears any app's choice of it.
test-home-save-ui.js checks that a save on the dashboard's Home tab that ends in an error leaves the tab able to save the next change.
test-home-video-idle.js checks that Home's video background fades out and lets the video go after two minutes without a key, that a key plays it again, and that with the TV's screen saver time known it plays until that time and then asks for the screen saver; test-home.js that the heartbeat brings that time from LG's settings and that the screen saver is started only with the view in front and the TV awake.
test-home.js also checks the lines and the board beside the clock: lines from entities chosen on the dashboard are read through Home Assistant at most every 30 seconds and kept when a read fails, and lines and a board Home Assistant pushes are capped, cleared by an empty push and not shown without MQTT. test-news.js checks the news feeds: titles read from RSS 2.0, RSS 1.0 and Atom, decoded and stripped of markup; feeds kept to three http or https addresses; each read every 10 minutes at most, 2 after a failure, keeping its last headlines; and the feeds' headlines taking turns.
test-home.js also checks that an input keeps its hiding, place and custom name whether the TV lists the device on its port or not, and that with two devices on a port neither takes a setting kept for the port.
test-nosignal.js checks that the No Signal screen is patched for both plain and disconnected cable icon modes only where the expected QML lines are there exactly once, that switching it on mounts the copy and restarts the input app only once no input is in front or the one in front has nothing coming in, that switching modes while mounted updates Screensaver.qml in place from LG's saved copy, that a server start leaves a mounted copy alone, and that switching it off unmounts it.
test-idlesaver.js checks that an idle screen saver refused by panel care is asked for again without its hold, and that the hold is put back when it closes or is still refused, but not over an app that has come to the front since. An app that still refuses it is not lifted again until another app is in front or the TV leaves On. Failed restores are retried, a lost policy reply remains tracked, and a server restart recovers an outstanding lift. Delayed idle callbacks respect later power changes, and a dashboard lift expires if no screen saver starts. Its own request's refusal, playback (non-preview app video on the main screen included while the media state reads idle, while Home, broadcast and inset tile previews still lift it) and a TV without setEplAppInfo are left alone. The assertions run on Node 0.10 and 0.12 as well as newer versions.
test-luna-absent.js checks that a failed call to an LG service missing from the TV's service files makes later calls to it fail at once, for 10 minutes, while listed services and homebrew ones keep being called, and that a renamed service the TV lists only by its legacy name moves to that name after no answer under the newer one, rather than being skipped. test-luna-missing-method.js checks that a method the service answers "Unknown method" for is answered with that refusal, without a call, for 10 minutes, each caller getting its own copy, that the service's other methods and other refusals are still asked, and that it is asked again after the 10 minutes.
test-luna-slow.js checks that the tuner's channel list, 4.6 MB and 3.6 s on a satellite TV, is given a longer wait and a larger reply limit and is asked for without -f, while other calls keep their 2 s wait and -f.
test-weather.js checks Open-Meteo's weather codes against the badge's conditions by day and night, place searches kept to usable results at four decimals, an unknown language asked in English, and °F asked for only for a place in a country that uses it. test-home.js also checks the remote battery badge each Remote battery choice sends, a step remote's High, Medium or Low sent as that step and low at Low, and the setting offered only with a remote paired whose read has not given up as unsupported; test-remotebattery.js that a step is kept beside its level and across a restart, a saved file from before steps were kept included. test-home.js checks that the internet weather is asked for only with a place chosen and the screen on, not again within 30 minutes, kept across a restart and through a failed request, that Home Assistant's pushes are not shown while it is chosen, and that a Weather switch saved off before the choice stays off.
test-window-state.js checks that short gaps in window focus do not publish empty remote attributes, persistent gaps do, standby clears immediately, and reconnects republish the retained state. The server boot test checks that the three SurfaceManager subscriptions start only with MQTT enabled.
The state-push suite checks keyboard_visible from the window list: pushed on change, the app under it kept as the control target, false in standby, and left out on a TV without the method. test-controls.js checks that with Glasshouse Bar chosen the dashboard's Home opens the Bar, with a press of its own, rather than LG's Home, and that remote keys go to the remote's device while the keyboard is up and that typing, Enter and Backspace reach the input method service in order, and that the Server tab's TV name is saved and applied without a restart, with empty putting back LG and the model; test-mqtt-remote.js that typed text keeps its spaces and schedules no telemetry read.
test-compat.js checks lib/compat.js: each webOS version tried, untried or not offered, the report links filled in with the TV's webOS, model, firmware and Glasshouse version, and the table in docs/tested-tvs.md saying the same as the code.
test-home.js checks that switching on has sam read the mounted app before LG's Home is stopped and switching off the reverse, that on webOS 11 an LG Home started again is stopped and the preload manager told not to keep it while the place is held, both undone with the place and neither done on webOS 9 or 10, that a switch-on on webOS 4 whose key filter will not take the Home key removes the app it installed, that on webOS 3, which has no key filters, a short Home press opens the app and a held one leaves LG's ribbon with nothing written to a key filter, and that it is not switched on there where the remote cannot be read, that on webOS 4 no starting notice holds the Home key and a press the view does not answer closes it and opens it afresh before LG's ribbon has the key, that elsewhere a short press with the view in front opens it again, which closes its folder, guide or player, and from another app leaves the opening to the TV and the page's escape when its first load fails is ignored, that the heartbeat says when the view is covered, by the screen saver or on webOS 4 by what is in front, that where eim names neither hdmiPlugIn nor connected, as on a B8, the ports' HDMI reading says which are plugged in, that on webOS 11 the view is closed and opened again once after a wake while it is in front, but not where an app was opened since, after a switch-off or on other webOS, that on webOS 10 sam rereads it on a block and release and has it as the home category's app, that a server finding it mounted with an earlier release's manifest has sam read the new one even after a restart between staging and rereading, that a refused upgrade puts LG's Home back and reports failure, that a starting notice the TV will not take leaves a switch on or off standing, that webOS 4, 10 and 11 are offered as tried, webOS 3, webOS 8 and webOS 12 untried with report links, webOS 2 untried and run as on webOS 3, and a version lib/compat refuses switched off at start and refused, webOS 3 as on webOS 4 and webOS 8 using takeover, that after a start the rows come from the lists last read while they are read again, a change among them reloading the view, that LG's files go back where sam does not take the app, the ways back to LG's Home and the return, a switch-off cut short being finished at start, what earlier builds changed being put back once, failed saves, a healthy view whose heartbeats later stop, a heartbeat check held up by a suspend that waits for the view rather than calling it hung, a switch-off that ends the check, and the weather Home Assistant pushes kept across a restart, capped, hidden once 3 hours old and cleared by an empty push, with the Weather switch on until switched off and saved, a short Home press that brings no heartbeat: WebAppMgr started and the view opened again where it is not running, as for a view that stops beating, LG's Home given its place where it will not start, or where it is running once the longer wait for a page still loading is over, the view kept where it answers within that wait, and nothing done when the view answers. It also checks that a view gone quiet behind another app's window is left alone, that on webOS 6 an input put back over LG's Home just after sam restarts has LG's Home opened again once, and that a C1's 6.4.0 answer of no defaultApps at all reads as unset. A short Home press followed by an input opened from the view, or by anything else coming to the front, keeps Glasshouse Home. A view opened after a wake or by the boot hook whose page never runs gives LG's Home its place after the short wait, one whose page runs only after the longer wait, and one that answers, or an input chosen meanwhile, keeps Glasshouse Home. It also checks that the wallpaper's darkening is 100% until set, taken from 0 to 100 and kept when not sent, that a Glasshouse Home switched on fresh is Pure white while one that saved the view's own look keeps it, that LG's layout is left alone unless the empty one is chosen, that the choice applies at once while Glasshouse Home has the place, that a TV an earlier build left on the empty layout keeps it, that LG's notifications and search are on the Apps row, marked as opening over Home, that fading and leaving out inputs with nothing plugged in stay off until switched on and outlast a reset, beside inputs hidden one by one, which are kept, and that a row set to Last opened puts what was opened last first, from the view or the remote, with the channel Live TV was on even when the view asks before Live TV has left, records nothing while Glasshouse Home is off, and forgets a row put back in its own order. test-tvwebctl.js also checks that a third restart in ten minutes gives LG's Home its place back. test-remotekeys.js checks that a mapping which could not be deleted is reported as a failed change, and that the starting notice holds Home for 90 s after the filter loads, and not at all without the compositor's timer. test-remotekeys-webos11.js checks webOS 11's path: LG's input switcher offered first as a choice of its own and set like an app, the streaming buttons LG has switched on, Guide, Home Hub and the ? button offered with no filter chain and left out of the JavaScript filter, the ? button refusing Nothing, the AI button switching LG's voice assistant off and back on and answering its log line once, read from a log that is appended to and replaced, and not offered without that service, the Netflix button set to Screen off switching LG's app off and turning the screen off from the log only with the picture on, after tvpower has finished a change or a screen saver the press ends has gone, and set again unasked after LG writes its list back, Screen off refused on Guide, the Alexa button blocking Amazon's view and releasing it, an already blocked view counting as blocked, a view the TV will not block (a C3, #1498) leaving the rest of the write and the starting notice standing and the button no longer offered, toasts switched off for the Alexa press only and back on at the start after a restart, LG's list set again after LG writes it back, after a power change where nothing is announced, and at most twelve times a minute, each change written to LG's own value and only that one, LG's value put back for As LG has it, a key set again after LG sends its list again with LG's newer entry kept to put back, restore putting back every key, and nothing written while no key is set. test-tesseract.js checks the tesseract screen saver's geometry: 16 corners and 32 edges along one axis each, rotations that keep distances, a six-hour clock that starts again without a jump, and the figure staying on screen through the whole cycle.
test-remotekeys.js checks that the input bar is offered only where allowed, has its app installed before a key is saved, refuses the key when the install fails, has its app removed when no key opens it, by dropInputBar and by restore, and that the filter hands a press to the bar as Right while it is in front rather than opening it again. It checks the same for Glasshouse Bar on a key: offered where the bars are, its app installed first unless the Bar is the launcher, a number with each press as the Home key opens it, and its app removed when no key opens it, unless the Bar is the launcher, and by restore. It checks for a Brightness key that the bar's app is put on the TV and opens once for each press with the level and the style, that a held key reads the level once and goes on from what it wrote, that the style is LG's unless horizontal or vertical is set, and that with no bar the key still changes the brightness, opens nothing, has the bar's app taken off the TV and put back, first, by the next style that shows one, which is refused if the app cannot be installed; test-levelbar.js that the level the bar's page asks for comes from a subscription to the backlight, from a read while that has not answered or has closed, that the subscription is stopped when no one asks and started by the next ask, that the style is read at most every two seconds, and that the four styles are the only valid ones and that the filter's part opens the bar once for each press and only where a Brightness key is set; test-inputbar.js that the bar is offered on webOS 4, 6 and 9, on 5, 7, 8 and 10 with its switch, which off sets its keys back to LG's, and never on 11, and that it is preloaded while a key opens it and the TV is on, again after each close, and tried again at most five times.
test-i18n-pick.js checks which language the pages pick: the browser's, except one translated only in part on a page it does not cover in full, and one chosen or asked for in the address on every page. A language with its region, such as pt-br, is picked whole, and only for that region.
test-home-launcher.js puts a custom launcher in Glasshouse Home's place through the HTTP routes: a single HTML file, a zip of a folder and an ipk's web app each unpacked and served with the kit first in the start page's head, the start page and title taken from appinfo.json or the page, links and macOS's extra files left out of a zip, and a web address shown in the frame with its address escaped. A zip reaching outside its folder, a native app, a file of another kind and an upload the TV has no room for are refused, keeping the launcher before them. Only a launcher kept can be chosen, Home's page and the heartbeat follow the choice, Minimal, which comes with Glasshouse, is listed first, served with the kit when chosen and never removed, removing the chosen one gives Glasshouse Home its place again, and the first release's single launcher is kept as the owner's own, still chosen. It also keeps values through /api/home/store for the chosen launcher: read back, removed with null, a missing key and a store over 256 KB refused, kept past a new upload of the launcher, and deleted with it.
test-home-picture.js reads a G3's receiver files with Glasshouse Home on screen: the signal and HDR of the input behind it, the picture mode asked for with both input and dynamic range, an empty input, and HDR from the receiver's packets (PQ, HLG, none, Dolby Vision). Only the mode for the range coming in is asked for, none without a signal, and a channel's SDR mode. It also checks that tracking runs only while Glasshouse Home, picture details and the TV are all on, that it retains an app's first video before any app plate is read, and that standby or switching either off stops it and leaves the recorded video available.
The same suite checks the preview's HDMI signal read and a channel's decoded
format through the public picture read, including SDR, HLG, HDR10, Dolby
Vision and Technicolor HDR selecting their stored picture modes, and another
broadcast's HDR context being ignored. test-home.js checks that Live preview
defaults to off and saves its choice. The browser check changes Picture details
during HDMI and channel previews, without restarting playback, rejects a late
reply after the details are disabled, and checks that switching Live preview
off releases its media source. Desktop media methods are stubbed; webOS
decoding, sound and CEC still need a real TV.
Delayed guide and catalogue replies cannot reopen a preview after OK;
a refused launch or returning to Home allows it again.
A browser check opens Glasshouse Home with each animated background and
checks that it shows, draws on its canvas and hides the wallpaper pictures,
and that Off takes it away and leaves the canvas without pixels. The upload
check opens the dashboard's Background section on None, where the pictures'
settings are hidden, and chooses Pictures, whose sets leave Black out. test-home.js checks that only the backgrounds
offered are kept, and their colours: Time of day unless chosen, a preset, or
#rrggbb of one's own.
A browser check sets up a custom launcher on the Home tab: its button opens
the section, a web address with Glasshouse Home on becomes the TV's Home at
once, the Apps and Inputs rows stay to arrange while it is in use without
Glasshouse Home's other settings, the four choices read LG Home, Glasshouse
Home, Glasshouse Minimal and Custom, Custom's settings show only while it is
chosen or being set up, and all five launcher choices (LG Home, Glasshouse
Home, Glasshouse Minimal, Glasshouse Bar and Custom) switch on a single
click, the upload is offered only where installing from a file is,
and Remove takes it away. It
then uploads a page to the real server and checks that window.Glasshouse
lists the fake TV's apps before the page's own script runs.
A second browser check covers the TV tile and the preview's options: the TV
tile previews its last channel as a broadcast preview, an app tile previews
nothing, Preview in the tile puts the preview in the tile in focus and keeps
it there when the rows are rebuilt, when picture details arrive and when the
input has no picture, where it is hidden on the tile, and Keep the preview on shows the input
last watched with the focus on Apps. A heartbeat saying the screen saver is over
the view stops the preview, and the next one without it brings it back. test-home.js checks the TV tile is first
in the Inputs row on a TV with channels, absent without them, opens Live TV,
and that Keep the preview on, Preview in the tile and Preview sound default to
off and save. Preview sound also rejects non-boolean values.
test-hostname.js checks that stats include the cached local name without
waiting for a reverse lookup. It uses real timers because stats collection
also waits for df; a simulated clock can reach the collection's timeout
before that process replies.
test-pointer.js checks pointer-event validation, batched LG text commands,
big-endian Unix-socket framing, connection reuse, shutdown, failure cooldown and
refused socket creation. Successful batches report activity once, including
scrolling; failed socket creation reports none. test-pointer-websocket.js checks the dashboard's
WebSocket upgrade, 403 refusal with controls disabled and masked JSON messages
into LG's pointer stream.
test-routes.js checks that an upload aborted before its file opens leaves no staged file, including a disconnect while disk space is being reserved. Between uploads it waits, up to 5 s, for the last one's file to be cleared, rather than a fixed time a slow runner can outlast. It also checks that the phone's setup link serves its page, i18n.js and a language file with the one-time code, the page asking for i18n.js with it, and refuses them without. And that the dashboard's stylesheet and scripts are put inline in its page whether ui.html's lines end in LF or in CR LF, as Git for Windows checks them out.
test-stats-timeout.js checks that a stats collection past its limit answers its callers with the last complete one, or the empty stand-in when none has finished, and carries on with no second collection started beside it; that expireStats does not take that fallback away; and that one given up on after 60 s answers no caller of the next.
The Home suite also checks auto-launch restoration with a delayed settings read, no write when auto launch was already off, and a refused takeover with and without an earlier hold. Wake cases cover source changes, standby, server stop and switch-off, including delayed power-on reason replies, and a wake with Quick Start+ on, where LG's own auto launch value is read and nothing is opened with Home already in front.
Home Assistant¶
home-assistant.yml builds every discovery config the server can publish and
runs each through Home Assistant's own validation (the media player's, which a
separate integration reads, is left out), then checks that the volume
entities are available exactly when the TV lets their volume be changed. Home
Assistant creates no entity for a config it rejects, and says so only in its
own log, which is how Volume and Mute went missing in 0.78.0. It also renders
every template that reads telemetry against the stats each fixture TV reported
and fails on any warning Home Assistant logs: a field missing from the payload
is logged on every message, which was tens of thousands of lines an hour with
a few TVs (#761).
The job keeps the installed Home Assistant for a week, so it runs the newest release from the first run each week, the weekly scheduled one included.
It runs when the server or the check changes, not for documentation, and weekly, since Home Assistant is not pinned: a release that starts rejecting a config shows there first.
The dashboards in a browser¶
dashboards.yml starts the real server against a fake TV, opens every tab of
the web dashboard and the TV app in a headless browser, and fails on any
script error or failed request, naming the tab. A 404 for an app's icon is
not a failure: it is how the server says an app has none, and the fake TV's
installed apps have no icon files. A function a page calls that has gone, or an
element it reaches for that has moved, breaks only when that tab opens, which
no unit test does. It runs when the server, the pages or the fake TV change.
The checks run in groups side by side, each against its own server and fake TV, since the Home checks change the layout and uploads they read back. The slowest group sets the run's length, so a new check goes in the group it shares state with, or in the shortest. CI runs them as three jobs, each on a machine of its own: tabs, the tabs of both dashboards and the TV app's checks, home, the Home view's, and motion, the scrolling and motion checks, which measure the rows frame by frame and missed frames sharing CI's processor with the others. CHECK_JOB runs one job's groups locally; without it every group runs, scrolling and motion last. Each check prints its time as it ends, and one still running after 60 s is stopped and reported by name, so a stall cannot hold a job: each job also fails after 5 minutes. The fake TV starts its children without the gaps between starts a real TV needs, and a tab is done once each address it has asked for has answered once, rather than when it stops polling, which it never does.
A check that waits for something to arrive, a reply or a tile opening, waits for it with waitUntil, up to a few seconds, rather than for a fixed time. Replies come in real time, after a faked clock has moved on, and a CI runner can take longer than a wait that is enough on a laptop: a fixed 100 ms for the preview's picture reply failed there now and then. A check that something stays off still looks after a fixed wait, so that it does not pass before the wrong state appears. A step that acts only on something that may not be there checks for it first: an action on a missing element waits out Playwright's 30 s before failing, so .catch() after one costs that whole wait, as opening a folded channel section did on every run.
For the Home view, arranging checks cover a late catalogue reply, resetting after moving a tile, and an update noticed while arranging. Picture checks cover a layout with picture details left at their default (off), the plate's single mode and OLED light, an input with no signal keeping its line level with the source's first line, a delayed reply after changing source, and a delayed reply after switching picture details off. Its service replies are simulated; the page and its timers run in Chromium.
Scrolling checks, on a row of 30 apps under the pointer, cover hovering a tile leaving its row in place, the pointer resting at the screen's side gliding the row and coming to rest when it moves away, a click held still while the row glides opening the tile under the pointer, the wheel moving the row a tile a notch and a click after it opening the tile now under the pointer, moving down a row leaving the scrolled row where it is, the keys focusing a tile in view, and the rows still gliding after Recent apps closes while its cards glide. Motion checks read the row's place every frame: a flick to the screen's side gathers speed over several frames instead of starting at full speed, the row brakes into its last tile, and moving the pointer away lets it slow to a stop. A guide check moves a channel's programme on through the minute's refresh and finds its tile left in place rather than the rows rebuilt.
A weather check finds the badge hidden until the heartbeat brings a push, then drawn with an SVG icon, the rounded temperature, city and condition, hidden again when a heartbeat brings none, and Open-Meteo's weather credited in the corner, the credit gone with the weather. A Weather setting check on the Home tab, with the place search answered by the check itself, so it never reaches Open-Meteo, shows the search only for From the internet, finds no places for an unknown name, saves a chosen place with the source, and hides the search again when switched off. A remote battery check finds the badge after the date hidden until the heartbeat brings it, then a percentage, a step remote's Medium, and Low and 15% drawn in orange, hidden again when a heartbeat brings none; its setting check shows the Remote battery row where the remote's battery can be read, saves Always from it, and finds it hidden where it cannot. Home colour checks cover custom accents matching the stylesheet's original colours, custom tile highlight fills (in both standard and Alternative views), changes and reset arriving through the heartbeat, and malformed colour values being discarded without stopping the server.
Home visibility checks delay the layout reply behind the source reply: last watched stays hidden until its saved switch is known and updates as soon as a changed layout arrives. They also cover app counts, CEC addresses, older layouts with no switches, the clock keeping its place, and with the clock switched off and the rows along the bottom, the clock hidden and the rows lower, and in Alternative View the clock right of Last watched and no row titles. test-home.js covers saving each switch, switching them back on and ignoring non-boolean updates.
The Home availability check covers a TV with neither Glasshouse Home nor LG's Home's options, which has no Home tab; one with LG's Home's options alone, which shows them, Open Home at power-on usable among them, without Glasshouse Home's switch or options; Glasshouse Home switched on, which leaves LG's Home's layout and hidden system apps out; and with live preview enabled, standalone webOS 6 keeping Preview sound, Keep the preview on and Preview in the tile visible while webOS 4 hides them. visitHomeUpDown moves along a row of apps over wider input tiles and checks Down reaches the input under the app, and Up the app over the input, not the tiles last focused there. visitHomePointerOff switches the pointer off: the cursor is hidden through PalmSystem.visitHomePreviewWebos4has the view report webOS 4.4.3 and a channel answer no signal, as a C8 does: the TV tile's channel plays asservice/webos-broadcast, and stays up once playing rather than being blanked as off air.visitInputBarBehindHomeopens the input bar with HDMI 2 last watched: under a Home screen, OK on it switches to it; on screen, OK switches to nothing.visitInputBarSwitchOnOkchecks that an arrow step switches a second later by default, and with Switch only on OK not until OK.visitHomeBarPrewarmopens Glasshouse Bar under a simulated preload: while hidden, it renders the cached row and fetches app icons without showing the window, and whenwebOSRelaunchopens it with a changed active input, it updates the.nowmarker without replacing the rendered icon DOM node; it also verifies a preload relaunch while open is ignored, a distinct keyfilterpresscloses it at once, a duplicatepressleaves it closing, and another distinctpresscancels the fade-out.visitHomeBarScrollchecks that a row longer than the screen moves a tile a notch of the wheel and back, steps along while the pointer rests at its far end, stops when it leaves, and jumps rather than glides with Smooth scrolling off.visitHomeBarIconsReadychecks that the Bar's icons are images decoded in the frame that draws them, that it keeps them beside its cached row, and that opened again with the icon server down it draws every one from what it kept.visitHomeBarTileschecks that AirPlay hidden as an app stays out of the Bar, that AirPlay only among the inputs is drawn as an input with its icon, and that Screen Share opens with Home Hub's guide parameter.visitHomePreviewSizemeasures the preview at Small, Medium and Large in both views: 356×200, 512×288 and 640×360, each with the small one's top right corner, and the rows starting below the picture.visitHomePreviewSizeDetailsturns on the picture details with a Medium or Large preview in both views: the input's name sits under the preview on the left, the details on the right without overlapping it, Last watched is hidden beside it, and the rows start below both.test-home-lg-options.jschecks the server's side: the Home tab offered for hiding system apps on webOS 3.8, and for Open Home at power-on alone, the options only sent when asked for, no tab with none of them, and hiding system apps neither offered nor switched on under Glasshouse Home.test-tile-hiding-handover.js` checks its handover to Glasshouse Home: the apps it hid hidden there, those in More apps kept, and sam never restarted for it.
The Home watchdog checks reproduce a C3's LG Guide overlay while Home remains the foreground card: multiple missed heartbeats leave Guide alone, closing it resumes hang recovery without a new heartbeat, and unfocused overlays, failed focus reads or a focus result absent from the window list do not mask a stopped view. A fresh heartbeat arriving during the focus query cancels the stale recovery attempt. The suite uses its fake clock.
For the TV app dashboard, checks verify the two-column layout geometry (the row list on the left and the hint pane on the right with non-zero dimensions and horizontal adjacency), remote D-pad navigation (ArrowDown, ArrowUp, PageDown), list translateY scrolling with the scroll arrow indicator, tab switching (ArrowRight, ArrowLeft), and that the OLED Care tab is dropped when running on a non-OLED (LCD) TV profile.
Documentation¶
docs.yml builds this site on each pull request that changes it, with every
link and section link checked, and docs-publish.yml publishes it when the
change is merged.
Releases¶
Publishing a release runs homebrew-channel.yml, which checks
that the tag matches TVWEB_VERSION, verifies the release notes have a plain
summary above ## Details, builds the .ipk, attaches it and the Homebrew
Channel manifest to the release, and records the package's sha256 in the
manifest.
A release's notes open with a short summary for people using Glasshouse, one
to three plain lines, then a ## Details heading with the full notes and their
pull requests. The Server tab, the TV app and Home Assistant's update entity
show only the summary, so it leaves out changes to the docs and the code
that people using it would not notice. Releases before 0.91 have no summary,
and show none.
Running them locally¶
From the repository root, scripts/check-all.sh runs the checks CI runs, side by side, and shows the output of any that fail. It runs npm ci only when package-lock.json has changed since the last install, and --quick leaves out the dashboard and updater checks. check-upgrade.js reads the committed tree, so commit first.
The script requires Bash on the development computer: its -nt file timestamp
comparison is supported by Bash but is not portable to POSIX sh.
scripts/check-all.sh
node test/run-all.js runs only the unit tests, twice as many suites at a time as the computer has processors (TEST_CONCURRENCY sets another number), the ones whose header says @slow first, so the longest, the server start-up at about 40 s, sets the total. Every suite at once (136) starved GitHub's 4-processor runners until the runner was lost and the job hung; the job now also fails after 5 minutes. GitHub still loses a runner now and then: the job goes silent, is stopped at the limit or told the runner lost communication, and leaves no log. Such a runner had stopped answering altogether, and did not take the cancel at the limit either, where a test that only hangs is cancelled with its log; halving the suites at once made no difference (11 lost of 156 jobs, against 10 of 162). So in CI the unit tests run in a 6 GB memory cap of their own, a systemd-run scope: a suite that runs away with memory is killed there, and the job fails with run-all naming it and the kernel's memory-kill lines printed after. A runner was still lost once inside the cap, so if they go on, memory is not the cause. A suite ended by any signal counts as failed. rerun-lost-runners.yml then re-runs the failed jobs once, including on a pull request from a fork, but only when every failed job ended that way: a test that fails or hangs leaves a log and is never re-run. Every 5 seconds it prints each suite still running and for how long: a job whose runner stops answering keeps no log, and the lines its page showed before then are the only word of what was running. Words after it run only the suites whose file name contains one, as node test/run-all.js home luna, and --times lists the slowest. A failing suite's output is printed again after the results, so the end of a long CI log shows it. A suite whose header says @shards N is started N times, each copy running every Nth step through test/shard.js; each step then sets up what it needs, as no copy sees the steps another runs. Suites whose mocks answer without real network, file or process I/O, test-home.js among them, run their timers on test/fake-clock.js: the clock jumps to the next timer whenever nothing else is left to run, so a step that waits out a 10 s grace period takes no time and can never fire short of it. Suites with real I/O wait for what they check through test/wait-for.js.
The dashboard check needs Playwright and its browser:
npm install --no-save playwright && npx playwright install chromium
node scripts/check-dashboards.js
A check that finds a problem runs once more on its own before the run fails:
one that passes the second time is listed as flaky: with what it first found,
and does not fail the run, while one that fails twice does. CI's runners are
shared and slower than a computer, so a check that times something rather than
waiting for it fails there now and then. CPU_SLOWDOWN=4 runs every page on a
CPU slowed four times, which finds such a check before CI does:
CPU_SLOWDOWN=4 node scripts/check-dashboards.js
The Home Assistant check needs Python 3.13 and the homeassistant package:
pip install homeassistant
./scripts/check-ha-discovery.py
The documentation check needs MkDocs, Material for MkDocs, and markdown-callouts:
pip install 'mkdocs>=1.6,<2' 'mkdocs-material>=9.7,<10' 'markdown-callouts>=0.4,<0.5'
NO_MKDOCS_2_WARNING=1 mkdocs build
Use NO_MKDOCS_2_WARNING=1 mkdocs serve to preview the site locally at http://127.0.0.1:8000/glasshouse/ with live reloading.
Measuring Glasshouse Home on a TV¶
scripts/tv.sh <tv> frames [key ...] measures how smoothly Glasshouse Home
runs while keys are pressed. While /var/lib/tvweb/home-trace exists, the
view records each frame, the browser's long tasks and the time its main
functions take, and sends them with its heartbeat every 5 s. The server logs
each as a home: frames line. The command creates the file, presses the keys
through the dashboard's remote 0.15 s apart, prints the lines, and removes the
file however it ends. For example, Home, a run along the Apps row, and Recent
apps opened and closed:
scripts/tv.sh 192.168.1.131 frames home wait wait right right right right right right down right right wait back wait wait back
over33 counts frames that took longer than two vsyncs at 60 Hz, and
worst is the longest, in ms. long lists long tasks, which webOS 4's
browser does not report. fn gives each timed function's calls, average and
longest ms. A gap with nothing in fn to explain it is the browser's own
work: style, layout, painting or decoding images.
Local TV emulation¶
scripts/emulate-tv.js runs the server inside a simulated TV environment with procfs, sysfs, Luna calls, installed apps, remote key filters, and recent apps mocked. It serves the web dashboard, the TV app dashboard, and Glasshouse Home locally for development and visual testing without physical TV hardware:
npm run emulate
node scripts/emulate-tv.js [--port 8080] [--model c2|b8|c3|cx|c1] [--webos 6.5.3] [--home on|off] [--open]
The models are a C2 (webOS 9.2), a B8 (webOS 4.4), a C3 (webOS 10.3), a CX (webOS 5.6) and a C1 (webOS 6.5). --webos reports another version on the chosen model, for a version no profile covers. Glasshouse Home starts switched on from webOS 7, where main supports it; --home on starts it switched on elsewhere, for a branch that adds a version. Switching it in the emulator changes nothing, since nothing is mounted. The pages run in the computer's browser, not the TV's, so the emulator does not show what an older TV's browser gets wrong. LG's pointer input is a socket in the emulator that takes the remote's Touchpad and Motion, and its terminal logs each click and, twice a second, the moves and where the cursor would be.
Home recovery checks cover a switch-off cut short, failed layout restoration and its retry, failed migration without losing the snapshot or removing the old app, closing the old app when it is left running in the background, and a missing first heartbeat when Home already has the foreground id. A refused device tile is followed by a remote input switch to check that Last opened still records the whole input. Remote-key checks cover clearing the startup notice on escape and retrying a configd write after the local map was saved. Browser checks cover pending/failed layout edits, each row's Order on the view, the Home tab and the TV app, edits attempted during an Order save and refresh, keeping unsaved moves when Order changes, clicking Order while a tile is held, first-catalogue failure, delayed readiness, the Home tab left out where Glasshouse Home is not offered, and the Apps tab's notes while it is on.
In the TV app, the Order check opens Apps, Inputs and Channels, changes each row's order and checks that Back returns to its entry. The Internet TV check also verifies that the entry's channel preview follows Last opened order. The Apps preview counts folder contents separately and shows More apps as one tile, and hidden rows are marked before opening them. The player check waits for preview playback and leases before opening it; the keys for opening before the preview's delay expires are sent together.
test-home.js also checks LG's native CEC launch contract: a receiver and a
console on the same port select their own device IDs, a direct source selects
its ID, and missing or unusable IDs and non-CEC inputs open the port alone.
Last watched on that port names the device the TV last selected there, read
fresh past the cached device list, and every device on the port when the TV
has not recorded one.
test-home-wallpaper-upload.js exercises the real HTTP boundary: rejected and interrupted uploads preserve the previous image, concurrent uploads are refused, the lock is released after an abort, an uploaded JPEG survives reinitialisation and is served with its image type, and one time of day's picture is removed alone, an unknown one refused. With the download stubbed, a chosen set is fetched from its tag and not again once on the TV, the owner's own pictures are kept while it shows, a picture that fails its checksum or download is not kept and leaves the choice as it was, and an older install's four example pictures become the landscape set while other uploads become the owner's own. The dashboard check chooses Your own, then Morning and uploads to it, preparing a PNG as JPEG, shows the pending upload in a second tab and the picture once done, drops an image on Evening, removes Morning alone and then all of them. The same test adds pictures to the shuffled collection, which the first chooses, each under a name made on the TV and served by it, an id that is a path refused; it fills the collection to its limit, has the next upload refused, and removes one picture and then all of them; test-home.js checks the interval's default and that only the offered ones are kept. A second dashboard check, visitHomeShuffle, chooses Your own, shuffled, uploads three images chosen at once one after another, saves an interval, removes one picture and then the rest, and on the view, with its clock moved on a minute at a time, sees each of four pictures once in four minutes.
test-homescreen-webos10.js checks webOS 10's Home screen layout over a stand-in folder: the banner taking the height of the rows hidden, nothing changed before the experimental switch is on, the layout put back after a restart of the TV, the banner text hidden by a copy of LG's language files with the two strings blank and LG's left alone, a black or uploaded banner picture in each size folder, an upload cropped for each shape the banner takes with the one for its shape shown and the others kept until a part shown or hidden needs them, a bad upload refused with the picture before kept, and putting LG's Home screen back forgetting the choices and the upload.
test-home-recent-apps.js exercises the recent-app HTTP routes: refused and
unconfirmed stops retain their cards for retry, unavailable running lists
report failure, Close all stops web and native apps while preserving Home,
unlisted apps and newer cards, and snapshots stay out of shared caches while an
unchanged one keeps its address and is answered with a 304. The browser
check covers held OK acting once on release, close errors above the panel,
and Back or a Home relaunch cancelling a delayed panel reply.
test-home-date.js runs Glasshouse Home's date with the browser's default locale at en-US, as on webOS 10: a Russian page gets Russian words with the month as it follows a number (24 октября), and the line starts with a capital, an English page is unchanged, a browser without formatToParts still uses the page's language, and so does a page in a language with its region. It is skipped on a node without full ICU.
test-home-search.js feeds a G3's real answer for "Dune" to Glasshouse
Home's search: one film on three services is one title, only the TV's apps
are listed, a listed title opens in its app at the id LG's item detail gives,
anything not listed opens nothing, and LG's error is a failure. With a G3's
details for Severance and The Bear, a series opens at Prime Video's first
season and at Disney+'s first episode, and with no detail a title opens at
its item id less LG's service tag. A B8's answer for "the office" is listed
by the category each title is under, its detail asked of sdp_secure when
sdp_onnow gives none, and a title opened with the id put into the app's
template, or as its contentTarget without one. From the G3's answers for promo words,
trailers, teasers and sneak peeks are never listed while Trailer Park Boys
and Trailer War are, a series never opens at a trailer numbered as its first
episode, and switched off the search asks LG nothing.
Delayed app-list replies cannot replace a newer search's launch targets, and
an empty answer removes the preceding search's targets. Partial host discovery
retries the unanswered service after a minute. Switching Search off or blocking
its host during a series lookup prevents further detail reads and the launch.
The browser check exercises search through the Home view: editing the query clears the previous titles before the typing delay, Enter waits for its reply, failed queries can be retried, and repeated OK during a detail lookup sends one launch. Returning from that app keeps the panel, a changed sleep counter closes it, late search replies cannot refill a closed panel, and switching search off removes its entry point. Home interaction fixtures mark both introductory hints as seen so hint saves do not count as layout edits.
test-iptv-parse.js feeds Internet TV's readers in chunks of every size,
from one character up: an M3U with a BOM, CRLF, a name with commas after a
quoted group with commas, #EXTGRP, #EXTVLCOPT and |User-Agent= headers,
#KODIPROP DRM, films and series to leave out, a bare URL, a multicast link
and comma lists of guide links; Xtream's JSON with brackets and escaped
quotes inside strings, and a refusal object where the list should be; an
XMLTV guide with a DTD whose entity must not expand, CDATA, numeric entities,
offsets and shortened times. Logins are refused by auth and status
whatever the HTTP status, short EPG text is decoded only when it is base64 of
UTF-8 text, a guide id matches loosely only where one guide channel does, and
two channels whose links differ only in a rotated token keep separate keys.
test-iptv-enigma2.js does the same against a stand-in for a satellite
receiver's OpenWebif behind a Basic login: a wrong login stopping at the
first request, bouquets read as groups with markers left out, a bare
host:port accepted, picons fetched with the login and kept, the guide
matched by service reference and cut at a week, a channel with no guide not
breaking the others, an edit keeping or clearing the login, no address, user
name or password in any reply, and the tuner's own takeover: a tuner showing
live TV moved only when none is free and never one that records or streams,
and the relay for a tuner whose stream port wants the login (not offered
before it is on, the login sent, a refused one a 502).
test-iptv.js runs the server module with real worker processes and curl
against a local provider: a playlist read and published 0600 in a 0700
folder, search leaving out a provider's ### NEWS ### headings, an added
channel's logo, play link and now and next from the playlist's own guide, a
500 keeping the last list, an edit replacing it, a refused Xtream login not
tried again until edited, a blank password keeping the saved one, no link,
token, user name or password in any reply, the row's order and removal, a
whole group added as a section numbered after the picks with its guide from
the Xtream xmltv.php, sections moved and given start numbers, a channel
taken out of a group staying out until added again, a rename and a star
reaching the row, a hidden group left out of a whole-playlist search, Undo
putting a channel taken out back at its number, a removed playlist's
folder deleted, and a channel whose variant playlist names FairPlay found to
be protected once checked, marked in the lineup and given no play link,
while one with a plain AES-128 key is not. It also checks a channel's saved
HLS or MPEG-TS choice across a restart, stream event logging without URLs,
and that pausing live TV is off by default, kept across a restart, and
never records a preview, an HLS channel or without a USB stick.
It is skipped where there is no curl. test-iptv-drm.js checks which HLS keys the TV's player cannot use,
and the resolving of a master playlist's first variant.
test-iptv-timeshift.js runs the recording for pausing live TV: the real
worker records a local provider's MPEG-TS packets through curl into a folder
standing in for a USB stick, with 20-packet chunks and a 5-chunk buffer, and
the test reads it back as Home's player would. It checks a writable stick is
found, the local URL carries a token and never the provider's, the provider
is asked with a player's User-Agent, another token gets a 404, every packet
arrives in order, a reconnect and a paused player go on from their place,
the buffer keeps its size, back to live starts at the live point, a rewind
past what is kept starts at the oldest packet, another
channel and an expired lease end the recording and empty the folder, and a
provider's refusal gives a 502 and direct play for that channel after, and
curl aborting before exec is started again. It also checks Home's clock for
a pause, with its unit (min or h). It is skipped where there is no curl.
test-iptv-worker.js runs real playlist workers against a local provider with
a shell that sends itself SIGABRT before executing curl. It checks that an
early abort is retried once, repeated aborts stop after two attempts, and a
partial body, ordinary network error or other signal is never retried, and
two aborts are reported as such rather than as a network failure. A
failed job leaves no partial snapshot. The native webOS libuv fault still
needs a Node 8 TV; the test injects its downloader exit signal.
test-iptv-guide-login.js runs a real guide worker against a local provider
that answers 401 without a login. A guide link with a user name and password
in it is read, the login going as HTTP Basic, and curl's recorded arguments
hold neither the password nor the address with the login in it.
test-iptv-lineup.js checks the lineup's rules alone: a version 1 selection
becoming one section of favourites, numbering through sections with a start
number already passed moved on, a channel in two sections counted once, a
channel removed from a pick ahead of its group staying out of both, the 60
favourites, stars kept by a channel another section still carries, renames,
the 2,000 cap, moved keys followed, malformed entries dropped, several
groups added or sections removed in one edit, stars for many stopping at a
full row, channels moved out of a group into a new section and added into
one, sections and single channels taken out in one edit, and a refused
edit leaving the selection as it was.
scripts/fake-iptv.js is a provider to drive Internet TV by hand or in the
emulator (it is not deployed). It serves an M3U and an Xtream panel with
the quirks above, logos in the styles real ones come in (and dead links), an
XMLTV guide, and three live HLS test channels from ffmpeg, one without CORS:
node scripts/fake-iptv.js --port 8090
node scripts/fake-iptv.js --port 8091 --channels 100000 --guide-channels 16000 --no-video
node scripts/fake-iptv.js --port 8095 --channels 20000 --groups 120 --no-video
--groups adds that many country groups (DE | Sport, FR | News and so
on), as a subscription of hundreds of groups lists them, for the channel
manager.
Its M3U takes ?mode=401, 403, 429 (with Retry-After), 500, html,
gzip, slow and truncate; a wrong Xtream password is auth: 0 with HTTP
200, three in a minute block the address for a minute, and its live links
redirect to a token that expires after 90 s. It allows one connection, counted
as a panel does, by the client address that fetched a segment in the last
12 s, so a TV changing channel replaces its own; /admin/state reports
concurrentSessions apart, the streams fetching segments in the last 4 s,
which stays at 1 when each is closed before the next opens.
/admin/rotate rotates every M3U token. The second command makes a
100,000-entry playlist and a guide of about 200 MB unzipped, for the size
drills. The emulator starts Internet TV's overdue jobs after 5 s rather than
3 to 8 minutes (iptv.catchupMs in its config).
The Home tab loads Internet TV playlist settings from assets/ui/iptv.js and
the channel manager from assets/ui/tvchannels.js; the browser check exercises
both through their page entry points.
The browser check drives Internet TV on Glasshouse Home with its API answered in the page: the row's names tidied, a channel previewed after its dwell with the lease taken, the preview grown into the player without opening the stream again, Yellow switching that player to MPEG-TS, a refused format save shown with OK to retry, a late save reply leaving a reopened player alone, OK during the dwell giving one stream and keeping the player's picture, the channel list changing channel after releasing the last stream, Back, the guide's schedule, and the add panel listing a playlist's groups. It then drives the channel manager the same way: a hidden group left out, a group's channels listed and added whole, a star, a Shift-click run added from the bar in one edit, Delete taking a selected channel out, Escape clearing a selection before it closes the page and its address, one pane at a time at phone width, and in the TV app, the groups, a channel added with OK, and Back up one list.
The sideload route check forces an upload to abort before its file opens, then confirms that the eventual descriptor closes and the staging file is removed. This catches Node 0.12's destroy-before-open behaviour without relying on the filesystem finishing within a fixed delay.
The Internet TV regression checks also cover a full 2,000-channel lineup through real workers, a bulk add that overlaps channels already carried, and failed selection saves (including Undo) without changing the lineup or its history. Home accepts unstarred lineup channels and refuses unknown ones; the generated remote filter opens the standalone Home app's guide when the Home key names it. Browser checks cover the Guide tile and now-and-next without favourites, and a delayed response from the previous provider leaving the chosen provider's groups in place. With Preview in the tile on, the browser check verifies the IPTV preview fills its tile, opens at full-screen size and returns without reopening the stream, and leaves the hidden rows when the guide opens. The TV app's manager check opens the lineup through the Home tab with Glasshouse Home enabled in its API fixture, then uses the remote keys. The audio route checks use a readable stream for request bodies, including the UTF-8 decoding used by every JSON POST. The split-character route fixture uses the server's buffer helper so it also runs on Node 0.10 and 0.12.
test-huesync-settings.js covers captured Hue Sync response encodings, native
write payloads, validation, unavailable settings, rejected and ignored writes,
control permissions, retained MQTT JSON and discovery. The streaming regression
suites retain their power-only fixtures. The fuller retail-app capture establishes the boolean write protocol, but these
mocks do not establish Glasshouse behavior on hardware.
test-huesync-events.js uses synthetic identifiers and diagnostic objects. It
covers native subscription values, privacy filtering, reconnect hydration,
read/event races, transient availability, unsupported keys, external busy and
readiness blockers, shared write serialization, delayed completion, ignored and
delayed stops, subscription teardown and polling fallback. The dashboard check
also exercises automatic-start notifications, stale controls remaining visible,
busy/read-only locking and all settings without a submenu or status paragraph. Never add the raw setup capture, pairing
codes, credentials, bridge/device IDs or real entertainment-area names to tests.
The drift check includes Hue Sync's dynamic entity IDs from the catalogue, so the documented settings rows are checked alongside static entities. Computed ID prefixes are not treated as complete entity IDs.
Home Assistant discovery validation now includes the synthetic
test/fixtures/huesync-settings.json settings. It renders all eight controls with fresh, stale and missing state and checks the select command
mappings. This covers the final templates after safe-field rewriting, where
missing JSON properties become none rather than undefined.
The Hue Sync event tests also verify that internal readiness and busy status create no Home Assistant diagnostic entities or diagnostic MQTT publications.
The saver entity slots check gives Home Assistant: Ambient's first slot an entity and expects its Label row at once, with the field still focused, then confirms a label with Tab while typing in the next field and expects that field to keep its focus and text.
The Inputs and Remote dashboard check covers Remote appearing from Control without fetching the Apps catalogue, including a TV with only Quick Access, the inputs and their switches, the Input key's choice of LG's list or the input bar, the No Signal switch, remote keys on the Remote tab and not the Apps tab, and no Remote tab on a TV with no keys to set.
Ambient Light dashboard checks cover the web page below OLED Care, the TV menu
between Audio and Screen Saver, every Hue Sync setting directly accessible, and
independent PicCap/Hue Sync switches. The
web Control shortcuts stay below Playback and share state and write permissions
with Ambient Light. Checks cover narrow/light and wide/dark layouts, native
command types, duplicate area names, failed writes, read-only/busy states and
disappearing integrations. Both dashboards check separate integration categories,
Hue Sync before PicCap, Enabled labels in settings, shorter remote labels, and
availability combinations with neither, either or both integrations. Missing integrations leave no empty
headings or shortcuts. PicCap descriptions name both Hyperion and HyperHDR.
test-dashboard-view.js also checks the TV menu order, flat row grouping, empty
state and per-field stale permissions.
The browser checks verify that all four Hue Sync boolean settings use standard
On/Off pill toggles, send native booleans and retain their confirmed state after
a refused write. Both dashboards hide the Ambient Light tab when neither
integration is available, including on deep links, and keep it for a stopped
integration. The web tab returns when an integration becomes available again.
test-routes.js verifies both integrations' write permissions. Screenshots use
synthetic data. The Hue Sync checks wait for intercepted requests to finish
before closing each page, so pending stats replies cannot outlive the page.
test-quickaccess-restore.js checks that what LG had on a Quick Access key is kept the first time it is changed and only then, that As LG has it puts it back, Quick Help on 9 among them, that restoring puts back every key changed, the owner's own choices included, and that a key changed before anything was kept gets LG's default.
test-remote-availability.js checks the lightweight Remote availability route: Quick Access needs one settings read, remote keys are checked only as a fallback, and neither path collects the Apps catalogue or writes settings.