diff options
| author | Adam Soltys <[email protected]> | 2026-10-01 06:49:19 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-10-01 06:49:19 -0700 |
| commit | 68ff290e07c0e1786cf8b8f3a87e38872ad7f8ba (patch) | |
| tree | c85847c8f4a06b0a6b7dab8abb2d2eb54fefa226 /tools/feed-wallet-back-test.js | |
| parent | 4b3291fdbd0b34b4d2df91a59bea93885de29508 (diff) | |
| parent | 5ff909d37fe32ba04a841941593d95c7b3498ec3 (diff) | |
| download | coinosv3-68ff290e07c0e1786cf8b8f3a87e38872ad7f8ba.tar.gz coinosv3-68ff290e07c0e1786cf8b8f3a87e38872ad7f8ba.zip | |
Merge prod into master
Diffstat (limited to 'tools/feed-wallet-back-test.js')
| -rw-r--r-- | tools/feed-wallet-back-test.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/feed-wallet-back-test.js b/tools/feed-wallet-back-test.js new file mode 100644 index 0000000..1b0abe7 --- /dev/null +++ b/tools/feed-wallet-back-test.js @@ -0,0 +1,25 @@ +// Exercise the real app history: a public feed must survive Wallet -> Back. +// Run: bun tools/feed-wallet-back-test.js +import assert from 'node:assert/strict'; +import puppeteer from 'puppeteer-core'; +import { buildHtml } from '../build.js'; +const html = await buildHtml({ minify: true, pwa: false }); +const server = Bun.serve({ port: 0, fetch: req => new URL(req.url).pathname === '/api/feed' + ? new Response(null, { status: 404 }) : new Response(html, { headers: { 'content-type': 'text/html; charset=utf-8' } }) }); +const browser = await puppeteer.launch({ executablePath: '/usr/bin/google-chrome', headless: true, args: ['--no-sandbox'] }); +try { + const page = await browser.newPage(); + await page.setViewport({ width: 390, height: 844, isMobile: true, hasTouch: true }); + await page.setRequestInterception(true); + page.on('request', r => r.url().startsWith(server.url.origin) ? r.continue() : r.abort()); + await page.goto(server.url.origin + '/feed', { waitUntil: 'domcontentloaded' }); + await page.waitForSelector('.app-bottom-nav', { visible: true }); + await page.tap('.app-nav-button:nth-child(4)'); + await page.waitForFunction(() => !document.querySelector('.app-bottom-nav')); + assert(!(await page.$('.app-bottom-nav')), 'no nav over the welcome screen'); + await page.goBack({ waitUntil: 'domcontentloaded' }); + await page.waitForSelector('.app-bottom-nav', { visible: true, timeout: 5000 }); + assert(await page.$eval('.app-bottom-nav', e => !e.hidden && e.getBoundingClientRect().height > 0)); + assert.equal(await page.evaluate(() => scrollY), 0, 'visible on return without scrolling'); + console.log('✓ Real browser Back restores the public feed and visible navigation after Wallet'); +} finally { await browser.close(); server.stop(true); } |
