aboutsummaryrefslogtreecommitdiffstats
path: root/tools/video-fallback-test.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/video-fallback-test.js')
-rw-r--r--tools/video-fallback-test.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/video-fallback-test.js b/tools/video-fallback-test.js
index 81c22d3..66becc2 100644
--- a/tools/video-fallback-test.js
+++ b/tools/video-fallback-test.js
@@ -95,10 +95,23 @@ try {
const p0 = await player('garden');
check('the server\'s still is the poster', p0.poster === 'https://v3.coinos.io/vmedia/thumb.jpg?u=' + encodeURIComponent(CLIP.saved), p0.poster);
+ console.log('\n[waiting for a tap]');
+ await page.evaluate(new Function(`${box('garden')}.scrollIntoView({ block: 'center' })`));
+ await page.waitForFunction(new Function(`return !!${box('garden')}?.querySelector('.vid-heavy')`), { timeout: 10000 });
+ const idle = await page.evaluate(new Function(`const b = ${box('garden')}, v = b.querySelector('video'), s = b.querySelector('.vid-sound');
+ return { controls: v.controls, sound: s ? getComputedStyle(s).display : 'gone', fit: getComputedStyle(v).objectFit, label: b.querySelector('.vid-heavy').textContent };`));
+ check('only the play button and the cost show: no seek bar, no sound button, the picture fills the box', !idle.controls && idle.sound === 'none' && idle.fit === 'cover' && idle.label.length > 1, JSON.stringify(idle));
+ const at = await page.evaluate(new Function(`const r = ${box('garden')}.getBoundingClientRect(); return { x: r.x + r.width * 0.3, y: r.y + r.height * 0.3 };`));
+ await page.mouse.move(at.x, at.y); await sleep(300);
+ const bg = await page.evaluate(new Function(`return getComputedStyle(${box('garden')}.querySelector('.vid-heavy')).backgroundColor`));
+ check('hovering the cover leaves the picture showing through', /rgba\(0, 0, 0, 0?\.\d+\)/.test(bg), bg);
+ await page.mouse.move(0, 0);
+
console.log('\n[found out by playing]');
await show('garden');
check('the clip switches to the H.264 copy and shows its picture', await waitFor(new Function(`const v = ${box('garden')}?.querySelector('video'); return v && v.getAttribute('src').includes('/vmedia/h264.mp4') && v.videoWidth > 0;`), null, 10000),
JSON.stringify(await player('garden')));
+ check('playing, the player\'s own controls are back', await page.evaluate(new Function(`const b = ${box('garden')}; return b.querySelector('video').controls && !b.classList.contains('idle')`)));
check('the original was tried first', asked.some(([k, u]) => k === 'media' && u === CLIP.saved));
console.log('\n[the copy fails too]');