jukebox
All repositories: gitoria
25.2 KB
// tests/ui.mjs — the jukebox's SCREEN GATE: its own server on a generated database of 13,450 songs (tools/make-test-db.hl, not the real library) and a real headless// Chrome (tests/cdp.mjs): real clicks, wheel scrolling and keys. Phone first (390 px), then 1280. Every song of the test database points at one 60 s tone (ffmpeg).// node tests/ui.mjs env: JUKEBOX_UI_PORT (server, default 8710), JUKEBOX_UI_CHROME (Chrome debug ports, HL_PORT_BASE+200..: default base 8500 → 8700-8709),// JUKEBOX_UI_DIR (scratch, default /media/STORAGE/claude-scratch/atlas/JB2/gate-ui), JUKEBOX_UI_SHOTS (screenshots dir), JUKEBOX_UI_URL (use a server that already runs: skips the start and the database)import { spawn, execFileSync } from 'node:child_process'import { rmSync, mkdirSync, writeFileSync, existsSync, readFileSync } from 'node:fs'import { dirname, join } from 'node:path'import { fileURLToPath } from 'node:url'process.env.HL_CHROME = process.env.HL_CHROME || '/opt/google/chrome/chrome'process.env.HL_PORT_BASE = process.env.HL_PORT_BASE || '8500'const { launchBrowser } = await import('./cdp.mjs')const root = join(dirname(fileURLToPath(import.meta.url)), '..')const dir = process.env.JUKEBOX_UI_DIR || '/media/STORAGE/claude-scratch/atlas/JB2/gate-ui'const shots = process.env.JUKEBOX_UI_SHOTS || join(dir, 'shots')const port = Number(process.env.JUKEBOX_UI_PORT || 8710)const BASE = process.env.JUKEBOX_UI_URL || `http://127.0.0.1:${port}`const COLD_MS = Number(process.env.JUKEBOX_COLD_MS || 150000)let pass = 0, fail = 0const check = (name, ok, detail = '') => { console.log((ok ? 'ok ' : 'FAIL ') + name + (ok ? '' : ' — ' + detail)); if (ok) pass++; else fail++ }const sleep = (ms) => new Promise((r) => setTimeout(r, ms))mkdirSync(shots, { recursive: true })let server = null, browser = null, log = ''async function stop() {if (browser) { try { await browser.close() } catch {} browser = null }if (server) { try { server.kill('SIGTERM') } catch {} await sleep(500); server = null }}process.on('SIGINT', async () => { await stop(); process.exit(1) })// ---- the test database and the server --------------------------------------------------------------------------------------const storage = join(dir, 'storage')const tone = join(dir, 'tone.mp3')if (!process.env.JUKEBOX_UI_URL) {rmSync(storage, { recursive: true, force: true })mkdirSync(dir, { recursive: true })execFileSync('ffmpeg', ['-v', 'error', '-y', '-f', 'lavfi', '-i', 'sine=frequency=440:duration=60', '-q:a', '9', tone])const cover = join(root, 'tests/fixtures/withcover/folder.jpg')const t0 = Date.now()const made = execFileSync(join(root, 'bin/hybriel'), [join(root, 'tools/make-test-db.hl'), tone, cover], { env: { ...process.env, JUKEBOX_STORAGE: storage }, encoding: 'utf8', timeout: 600000 })console.log(made.trim() + ' (' + (Date.now() - t0) + ' ms)')server = spawn(join(root, 'bin/hybriel'), ['project.hl'], { cwd: root, env: { ...process.env, JUKEBOX_PORT: String(port), JUKEBOX_STORAGE: storage, JUKEBOX_AUTOSCAN: '0', JUKEBOX_WATCH: '0', HL_HOST: '127.0.0.1' }, stdio: ['ignore', 'pipe', 'pipe'] })server.stdout.on('data', (d) => { log += d }); server.stderr.on('data', (d) => { log += d })for (const t0 = Date.now(); ; ) {try { if ((await fetch(BASE + '/')).ok) break } catch {}if (Date.now() - t0 > COLD_MS) { console.log(log); throw new Error('the server did not come up') }await sleep(500)}}try {// ---- the JSON API and the audio route -------------------------------------------------------------------------------------const j = async (p) => (await fetch(BASE + p)).json()const stats = (await j('/api/stats')).librarycheck('the test database has 13,459 files', stats.songs === 13459, JSON.stringify(stats))const byPlays = await j('/api/songs?sort=plays&limit=3')check('sort=plays: the most played first', byPlays.items.length === 3 && byPlays.items[0].playCount >= byPlays.items[1].playCount && byPlays.items[0].playCount === 12, JSON.stringify(byPlays.items.map((s) => s.playCount)))const some = (await j('/api/songs?sort=title&limit=1')).items[0]const full = readFileSync(tone)const get = (id, headers = {}, method = 'GET') => fetch(BASE + '/stream/' + id, { headers, method })let r = await get(some.id, { Range: 'bytes=0-99' })const b0 = Buffer.from(await r.arrayBuffer())check('stream: Range bytes=0-99 answers 206 with 100 bytes', r.status === 206 && b0.length === 100 && r.headers.get('content-range') === `bytes 0-99/${full.length}`, r.status + ' ' + r.headers.get('content-range'))check('stream: the bytes are the file\'s bytes', b0.equals(full.subarray(0, 100)))check('stream: content type audio/mpeg, Accept-Ranges bytes', r.headers.get('content-type') === 'audio/mpeg' && r.headers.get('accept-ranges') === 'bytes', r.headers.get('content-type'))r = await get(some.id, { Range: 'bytes=1000-1999' }); const b1 = Buffer.from(await r.arrayBuffer())check('stream: a range in the middle is the right slice', r.status === 206 && b1.equals(full.subarray(1000, 2000)))r = await get(some.id, { Range: 'bytes=-50' }); const b2 = Buffer.from(await r.arrayBuffer())check('stream: a suffix range gives the last 50 bytes', r.status === 206 && b2.equals(full.subarray(full.length - 50)))r = await get(some.id, { Range: `bytes=${full.length - 10}-` }); const b3 = Buffer.from(await r.arrayBuffer())check('stream: an open range runs to the end', r.status === 206 && b3.equals(full.subarray(full.length - 10)))r = await get(some.id, { Range: `bytes=${full.length + 5}-` })check('stream: a range past the end answers 416', r.status === 416, '' + r.status)r = await get(some.id, { Range: 'bytes=0-1,5-9' })check('stream: a list of ranges is not an error (answers 206 with the start)', r.status === 206)r = await get(some.id)check('stream: no Range header: the first chunk, 206', r.status === 206 && Buffer.from(await r.arrayBuffer()).length === Math.min(full.length, 1048576))r = await get('nosuchsong1'); check('stream: an unknown id is 404', r.status === 404, '' + r.status)r = await get('..%2F..%2Fetc%2Fpasswd'); check('stream: a path in the URL is 404, never read', r.status === 404, '' + r.status)r = await fetch(BASE + '/stream/' + some.id, { method: 'POST' }); check('stream: POST is refused', r.status === 405)r = await fetch(BASE + '/api/thumb/' + some.id); check('a thumbnail of an unknown cover is 404', r.status === 404)const withCover = (await j('/api/albums?limit=200')).items.find((a) => a.coverId)r = await fetch(BASE + '/api/thumb/' + withCover.coverId); const th = Buffer.from(await r.arrayBuffer())check('the thumbnail is a small jpeg', r.status === 200 && r.headers.get('content-type') === 'image/jpeg' && th.length < 20000 && th[0] === 0xff, r.status + ' ' + th.length)// ---- the screens, phone first --------------------------------------------------------------------------------------------browser = await launchBrowser()const page = await browser.newPage()const ev = (e) => page.evaluate(e)const shot = async (name) => { const s = await page.send('Page.captureScreenshot', { format: 'png' }); writeFileSync(join(shots, name + '.png'), Buffer.from(s.data, 'base64')) }const press = async (key, code, vk) => { await page.send('Input.dispatchKeyEvent', { type: 'rawKeyDown', key, code, windowsVirtualKeyCode: vk }); await page.send('Input.dispatchKeyEvent', { type: 'keyUp', key, code, windowsVirtualKeyCode: vk }) }const wheel = async (dy, x = 200, y = 400) => { await page.send('Input.dispatchMouseEvent', { type: 'mouseWheel', x, y, deltaX: 0, deltaY: dy }) }const rowsInDom = () => ev(`document.querySelectorAll('virtual-list .vl-row').length`)const firstTitle = () => ev(`(document.querySelector('virtual-list .vl-row:not(.blank) .vl-title')||{}).textContent`)const goto = async (path) => { await page.goto(BASE + path); await page.waitForSelector('jb-screen') }const clientNav = async (href) => { await page.click('.menu-toggle'); await page.waitFor(`document.querySelector('app-sidebar:popover-open')`); await page.click(`app-sidebar a[href="${href}"]`); await page.waitFor(`location.pathname === ${JSON.stringify(href)}`) }await page.send('Emulation.setDeviceMetricsOverride', { width: 390, height: 844, deviceScaleFactor: 2, mobile: true })let t0 = Date.now()await goto('/')await page.waitForSelector('virtual-list .vl-row')console.log('first paint of Songs at 390: ' + (Date.now() - t0) + ' ms')await sleep(800)check('Songs: the count says 13,458 songs (a song in two folders is shown once)', (await ev(`document.querySelector('#count').textContent`)) === '13,458 songs')const n0 = await rowsInDom()check('Songs: only the rows near the viewport are in the page (< 100)', n0 > 5 && n0 < 100, '' + n0)const geo = await ev(`(() => { const rows = [...document.querySelectorAll('virtual-list .vl-row')].map((r) => r.getBoundingClientRect()); const r0 = document.querySelector('.vl-row'); const th = r0.querySelector('.vl-thumb').getBoundingClientRect(), tx = r0.querySelector('.vl-text').getBoundingClientRect(); return { steps: rows.slice(1).map((r, i) => Math.round(r.top - rows[i].top)), thumbMid: th.top + th.height / 2, textMid: tx.top + tx.height / 2, rowMid: rows[0].top + rows[0].height / 2, h: rows[0].height, titleSub: (() => { const t = r0.querySelector('.vl-title').getBoundingClientRect(), s = r0.querySelector('.vl-sub').getBoundingClientRect(); return Math.round(s.top - t.bottom) })() } })()`)check('Songs: the rows are 56 px apart, no looser (dense list)', geo.steps.every((s) => s === 56) && geo.h === 56, JSON.stringify(geo.steps.slice(0, 5)))check('Songs: thumbnail, text and row share one centre line (±1 px)', Math.abs(geo.thumbMid - geo.rowMid) <= 1 && Math.abs(geo.textMid - geo.rowMid) <= 1, JSON.stringify(geo))check('Songs: the title and its second line touch (gap ≤ 2 px)', geo.titleSub <= 2, '' + geo.titleSub)await shot('songs-390')// scroll to the end with the real wheelt0 = Date.now()for (let i = 0; i < 40; i++) { await wheel(60000); await sleep(60) }await page.waitFor(`(() => { const s = document.querySelector('.vl-scroller'); return s.scrollTop + s.clientHeight >= s.scrollHeight - 2 })()`, { timeout: 20000 })await sleep(1200)const end = await ev(`(() => { const rows = [...document.querySelectorAll('virtual-list .vl-row')]; return { n: rows.length, blank: rows.filter((r) => r.classList.contains('blank')).length, last: rows[rows.length - 1].getAttribute('data-index'), text: rows[rows.length - 1].textContent } })()`)console.log('scrolled to the end in ' + (Date.now() - t0) + ' ms')check('Songs: scrolled to the end of 13,450 rows the page still holds < 100 rows', end.n < 100, JSON.stringify(end))check('Songs: the last row is number 13,458 and its text arrived (no blank rows)', end.last === '13457' && end.blank === 0 && end.text.length > 5, JSON.stringify(end))// sort with the keyboard on the selectawait goto('/')await page.waitForSelector('virtual-list .vl-row')// the screen now opens where it was left (jukebox#20): the end of the list. Back to the first row with the wheel, as a listener does: a sort change does not scroll a far-down list// back to the top by itself (emit vlTop() does not move it; the same on main, reported in reports/JB20)// OPEN BUG components#27 (virtual-list resetKey): this wheel-to-top is a workaround in the gate, the bug is NOT fixed; remove it when components#27 is fixedfor (let i = 0; i < 40; i++) { await wheel(-60000); await sleep(60) }await page.waitFor(`document.querySelector('.vl-scroller').scrollTop === 0`, { timeout: 20000 })await sleep(900)const apiFirst = async (q) => (await j('/api/songs?limit=1&' + q)).items[0].titleawait page.focus('#sort'); await press('ArrowDown', 'ArrowDown', 40)await page.waitFor(`document.querySelector('#sort').value === 'title'`)await page.waitFor(`document.querySelector('virtual-list .vl-row .vl-title').textContent !== ''`)await sleep(500)check('Sort by title: the first row is the API\'s first title', (await firstTitle()) === (await apiFirst('sort=title')), (await firstTitle()) + ' / ' + (await apiFirst('sort=title')))await press('ArrowDown', 'ArrowDown', 40); await sleep(900)check('Sort by album: the first row is the API\'s first album song', (await firstTitle()) === (await apiFirst('sort=album')), await firstTitle())await press('ArrowDown', 'ArrowDown', 40); await sleep(900)const playsRow = await ev(`document.querySelector('virtual-list .vl-row .vl-aside').textContent`)check('Sort by most played: the first row shows 12×', playsRow === '12×', playsRow)// favouritesawait goto('/')await page.waitForSelector('virtual-list .vl-row')const fav5 = (await j('/api/songs?minPlays=5&limit=1')).totalcheck('the API knows the favourites count', fav5 === stats.playedAtLeast5, fav5 + ' / ' + stats.playedAtLeast5)await page.click('#fav')await page.waitFor(`document.querySelector('#count').textContent === ${JSON.stringify(fav5.toLocaleString('en-US') + ' songs')}`, { timeout: 10000, label: 'favourites count' })check('Favourites: the count line shows the songs played at least 5 times', true)const line = await ev(`(() => { const mid = (e) => { const r = e.getBoundingClientRect(); return r.top + r.height / 2 }; const c = document.querySelector('jb-count'); return [mid(c.querySelector('output')), mid(c.querySelector('input')), mid(c.querySelectorAll('span')[1]), c.getBoundingClientRect().height] })()`)check('Favourites: the count, the minimum field and the words stand on one line (centres within 6 px)', Math.max(...line.slice(0, 3)) - Math.min(...line.slice(0, 3)) <= 6, JSON.stringify(line))check('Favourites: the minimum is 5 by default', (await ev(`document.querySelector('#favmin').value`)) === '5')await shot('favourites-390')const fav9 = (await j('/api/songs?minPlays=9&limit=1')).totalawait page.focus('#favmin'); await ev(`document.querySelector('#favmin').select()`)await page.send('Input.insertText', { text: '9' })await page.waitFor(`document.querySelector('#count').textContent === ${JSON.stringify(fav9.toLocaleString('en-US') + ' songs')}`, { timeout: 10000, label: 'favourites 9' })check('Favourites: N adjustable, 9 changes the count', fav9 < fav5)const minPlaysSeen = await ev(`(async () => { const s = document.querySelector('.vl-scroller'); s.scrollTop = 56 * 40; await new Promise((r) => setTimeout(r, 900)); return [...document.querySelectorAll('.vl-row:not(.blank)')].length })()`)check('Favourites: rows are loaded after a scroll in the filtered list', minPlaysSeen > 5, '' + minPlaysSeen)// search through the phone's menuawait goto('/')await page.waitForSelector('virtual-list .vl-row')await clientNav('/search')await page.waitForSelector('#q')check('Search: the header toggle opened the menu and the page changed without a reload', true)t0 = Date.now()await page.type('#q', 'zebra fixture')await page.waitFor(`(() => { const h = [...document.querySelectorAll('jb-hits h2')].find((x) => x.textContent.startsWith('Songs')); return !!h && h.textContent === 'Songs · 1' })()`, { timeout: 15000, label: 'search result' })console.log('search response (last key to the result): ' + (Date.now() - t0) + ' ms in all')const found = await ev(`[...document.querySelectorAll('virtual-list .vl-row:not(.blank) .vl-title')].map((e) => e.textContent)`)check('Search: the known song is found while typing', found.includes('Zebra Fixture Anthem'), JSON.stringify(found))await page.type('#q', ' nonexistentword')await page.waitFor(`document.querySelector('#count').textContent === 'Nothing found.'`, { timeout: 15000, label: 'every word must match' })check('Search: every word must match (a word that is not there finds nothing)', true)await ev(`(() => { const q = document.querySelector('#q'); q.value = ''; q.dispatchEvent(new Event('input', { bubbles: true })) })()`)await page.type('#q', 'quentin fixture')await page.waitFor(`(() => { const h = [...document.querySelectorAll('jb-hits h2')].find((x) => x.textContent.startsWith('Songs')); return !!h && h.textContent === 'Songs · 1' })()`, { timeout: 15000 })const hits = await ev(`[...document.querySelectorAll('jb-hits button .jb-name')].map((e) => e.textContent)`)check('Search: the artist and the album are found too', hits.includes('Quentin Fixture') && hits.includes('Known Album'), JSON.stringify(hits))await shot('search-390')await ev(`(() => { const q = document.querySelector('#q'); q.value = ''; q.dispatchEvent(new Event('input', { bubbles: true })) })()`)await page.type('#q', 'xyzzy')await page.waitFor(`document.querySelector('#count').textContent === 'Nothing found.'`, { timeout: 15000 })check('Search: no match shows 0 songs', true)await ev(`(() => { const q = document.querySelector('#q'); q.value = ''; q.dispatchEvent(new Event('input', { bubbles: true })) })()`)await page.type('#q', 'zebra fixture')await page.waitFor(`(() => { const h = [...document.querySelectorAll('jb-hits h2')].find((x) => x.textContent.startsWith('Songs')); return !!h && h.textContent === 'Songs · 1' })()`, { timeout: 15000 })// play the found song: a tap on its rowawait page.click('virtual-list .vl-row:not(.blank)')await page.waitFor(`(() => { const a = document.querySelector('media-player audio'); return a && a.currentTime > 0.6 && !a.paused })()`, { timeout: 20000, label: 'currentTime advances' })const audio1 = await ev(`(() => { const a = document.querySelector('media-player audio'); return { src: a.src, t: a.currentTime, paused: a.paused } })()`)check('Play: the song plays (currentTime advances)', audio1.t > 0.6 && !audio1.paused && audio1.src.includes('/stream/'), JSON.stringify(audio1))const bar = await ev(`(() => { const b = document.querySelector('.jb-bar').getBoundingClientRect(); return { h: Math.round(b.height), bottom: Math.round(b.bottom), vh: innerHeight, w: Math.round(b.width) } })()`)check('Play: the player bar sits at the bottom of the phone screen and the progress bar is half a finger', bar.h <= 84 && bar.h >= 68 && bar.bottom === bar.vh, JSON.stringify(bar))const barGeo = await ev(`(() => { const r = (s) => document.querySelector(s).getBoundingClientRect(); const bar = r('.jb-bar'); const seek = r('.jb-bar mp-seek'); const track = r('.jb-bar mp-seek .mp-track'); const t = r('.jb-bar .mp-cover h2'); return { seekAbove: seek.bottom <= r('.jb-bar .mp-play').top + 2, seekTop: Math.round(seek.top - bar.top), seekH: Math.round(seek.height), trackH: Math.round(track.height), title: document.querySelector('.jb-bar .mp-cover h2').textContent, titleInside: t.top >= bar.top && t.bottom <= bar.bottom && t.width > 40, buttons: [...document.querySelectorAll('.jb-bar mp-buttons button')].filter((b) => b.getBoundingClientRect().width > 0).length } })()`)check('Play: the progress bar is on top, 22 px tall, the title is inside the bar, play / pause in the media player, previous and next beside it', barGeo.seekAbove && barGeo.seekTop <= 2 && barGeo.seekH >= 20 && barGeo.seekH <= 26 && barGeo.trackH >= 20 && barGeo.trackH <= 26 && barGeo.title === 'Zebra Fixture Anthem' && barGeo.titleInside && barGeo.buttons === 1, JSON.stringify(barGeo))await shot('player-390')// the song goes on while the screen changesawait clientNav('/artists')await page.waitForSelector('virtual-list .vl-row:not(.blank)')await sleep(1500)const audio2 = await ev(`(() => { const a = document.querySelector('media-player audio'); return { src: a.src, t: a.currentTime, paused: a.paused } })()`)check('Play: it keeps playing when the screen changes to Artists', audio2.src === audio1.src && audio2.t > audio1.t && !audio2.paused, JSON.stringify([audio1, audio2]))const lastRow = await ev(`(() => { const r = document.querySelector('virtual-list .vl-row:not(.blank)').getBoundingClientRect(); const b = document.querySelector('.jb-bar').getBoundingClientRect(); const s = document.querySelector('.vl-scroller').getBoundingClientRect(); return { scrollerBottom: Math.round(s.bottom), barTop: Math.round(b.top) } })()`)check('Play: the list ends where the bar starts (nothing hidden under it)', lastRow.scrollerBottom <= lastRow.barTop + 1, JSON.stringify(lastRow))// artist -> albums and songs; album -> songs in track order, large coverawait page.click('virtual-list .vl-row:not(.blank)')await page.waitFor(`location.pathname.startsWith('/artists/')`)await page.waitForSelector('#name')const artistName = await ev(`document.querySelector('#name').textContent`)check('Artist: a tap opens the artist (name on top)', artistName.length > 2, artistName)check('Artist: albums and songs tabs', (await ev(`document.querySelectorAll('jb-tabs button[data-tab]').length`)) === 2)await page.click('jb-tabs button[data-tab="songs"]')await page.waitFor(`document.querySelector('jb-tabs button[data-tab="songs"]').classList.contains('on')`)await sleep(700)check('Artist: the songs tab lists their songs', (await ev(`document.querySelectorAll('.vl-row:not(.blank)').length`)) > 0)await page.click('jb-tabs button[data-tab="albums"]')await page.waitFor(`document.querySelector('jb-tabs button[data-tab="albums"]').classList.contains('on') && !document.querySelector('.vl-row:not(.blank) .vl-aside').textContent.includes(':')`, { timeout: 15000, label: 'albums tab' })await sleep(500)await page.click('virtual-list .vl-row:not(.blank)')try { await page.waitFor(`location.pathname.startsWith('/albums/')`, { timeout: 5000 }) } catch (e) {console.log('DIAG after the tap on an album row: ' + await ev(`location.pathname + ' | ' + document.querySelector('jb-tabs button.on').textContent + ' | ' + [...document.querySelectorAll('.vl-row:not(.blank)')].slice(0, 2).map((r) => r.outerHTML.slice(0, 200)).join(' || ')`))throw e}await page.waitForSelector('jb-head img#cover, jb-head .jb-nocover')await sleep(900)const alb = await ev(`(() => { const c = document.querySelector('jb-head img#cover') || document.querySelector('jb-head .jb-nocover'); const r = c.getBoundingClientRect(); const titles = [...document.querySelectorAll('.vl-row:not(.blank) .vl-title')].map((e) => e.textContent); return { cover: Math.round(r.width), top: Math.round(r.top), titles, vw: innerWidth } })()`)check('Album: the cover is large on top (≥ 250 px wide at 390)', alb.cover >= 250, JSON.stringify(alb))const nums = alb.titles.map((t) => parseInt(t, 10))check('Album: the songs are in track order', nums.length > 3 && nums.every((n, i) => i === 0 || n > nums[i - 1]), JSON.stringify(alb.titles))await shot('album-390')await page.click('virtual-list .vl-row:not(.blank)')await page.waitFor(`document.querySelector('media-player audio').src.includes('/stream/') && document.querySelector('media-player audio').currentTime < 3`, { timeout: 20000 })await sleep(1500)check('Album: a tap plays that song', await ev(`!document.querySelector('media-player audio').paused && document.querySelector('media-player audio').currentTime > 0.5`))check('The page has no script errors', page.problems().filter((m) => m.level === 'error').length === 0, page.dumpConsole())// ---- desktop ---------------------------------------------------------------------------------------------------------------await page.send('Emulation.setDeviceMetricsOverride', { width: 1280, height: 800, deviceScaleFactor: 1, mobile: false })await goto('/')await page.waitForSelector('virtual-list .vl-row:not(.blank)')await sleep(800)check('Desktop: the menu stands in the header (Songs, Artists, Albums, Search)', (await ev(`[...document.querySelectorAll('application-header main-menu a')].map((a) => a.textContent).join(',')`)) === 'Songs,Artists,Albums,Search')check('Desktop: rows are in the page (< 100)', (await rowsInDom()) < 100 && (await rowsInDom()) > 5)await shot('songs-1280')await goto('/search'); await page.type('#q', 'zebra'); await page.waitFor(`(() => { const h = [...document.querySelectorAll('jb-hits h2')].find((x) => x.textContent.startsWith('Songs')); return !!h && h.textContent === 'Songs · 1' })()`, { timeout: 15000 })await shot('search-1280')await goto('/albums'); await page.waitForSelector('virtual-list .vl-row:not(.blank)'); await sleep(1500); await page.click('virtual-list .vl-row:not(.blank)')await page.waitFor(`location.pathname.startsWith('/albums/')`); await sleep(1200)await shot('album-1280')await page.click('virtual-list .vl-row:not(.blank)')await page.waitFor(`(() => { const a = document.querySelector('media-player audio'); return a && a.currentTime > 0.6 && !a.paused })()`, { timeout: 20000 })await sleep(500)const bar2 = await ev(`(() => { const bar = document.querySelector('.jb-bar').getBoundingClientRect(); const t = document.querySelector('.jb-bar .mp-cover h2').getBoundingClientRect(); return { title: document.querySelector('.jb-bar .mp-cover h2').textContent, inside: t.top >= bar.top && t.bottom <= bar.bottom && t.width > 40, times: document.querySelector('.jb-bar .mp-times').getBoundingClientRect().width > 20 } })()`)check('Desktop: a song without a cover still shows its title in the bar, and the times', bar2.title.length > 3 && bar2.inside && bar2.times, JSON.stringify(bar2))await shot('player-1280')check('Desktop: the player bar plays', true)await page.close()} catch (e) {fail++; console.log('FAIL the gate stopped: ' + (e && e.stack || e)); if (log) console.log(log.slice(-2000))} finally {await stop()}console.log(`\n${pass} passed, ${fail} failed`)process.exit(fail ? 1 : 0)
Branches
Latest commits
- 95f5faae|||PR jukebox#7 Drop needless let declarationsmre
- 33072bb5|||PR Record day72 gates and Chrome proofmre
- 95f2cd73|||PR Use typed parent methods for screen playback and local server facesmre
- 6422a020Sync media-player at 51c3818mre
- b582ba1cVendor complete Hybriel day72 plugin setmre
- 02dccbc9Merge branch 'records-1119' into mainJukebox
- a39e1c23|||PR Records: missions 013-015, reconnect fix livemre
- fc7db075Merge branch 'reconnect-retry' into mainJukebox
- ac6f4c6fL2: plain declaration for a in pickedNextmre
- 2f335086Review round 2: only an explicit queue pick drops pend (not the automatic advance); jb23 records every source changemre
- 3eb6695fReview fixes: action generation, queue pick clears pend, Previous/Next retry the decided request, typed handlersmre
- 7a53c0c2|||PR A tap lost to a dead socket plays after reconnect (mission 015)mre
- 1f0cd77bMerge branch 'records-day41' into mainJukebox
- 67be229f|||PR Records: day41 live (PR #4), mission 012, statusmre
- 0bb027daconductor: caramboleyo is the user, not owner/creatorApollo
- 04f5d9d5Merge branch 'day41' into mainJukebox
- 8ed6da45|||PR README: media-player pin df9e7dfmre
- d5d45fc3|||PR media-player df9e7df (repeat-one fix), sync pin and SOURCEmre
- 89cdabb1Vendor Hybriel day41 (57054d9e): plugin dirs, set .somre
- 1fecd6a7Merge branch 'records-day39' into mainJukebox