diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/feed-video-pager-test.js | 11 | ||||
| -rw-r--r-- | tools/fullscreen-notice-test.js | 32 |
2 files changed, 16 insertions, 27 deletions
diff --git a/tools/feed-video-pager-test.js b/tools/feed-video-pager-test.js index 9b014f9..add9208 100644 --- a/tools/feed-video-pager-test.js +++ b/tools/feed-video-pager-test.js @@ -1,8 +1,8 @@ // A clip tapped in the feed opens in the media pager, over the feed's clips // (every shape, a post's own first), carrying on from where it was. The -// pager takes the whole screen and a wide clip turns the phone on its side — -// for that clip only. Each clip has a seek bar to drag; a tap pauses (and -// shows the details), another plays on. Leaving full screen leaves the pager. +// pager takes the whole screen; the screen isn't turned for a wide clip. +// Each clip has a seek bar to drag; a tap pauses (and shows the details), +// another plays on. Leaving full screen leaves the pager. // Run: bun tools/feed-video-pager-test.js import puppeteer from './puppeteer.js'; import { cacheKeyFor } from '../src/wallet.js'; @@ -106,7 +106,7 @@ try { check('the tap opens the video pager', s.open); check('…on the clip tapped', await resting('wide.webm'), await curClip()); check('…full screen', await waitFor(() => document.fullscreenElement === document.documentElement, null, 3000)); - check('…turned on its side, for a wide clip', await waitFor(() => window.__orient.includes('lock:landscape'), null, 3000), JSON.stringify((await pagerState()).orient)); + check('…the screen not turned for a wide clip (bars; the reader turns the phone)', (await sleep(800), !(await pagerState()).orient.some((x) => x.startsWith('lock'))), JSON.stringify((await pagerState()).orient)); check('the clip in the feed holds still underneath', (await feedClip('a wide one'))?.paused); await waitFor((cur) => { const v = eval(cur)()?.querySelector('video.mp-media'); return v && !v.paused && v.currentTime > 0; }, '(' + CUR + ')', 6000); let v = await curVideo(); @@ -150,7 +150,6 @@ try { console.log('\n[the next clip: a swipe away, the screen free to turn]'); await page.evaluate(() => { const sc = document.querySelector('.mp-scroll'); sc.scrollTo({ top: sc.clientHeight }); }); // what a swipe up does check('a swipe lands on the next clip (a tall one)', await resting('tall.webm'), await curClip()); - check('…and lets the screen follow the phone', await waitFor(() => window.__orient.lastIndexOf('unlock') > window.__orient.indexOf('lock:landscape'), null, 3000), JSON.stringify((await pagerState()).orient)); check('…playing', await waitFor((cur) => { const v = eval(cur)()?.querySelector('video.mp-media'); return v && !v.paused; }, '(' + CUR + ')', 6000)); await page.keyboard.press('ArrowDown'); check('down: the last clip, past a post with none', await resting('last.webm'), await curClip()); @@ -167,7 +166,7 @@ try { console.log('\n[leaving full screen another way (Back on a phone) leaves the pager]'); await openClip('a tall one'); check('the pager is open, full screen', await waitFor(() => !!document.querySelector('.media-pager.videos') && document.fullscreenElement === document.documentElement, null, 3000)); - check('a tall clip leaves the screen as it is', !(await pagerState()).orient.slice(1).includes('lock:landscape'), JSON.stringify((await pagerState()).orient)); + check('a tall clip leaves the screen as it is', !(await pagerState()).orient.some((x) => x.startsWith('lock')), JSON.stringify((await pagerState()).orient)); await page.evaluate(() => document.exitFullscreen()); check('out of full screen, out of the pager', await waitFor(() => !document.querySelector('.media-pager') && !!document.querySelector('.notes-feed'), null, 3000)); check('no page errors', errs.length === 0, errs.slice(0, 2).join(' | ')); diff --git a/tools/fullscreen-notice-test.js b/tools/fullscreen-notice-test.js index 2861439..c5658ea 100644 --- a/tools/fullscreen-notice-test.js +++ b/tools/fullscreen-notice-test.js @@ -1,8 +1,7 @@ // In the installed app (no address bar: the pager already fills the window) // the pager doesn't go full screen — every time it did, Chrome put up its -// "To exit full screen…" notice. A wide clip asks the screen to turn -// without it; if that's refused, then full screen (the notice, but the clip -// on its side). In a browser tab it goes full screen as before +// "To exit full screen…" notice. Nor is the screen turned for a wide clip +// (it plays with bars). In a browser tab it goes full screen as before // (feed-video-pager-test). A feed clip's own bar has no full-screen button: // a tap on the clip is the way, into the pager. // Run: bun tools/fullscreen-notice-test.js @@ -43,7 +42,7 @@ const seeded = [ async function run(lockOk) { - console.log('\n[the installed app, the screen ' + (lockOk ? 'turning' : 'refusing to turn') + ' without full screen]'); + console.log('\n[the installed app]'); const ctx = await browser.createBrowserContext(); // storage of its own: a fresh wallet each run const page = await ctx.newPage(); await page.evaluateOnNewDocument((ok) => { @@ -94,33 +93,24 @@ async function run(lockOk) { await waitText('receive', 20000); await page.evaluate(() => document.querySelector('.app-nav-button[aria-label="Feed"]').click()); await page.waitForSelector('.notes-feed video.note-video', { timeout: 20000 }); - if (lockOk) check('a feed clip\'s bar has no full-screen button', await waitFor(() => [...document.querySelectorAll('.notes-feed video.note-video')].every((v) => v.getAttribute('controlslist') === 'nofullscreen'), null, 5000)); + check('a feed clip\'s bar has no full-screen button', await waitFor(() => [...document.querySelectorAll('.notes-feed video.note-video')].every((v) => v.getAttribute('controlslist') === 'nofullscreen'), null, 5000)); await openClip('a wide one'); await sleep(1200); let s = await st(); check('a tap on a wide clip opens the pager', s.open); - if (lockOk) { - check('…not full screen (no notice)', !s.fs, JSON.stringify(s)); - check('…the screen asked to turn, without full screen', s.orient[0] === 'lock:landscape', JSON.stringify(s.orient)); - } else { - check('…refused, it goes full screen', s.fs, JSON.stringify(s)); - check('…and turns there', s.orient.includes('lock:landscape:fs'), JSON.stringify(s.orient)); - } + check('…not full screen (no notice)', !s.fs, JSON.stringify(s)); + check('…and the screen not turned (a wide clip plays with bars; the reader turns the phone)', !s.orient.some((x) => x.startsWith('lock')), JSON.stringify(s.orient)); await page.keyboard.press('ArrowDown'); await sleep(1200); - check('past it, the screen is let go', (await st()).orient.includes('unlock'), JSON.stringify((await st()).orient)); await page.keyboard.press('Escape'); check('Escape closes it', await waitFor(() => !document.querySelector('.media-pager') && !document.fullscreenElement, null, 3000)); - if (lockOk) { - const n = (await st()).orient.length; - await openClip('a tall one'); await sleep(1200); - s = await st(); - check('a tall clip: the pager, no full screen, the screen left alone', s.open && !s.fs && s.orient.length === n, JSON.stringify(s)); - await page.keyboard.press('Escape'); await sleep(600); - } + await openClip('a tall one'); await sleep(1200); + s = await st(); + check('a tall clip: the pager, no full screen, the screen left alone', s.open && !s.fs && !s.orient.some((x) => x.startsWith('lock')), JSON.stringify(s)); + await page.keyboard.press('Escape'); await sleep(600); check('no page errors', errs.length === 0, errs.slice(0, 2).join(' | ')); } finally { await ctx.close(); } } const browser = await puppeteer.launch({ executablePath: '/usr/bin/google-chrome', headless: 'new', args: ['--no-sandbox', '--autoplay-policy=no-user-gesture-required'] }); -try { await run(true); await run(false); } finally { await browser.close(); server.stop(true); } +try { await run(true); } finally { await browser.close(); server.stop(true); } console.log(ok ? '\n✅ the installed app\'s pager skips full screen (and its notice) where it can' : '\n❌ failed'); process.exit(ok ? 0 : 1); |
