gitoria

components

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Main branchmaina06fc778Reset virtual-list window when the host changes resetKeyAtlasmain/tests/media-autoplay.mjs

2.5 KB

  1. // Fresh documents: never play() from the harness, including before the first observation.
  2. export async function mediaAutoplay(browser, base, check, run = 1) {
  3. for (const mode of ['first', 'mount']) for (const kind of ['video', 'audio']) {
  4. const path = `/media-player/autoplay/${mode}/${kind}`;
  5. const html = await (await fetch(base + path)).text();
  6. check(`AP29 ${run} ${mode} ${kind}: server HTML ${mode === 'first' ? 'contains' : 'omits'} player`, html.includes('<media-player>') === (mode === 'first'));
  7. const page = await browser.newPage();
  8. try {
  9. await page.send('Network.enable');
  10. await page.send('Network.setBypassServiceWorker', { bypass: true });
  11. await page.goto(base + path, { timeout: 45000 });
  12. await page.waitFor('window.__hl?.socket?.readyState === 1', { timeout: 30000 });
  13. if (mode === 'mount') {
  14. check(`AP29 ${run} mount ${kind}: absent before click`, await page.evaluate(`!document.querySelector('media-player')`));
  15. await page.click('#mount-player');
  16. }
  17. 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);
  18. const state = await page.evaluate(`(() => {
  19. const p = document.querySelector('media-player'), v = p?.querySelector('video,audio');
  20. if (!v) return { missing: true };
  21. const clock = t => Math.floor(t / 60) + ':' + String(Math.floor(t % 60)).padStart(2,'0');
  22. const times = [...p.querySelectorAll('.mp-times time')].map(t => t.textContent);
  23. const play = p.querySelector('.mp-play'), mute = p.querySelector('.mp-mute');
  24. return { paused: v.paused, time: v.currentTime, times,
  25. 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),
  26. playOk: play.classList.contains('is-playing') === !v.paused && play.getAttribute('aria-label') === (v.paused ? 'Play' : 'Pause') && play.title === (v.paused ? 'Play' : 'Pause'),
  27. muteOk: mute.classList.contains('is-muted') === v.muted && mute.getAttribute('aria-label') === (v.muted ? 'Unmute' : 'Mute') && mute.title === (v.muted ? 'Unmute' : 'Mute') };
  28. })()`);
  29. check(`AP29 ${run} ${mode} ${kind}: autoplay and time, mute, play labels match element`, running && state.timeOk && state.playOk && state.muteOk, JSON.stringify(state));
  30. } finally { await page.close(); }
  31. }
  32. }

Branches

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