Files
peardock/test/visual-structure.test.js
T
Raven Scott 9775fe5305
Release rolling / release (push) Successful in 9m39s
Move Peers into Settings and add a full Registry browser tab.
Peers live under Settings; Images is local-only. Registry is a top-level view with vault credentials, Hub search, and Registry API V2 catalog/tags/manifest/delete over the wire.
2026-07-15 16:04:27 -04:00

101 lines
2.8 KiB
JavaScript

/**
* Lightweight visual/structure regression: ensure critical UI landmarks stay in index.html.
* Complements full screenshot suites (optional future) without browser automation deps.
*/
import test from 'brittle'
import fs from 'fs'
import path from 'path'
import { fileURLToPath } from 'url'
const root = path.join(path.dirname(fileURLToPath(import.meta.url)), '..')
const html = fs.readFileSync(path.join(root, 'index.html'), 'utf8')
const REQUIRED_IDS = [
'sidebar',
'content',
'job-drawer',
'toast-stack',
'containers-view',
'add-container-view',
'add-container-btn',
'add-container-form',
'addc-always-pull',
'duplicate-always-pull',
'duplicate-container-form',
'images-view',
'registry-view',
'registry-store-form',
'registry-catalog-btn',
'registry-tags-table',
'pushImageModal',
'pull-image-credential',
'check-image-updates-btn',
'containers-table',
'deploy-view',
'tunnels-view',
'swarm-view',
'host-view',
'settings-view',
'settings-panel-peers',
'connection-list',
'stack-git-url',
'tunnel-create-btn',
'swarm-services-body',
'settings-density',
'settings-accent',
'settings-reduce-motion',
'settings-open-shortcuts',
]
const REQUIRED_SNIPPETS = [
'data-view="tunnels"',
'data-view="swarm"',
'data-view="registry"',
'data-settings-tab="peers"',
'ENABLE_HOLESAIL',
'GitOps',
'collapse-sidebar-btn',
'open-add-connection-btn',
'settings-refresh-stamp',
'value="spacious"',
'Always pull the image',
'Add container',
'Deploy the container',
'Updates',
'Check updates',
]
test('index.html retains critical view landmarks', (t) => {
for (const id of REQUIRED_IDS) {
t.ok(html.includes(`id="${id}"`), `missing #${id}`)
}
})
test('index.html retains critical feature snippets', (t) => {
for (const s of REQUIRED_SNIPPETS) {
t.ok(html.includes(s), `missing snippet: ${s}`)
}
})
test('modern.css includes collapsed sidebar rail rules', (t) => {
const css = fs.readFileSync(path.join(root, 'ui/modern.css'), 'utf8')
t.ok(css.includes('#sidebar.collapsed'))
t.ok(css.includes('icon') || css.includes('nav-link'))
})
test('modern.css includes Track G UX chrome', (t) => {
const css = fs.readFileSync(path.join(root, 'ui/modern.css'), 'utf8')
t.ok(css.includes('.pd-scroll-top'))
t.ok(css.includes('.pd-refresh-stamp'))
t.ok(css.includes("data-density='spacious'") || css.includes('data-density=spacious') || css.includes("data-density='spacious'"))
t.ok(css.includes("data-accent='violet'") || css.includes('data-accent'))
})
test('track-g-ux.js exports shortcuts and go-map', (t) => {
const src = fs.readFileSync(path.join(root, 'ui/track-g-ux.js'), 'utf8')
t.ok(src.includes('openShortcutsModal'))
t.ok(src.includes('focusListSearch'))
t.ok(src.includes('initTrackGUx'))
t.ok(src.includes("c: 'containers'"))
})