Files
serverAppConfigs/tests/homepage_pages.bats
T
Frank bad78079d7 feat(homepage): the not-open-yet apps get their own section, below AI
Calibre-Web, RomM and Seerr sat inside "Media Library Apps" carrying a WIP
badge and a "not open to family users yet" sentence each, so the household
grid mixed doors they can use with doors they cannot. They now render under
their own "Work in progress" heading, placed after AI on the user page, and
the copy drops the restated "Work in progress:" for the ask-Frank line the
section heading no longer needs to repeat.

- app.js: SECTION_ORDER.user gains "Work in progress" last.
- services.json: the three cards' section, plus one-line copy trim.
- homepage_config.bats / homepage_pages.bats: the section contract now
  includes the new heading and pins the new order (the old test pinned AI
  last, which this change deliberately overturns).
- Homepage.md: the classification list and the SECTION_ORDER/wip contract
  lines catch up (the user order in the page was already stale, and "down"
  was an undocumented wip value).

The admin page is untouched: its WIP cards (Gluetun, mariadb, valkey,
Postgres) are plumbing inside Infrastructure, not applications.
2026-11-04 13:09:16 -08:00

92 lines
3.2 KiB
Bash

#!/usr/bin/env bats
# Seam: the homepage pages (index.html, admin.html, app.js, style.css).
# A browser cannot run under bats, so the tests assert the public contract
# statically: the pages reference the data and the theme, the page does not
# auto-refresh (Q41), does not alter the user's cursor (Q28), offers the
# styling toggle (Q27), and shows the last master deployment datetime (Q43).
# Both pages render through the shared section/panel components, and WIP
# badges distinguish open from closed work.
load helpers
setup() {
BASE="$REPO_ROOT/shared/homepage"
}
@test "pages exist and reference the data and the theme" {
[ -f "$BASE/index.html" ]
[ -f "$BASE/admin.html" ]
[ -f "$BASE/app.js" ]
[ -f "$BASE/style.css" ]
for f in app.js style.css; do
grep -q "$f" "$BASE/index.html"
grep -q "$f" "$BASE/admin.html"
done
grep -q "status.json" "$BASE/app.js"
grep -q "services.json" "$BASE/app.js"
}
@test "sections and panels are shared components rendered by both pages" {
# Both pages load the same app.js; the grouping must live in shared
# renderSection()/renderPanel() components, not in per-page markup.
grep -q "renderSection" "$BASE/app.js"
grep -q "renderPanel" "$BASE/app.js"
grep -q "SECTION_ORDER" "$BASE/app.js"
}
@test "sections render as horizontal rows of panels" {
grep -q 'class="sections"' "$BASE/index.html"
grep -q 'class="sections"' "$BASE/admin.html"
# Each section's panels fill an auto-fill row, not a single column.
grep -q "repeat(auto-fill" "$BASE/style.css"
}
@test "the user page puts the Work in progress section last, below AI" {
grep -q "user: \['Web Apps', 'Media Library Apps', 'AI', 'Work in progress'\]" "$BASE/app.js"
}
@test "WIP badges distinguish open from closed work" {
grep -q "WIP: OPEN" "$BASE/app.js"
grep -q "WIP: CLOSED" "$BASE/app.js"
grep -q "wip-open" "$BASE/style.css"
grep -q "wip-closed" "$BASE/style.css"
}
@test "the page does not auto-refresh (Q41)" {
! grep -q "setInterval" "$BASE/app.js"
! grep -qi "poll" "$BASE/app.js"
}
@test "the page does not alter the user's cursor (Q28)" {
! grep -qE "cursor:[[:space:]]*(none|url\()" "$BASE/style.css"
}
@test "the styling toggle strips to bare HTML (Q27)" {
grep -q "data-bare" "$BASE/style.css"
grep -q "bare" "$BASE/app.js"
}
@test "the footer shows the last master deployment datetime (Q43)" {
grep -q "deployed-at" "$BASE/index.html"
grep -q "deployed-at" "$BASE/admin.html"
grep -q "deployed-at" "$BASE/app.js"
}
@test "the pages set a base so the /admin/ page resolves refs to the root" {
grep -q '<base href="/">' "$BASE/index.html"
grep -q '<base href="/">' "$BASE/admin.html"
}
@test "the user docs page exists and is reachable from the service pages" {
[ -f "$BASE/docs.html" ]
grep -q 'class="foot-btn" href="/docs"' "$BASE/index.html"
grep -q 'id="models"' "$BASE/docs.html"
grep -q '<base href="/">' "$BASE/docs.html"
grep -q 'style.css' "$BASE/docs.html"
}
@test "the docs route is served and shipped" {
grep -qE 'try_files /docs\.html' "$REPO_ROOT/dankclaw/Caddyfile"
grep -q 'shared/homepage/docs.html' "$REPO_ROOT/scripts/deploy-remote.sh"
}