From 686309a584a8e7a13091cb194e42aa09e2aec5d5 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 14 Oct 2026 23:21:55 -0700 Subject: Loop media pager through loaded posts and show position --- tools/profile-pager-test.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/profile-pager-test.js b/tools/profile-pager-test.js index 9006bce..2835b34 100644 --- a/tools/profile-pager-test.js +++ b/tools/profile-pager-test.js @@ -60,7 +60,7 @@ const tapPager = async () => { const at = await page.evaluate(() => { const sc = const rowTop = (word) => page.evaluate((w) => { const r = [...document.querySelectorAll('.notes-feed [data-key]')].find((n) => n.textContent.includes(w)); return r ? Math.round(r.getBoundingClientRect().top) : null; }, word); try { - await page.setViewport({ width: 390, height: 844 }); + await page.setViewport({ width: 390, height: 844, hasTouch: true }); await page.goto(server.url.href, { waitUntil: 'domcontentloaded' }); await page.evaluate(() => localStorage.setItem('btc-wallet-network', 'regtest')); await page.reload({ waitUntil: 'domcontentloaded' }); @@ -101,8 +101,18 @@ try { await page.keyboard.press('ArrowDown'); check('down again: her last', await resting('d.png'), await curPic()); await page.keyboard.press('ArrowDown'); await sleep(600); - check('past her last: the end, not somebody else\'s picture', (await curPic()) !== 'x.png' && !(await page.evaluate(() => [...document.querySelectorAll('.mp-slide')].some((s) => s.getAttribute('data-k').endsWith('/x.png'))))); - await page.keyboard.press('ArrowUp'); await resting('d.png'); // back off the end + check('past her last wraps to her first post', await resting('a2.png'), await curPic()); + check('counter follows sideways position', await page.$eval('.mp-position', (e) => e.textContent) === '2 / 4'); + check('no loading slide', await page.$('.mp-tail') === null); + await page.keyboard.press('ArrowUp'); await resting('d.png'); + check('up from first wraps to last', await curPic() === 'd.png'); + check('counter at the last picture', await page.$eval('.mp-position', (e) => e.textContent) === '4 / 4'); + await page.touchscreen.touchStart(195, 650); + for (let i = 1; i <= 8; i++) { await page.touchscreen.touchMove(195, 650 - 40 * i); await sleep(16); } + await page.touchscreen.touchEnd(); + check('touch swipe wraps to first post', await resting('a2.png'), await curPic()); + await page.evaluate(() => document.querySelector('.media-pager').dispatchEvent(new WheelEvent('wheel', { deltaY: -3, deltaMode: 1, bubbles: true, cancelable: true }))); + check('wheel wraps back to last post', await resting('d.png'), await curPic()); await page.keyboard.press('ArrowUp'); check('up: her post before', await resting('b.png'), await curPic()); await page.keyboard.press('Escape'); -- cgit v1.2.3