diff options
Diffstat (limited to 'tools/fullscreen-notice-test.js')
| -rw-r--r-- | tools/fullscreen-notice-test.js | 32 |
1 files changed, 11 insertions, 21 deletions
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); |
