components
All repositories: gitoria
2.5 KB
// Fresh documents: never play() from the harness, including before the first observation.export async function mediaAutoplay(browser, base, check, run = 1) {for (const mode of ['first', 'mount']) for (const kind of ['video', 'audio']) {const path = `/media-player/autoplay/${mode}/${kind}`;const html = await (await fetch(base + path)).text();check(`AP29 ${run} ${mode} ${kind}: server HTML ${mode === 'first' ? 'contains' : 'omits'} player`, html.includes('<media-player>') === (mode === 'first'));const page = await browser.newPage();try {await page.send('Network.enable');await page.send('Network.setBypassServiceWorker', { bypass: true });await page.goto(base + path, { timeout: 45000 });await page.waitFor('window.__hl?.socket?.readyState === 1', { timeout: 30000 });if (mode === 'mount') {check(`AP29 ${run} mount ${kind}: absent before click`, await page.evaluate(`!document.querySelector('media-player')`));await page.click('#mount-player');}const running = await page.waitFor(`(() => { const v = document.querySelector('media-player ${kind}'); return v && !v.paused && v.currentTime > 2.2 && v.readyState >= 2; })()`, { timeout: 15000 }).then(() => true, () => false);const state = await page.evaluate(`(() => {const p = document.querySelector('media-player'), v = p?.querySelector('video,audio');if (!v) return { missing: true };const clock = t => Math.floor(t / 60) + ':' + String(Math.floor(t % 60)).padStart(2,'0');const times = [...p.querySelectorAll('.mp-times time')].map(t => t.textContent);const play = p.querySelector('.mp-play'), mute = p.querySelector('.mp-mute');return { paused: v.paused, time: v.currentTime, times,timeOk: times[0] !== '0:00' && Math.abs(times[0].split(':').reduce((a,n) => a * 60 + Number(n), 0) - v.currentTime) < 1.3 && times[1] === clock(v.duration),playOk: play.classList.contains('is-playing') === !v.paused && play.getAttribute('aria-label') === (v.paused ? 'Play' : 'Pause') && play.title === (v.paused ? 'Play' : 'Pause'),muteOk: mute.classList.contains('is-muted') === v.muted && mute.getAttribute('aria-label') === (v.muted ? 'Unmute' : 'Mute') && mute.title === (v.muted ? 'Unmute' : 'Mute') };})()`);check(`AP29 ${run} ${mode} ${kind}: autoplay and time, mute, play labels match element`, running && state.timeOk && state.playOk && state.muteOk, JSON.stringify(state));} finally { await page.close(); }}}
Branches
- b27b
- mainmain branch
- vl27-resetkey
Latest commits
- a06fc778Reset virtual-list window when the host changes resetKeyAtlas
- 3aab598cRe-vendor complete Hybriel day73 set for virtual-list resetAtlas
- 337ca075MD1 gate check measures frames in the page, not milliseconds from outside, and takes the middle load (components#30)mre
- f5f131c5Record AP29 autoplay comparisons and passing gatesmre
- 51c38187Gate media autoplay on first load and after client mountmre
- a3f2223dRecord successful B44 deployment and live proofmre
- 06c1e021Record passing B44 browser rerunmre
- c9861533Record B44 component proof and browser gate blockermre
- 1b7413beIgnore detached media events and space demo option outputsmre
- ca3b4959Re-vendor complete Hybriel plugins and runtime to day44mre
- df9e7df9Last-item checks run in the browser gate (components#26 fixed on day41); media-player loop is a plain Booleanmre
- 895a5afcRe-vendor complete Hybriel plugins and runtime to day41mre
- 16006bb3Backup tar: --hard-dereference, so mpackdb sidecars are never stored as hard links (Tracker's finding)mre
- 88397fc3Re-vendor complete Hybriel plugins and runtime to day39mre
- 9b872cedRecord IC28 deployment and live icon verificationmre
- 46fefaa7Count the icons entry in the offline home-page checkmre
- c7e14cabRecord IC28 rerun and unchanged-main baseline comparisonmre
- 5e090ffdRecord IC28 review evidence and gate resultsmre
- adfe2c4dAdd shuffle, repeat and repeatOne shared iconsmre
- c96709c8media-player: skip = false and repeat = 'one' options (jukebox#19)mre