aboutsummaryrefslogtreecommitdiffstats
path: root/tools/feed-custom-test.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-07 08:40:21 -0700
committerAdam Soltys <[email protected]>2026-10-07 08:40:21 -0700
commit3aff6e4cc9eb97fc0fa488f1f95001f69f24330a (patch)
tree932ed498851f9e2167a1c1419c96d630be0d02e2 /tools/feed-custom-test.js
parent6d288aeb194d2765282cf9fd72bd1f5fdd747a71 (diff)
parent6c51dcf2542314d5fe883f756f0840ef51860d67 (diff)
downloadcoinosv3-3aff6e4cc9eb97fc0fa488f1f95001f69f24330a.tar.gz
coinosv3-3aff6e4cc9eb97fc0fa488f1f95001f69f24330a.zip
Merge branch 'worktree-agent-ad1d843e9e394974e'
Diffstat (limited to 'tools/feed-custom-test.js')
-rw-r--r--tools/feed-custom-test.js27
1 files changed, 16 insertions, 11 deletions
diff --git a/tools/feed-custom-test.js b/tools/feed-custom-test.js
index 039b166..c2c94de 100644
--- a/tools/feed-custom-test.js
+++ b/tools/feed-custom-test.js
@@ -73,7 +73,10 @@ const errs = [];
page.on('pageerror', (e) => errs.push(String(e)));
const click = (t) => page.evaluate((x) => { const e = [...document.querySelectorAll('button')].find((n) => n.textContent.trim().toLowerCase().includes(x)); if (e) { e.click(); return true; } return false; }, t);
const waitText = async (x, ms = 25000) => { for (let i = 0; i < ms / 250; i++) { if ((await page.evaluate(() => document.body.innerText)).toLowerCase().includes(x)) return true; await sleep(250); } return false; };
-const chips = () => page.evaluate(() => [...document.querySelectorAll('.feed-chip')].map((c) => (c.classList.contains('on') ? '*' : '') + c.textContent.trim()));
+// the feeds' own chips (not the All / Images / … view switch under them)
+const chips = () => page.evaluate(() => [...document.querySelectorAll('.feed-chips > .feed-chip')].map((c) => (c.classList.contains('on') ? '*' : '') + c.textContent.trim()));
+// the Feed is a tab in the bottom nav (it was a row on the chat home)
+const openFeed = () => page.evaluate(() => [...document.querySelectorAll('.app-nav-button')].find((b) => b.getAttribute('aria-label') === 'Feed')?.click());
const type = async (sel, text) => {
await page.evaluate((q) => { const i = document.querySelector(q); i.value = ''; i.dispatchEvent(new Event('input', { bubbles: true })); }, sel);
await page.click(sel); await page.type(sel, text);
@@ -99,12 +102,11 @@ try {
await page.evaluate(([k, pk, ns]) => {
localStorage.setItem(k + ':follows', JSON.stringify({ tags: [['p', pk]], c: '', at: Math.floor(Date.now() / 1000) }));
localStorage.setItem(k + ':feedNotes', JSON.stringify(ns));
+ localStorage.setItem('btc-wallet-feed:' + k, 'following'); // a wallet with no feed remembered opens on Popular
}, [base, AUTHOR, seeded]);
await page.reload({ waitUntil: 'domcontentloaded' });
await waitText('receive', 20000);
- await page.evaluate(() => { const b = [...document.querySelectorAll('button')].find((e) => /message/i.test(e.getAttribute('aria-label') || '')); if (b) b.click(); });
- await sleep(800);
- await page.evaluate(() => { const e = [...document.querySelectorAll('.item')].find((n) => /feed/i.test(n.textContent)); if (e) e.click(); });
+ await openFeed();
await sleep(1200);
check('the feed opens on Following, with a + chip', JSON.stringify(await chips()) === JSON.stringify(['*Following', 'Popular', '#gardenstr', '+']), JSON.stringify(await chips()));
@@ -112,7 +114,7 @@ try {
await page.click('.feed-chip.add'); await sleep(300);
check('the editor opens', await waitText('new feed', 3000));
await type('input[placeholder="e.g. Bitcoin builders"]', 'Coin talk');
- await page.click('input[type=checkbox]');
+ await page.click('input[type=checkbox]:not(.feed-all-toggle)'); // everyone I follow (the first box is the relays' every-post one)
await type('input[placeholder="#bitcoin #nostr"]', '#Bitcoin, lightning');
await click('save'); await sleep(1500);
check('the new feed is on screen and selected', JSON.stringify(await chips()) === JSON.stringify(['Following', 'Popular', '#gardenstr', '*Coin talk', '+']), JSON.stringify(await chips()));
@@ -157,15 +159,18 @@ try {
console.log('\n[the feeds survive a reload; a feed can be deleted]');
await page.reload({ waitUntil: 'domcontentloaded' });
await waitText('receive', 20000);
- await page.evaluate(() => { const b = [...document.querySelectorAll('button')].find((e) => /message/i.test(e.getAttribute('aria-label') || '')); if (b) b.click(); }); await sleep(800);
- await page.evaluate(() => { const e = [...document.querySelectorAll('.item')].find((n) => /feed/i.test(n.textContent)); if (e) e.click(); }); await sleep(1200);
- check('the saved feeds are still there; the session topic is not', JSON.stringify(await chips()) === JSON.stringify(['*Following', 'Popular', '#gardenstr', 'Coin talk', 'Pack feed', '+']), JSON.stringify(await chips()));
- check('the home list shows the pack feed with its pack', await page.evaluate(() => { const b = document.querySelector('.chat-back'); if (b) b.click(); return !!b; }) && await waitText('test pack', 3000));
- await page.evaluate(() => { const e = [...document.querySelectorAll('.item')].find((n) => (n.querySelector('.chat-name') || {}).textContent === 'Feed'); if (e) e.click(); }); await sleep(800);
+ await openFeed(); await sleep(1200);
+ // (the feed you were on is remembered: the pack feed, saved last)
+ check('the saved feeds are still there; the session topic is not', JSON.stringify(await chips()) === JSON.stringify(['Following', 'Popular', '#gardenstr', 'Coin talk', '*Pack feed', '+']), JSON.stringify(await chips()));
+ // (the chat home no longer lists the feed with its summary: its editor shows the pack)
+ await page.click('[aria-label="Feed options"]'); await sleep(300);
+ await page.evaluate(() => [...document.querySelectorAll('.msg-sheet button')].find((b) => /edit feed/i.test(b.textContent)).click()); await sleep(400);
+ check('the pack feed kept its pack', await waitText('test pack', 3000));
+ await page.click('.chat-back'); await sleep(600);
await page.evaluate(() => [...document.querySelectorAll('.feed-chip')].find((c) => c.textContent.trim() === 'Coin talk').click()); await sleep(800);
await page.click('[aria-label="Feed options"]'); await sleep(300); // the editor lives in the feed's ⋯ menu now
await page.evaluate(() => [...document.querySelectorAll('.msg-sheet button')].find((b) => /edit feed/i.test(b.textContent)).click()); await sleep(400);
- check('the editor shows what was saved', await page.evaluate(() => document.querySelector('input[placeholder="#bitcoin #nostr"]').value === '#bitcoin #lightning' && document.querySelector('input[type=checkbox]').checked));
+ check('the editor shows what was saved', await page.evaluate(() => document.querySelector('input[placeholder="#bitcoin #nostr"]').value === '#bitcoin #lightning' && document.querySelector('input[type=checkbox]:not(.feed-all-toggle)').checked));
await click('delete feed'); await sleep(1000);
check('deleting it lands back on Following', JSON.stringify(await chips()) === JSON.stringify(['*Following', 'Popular', '#gardenstr', 'Pack feed', '+']), JSON.stringify(await chips()));
check('no page errors', errs.length === 0, errs.slice(0, 2).join(' | '));