aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-07 08:26:57 -0700
committerAdam Soltys <[email protected]>2026-10-07 08:26:57 -0700
commit190d27995e751ad3f64d84832ea3358765bc5c63 (patch)
tree142c75b409c4a78903b5a71a316a9b41e02dd006
parentf247eb1de2941c4ef51378f0b773d1d2a1434c7f (diff)
downloadcoinosv3-190d27995e751ad3f64d84832ea3358765bc5c63.tar.gz
coinosv3-190d27995e751ad3f64d84832ea3358765bc5c63.zip
unread-dot, sw-reload tests follow the bottom nav and the split build
- unread-dot: the front door's way to import is Create a new wallet → Have an existing seed; the dot is the Messages bottom-nav button's - sw-reload: the split build loads app-<token>.js, so a restamped build asks for app-deadbeef….js; serve the real entry for it Co-Authored-By: Claude Opus 5.5 <[email protected]>
-rw-r--r--tools/sw-reload-test.js4
-rw-r--r--tools/unread-dot-test.js14
2 files changed, 10 insertions, 8 deletions
diff --git a/tools/sw-reload-test.js b/tools/sw-reload-test.js
index a869d9d..7a41c7f 100644
--- a/tools/sw-reload-test.js
+++ b/tools/sw-reload-test.js
@@ -32,7 +32,9 @@ const server = Bun.serve({
if (p === '/' || p === '/index.html') return new Response(current.html, { headers: { 'content-type': 'text/html', 'cache-control': 'no-store' } });
// The worker precaches the shell during install and addAll rejects on any
// miss — a 404 here means it never activates and the test proves nothing.
- const f = Bun.file('dist' + p);
+ // The split build names its entry after the token (app-<token>.js), so
+ // a restamped build asks for app-deadbeef….js: the same file.
+ const f = Bun.file('dist' + p.replace(/deadbeef0000\d/, token));
return new Response(f, { headers: { 'cache-control': 'no-store' } });
},
});
diff --git a/tools/unread-dot-test.js b/tools/unread-dot-test.js
index 839105a..b98388a 100644
--- a/tools/unread-dot-test.js
+++ b/tools/unread-dot-test.js
@@ -1,4 +1,4 @@
-// The unread dot either says someone is waiting or it doesn't — it must not
+// The unread dot (on Messages in the bottom nav) either says someone is waiting or it doesn't — it must not
// flash on the way in. render() rebuilds the whole DOM, so any entrance
// animation on the dot replays on every repaint; an earlier build popped it
// seven times in the first seconds after a refresh, which reads as flashing.
@@ -23,7 +23,7 @@ try {
await page.evaluate(() => localStorage.setItem('btc-wallet-network', 'regtest'));
await page.reload({ waitUntil: 'domcontentloaded' });
await sleep(400);
- await click('button', 'I already have a wallet');
+ await click('button', 'Create a new wallet');
await sleep(300);
await click('button', 'Have an existing seed');
await sleep(300);
@@ -36,11 +36,11 @@ try {
// Now the refresh the report is about.
await page.evaluate(() => {
window.__dot = { anims: 0, appear: 0, disappear: 0, renders: 0 };
- addEventListener('animationstart', (e) => { if (e.target && e.target.classList && e.target.classList.contains('header-msgs')) window.__dot.anims++; }, true);
+ addEventListener('animationstart', (e) => { if (e.target && e.target.classList && e.target.closest && e.target.closest('.app-nav-button')) window.__dot.anims++; }, true);
let had = null;
new MutationObserver(() => {
window.__dot.renders++;
- const now = !!document.querySelector('.header-msgs.unread');
+ const now = [...document.querySelectorAll('.app-nav-button.unread')].some((b) => /messages/i.test(b.getAttribute('aria-label') || ''));
if (had !== null && now !== had) { if (now) window.__dot.appear++; else window.__dot.disappear++; }
had = now;
}).observe(document.getElementById('app'), { childList: true, subtree: true });
@@ -49,17 +49,17 @@ try {
// re-arm after the reload wipes it
await page.evaluate(() => {
window.__dot = { anims: 0, appear: 0, disappear: 0, renders: 0 };
- addEventListener('animationstart', (e) => { if (e.target && e.target.classList && e.target.classList.contains('header-msgs')) window.__dot.anims++; }, true);
+ addEventListener('animationstart', (e) => { if (e.target && e.target.classList && e.target.closest && e.target.closest('.app-nav-button')) window.__dot.anims++; }, true);
let had = null;
new MutationObserver(() => {
window.__dot.renders++;
- const now = !!document.querySelector('.header-msgs.unread');
+ const now = [...document.querySelectorAll('.app-nav-button.unread')].some((b) => /messages/i.test(b.getAttribute('aria-label') || ''));
if (had !== null && now !== had) { if (now) window.__dot.appear++; else window.__dot.disappear++; }
had = now;
}).observe(document.body, { childList: true, subtree: true });
});
await sleep(12000);
- const r = await page.evaluate(() => ({ ...window.__dot, dotNow: !!document.querySelector('.header-msgs.unread') }));
+ const r = await page.evaluate(() => ({ ...window.__dot, dotNow: [...document.querySelectorAll('.app-nav-button.unread')].some((b) => /messages/i.test(b.getAttribute('aria-label') || '')) }));
console.log('over 12s after a refresh:');
const check = (n, c, d = '') => { console.log(` ${c ? '✓' : '✗'} ${n}${d ? ' — ' + d : ''}`); if (!c) ok = false; };
check('the dot never animates', r.anims === 0, `${r.anims} animation(s) started`);