aboutsummaryrefslogtreecommitdiffstats
path: root/tools/compose-preview-test.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/compose-preview-test.js')
-rw-r--r--tools/compose-preview-test.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/compose-preview-test.js b/tools/compose-preview-test.js
index 2138ea6..c943655 100644
--- a/tools/compose-preview-test.js
+++ b/tools/compose-preview-test.js
@@ -53,6 +53,8 @@ try {
await page.evaluate(([k, n]) => {
localStorage.setItem(k + ':follows', JSON.stringify({ tags: [['p', n.pubkey]], c: '', at: Math.floor(Date.now() / 1000) }));
localStorage.setItem(k + ':feedNotes', JSON.stringify([n]));
+ localStorage.setItem(k + ':profiles', JSON.stringify({ [n.pubkey]: { name: 'fiatjaf', t: Date.now() } }));
+ localStorage.setItem('btc-wallet-feed:' + k, 'following'); // new wallets open on Popular
}, [base, {
id: 'f'.repeat(63) + '1', pubkey: '3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d',
kind: 1, created_at: Math.floor(Date.now() / 1000) - 60, content: 'a post to answer', tags: [],
@@ -61,10 +63,8 @@ try {
await waitText('receive', 20000);
// into the feed, where posts are written
- await page.evaluate(() => { const b = [...document.querySelectorAll('button')].find((e) => /message/i.test(e.getAttribute('aria-label') || '')); if (b) b.click(); });
- await sleep(1000);
- await page.evaluate(() => { const e = [...document.querySelectorAll('.item')].find((n) => /feed/i.test(n.textContent)); if (e) e.click(); });
- await sleep(2500);
+ await page.evaluate(() => document.querySelector('.app-nav-button[aria-label="Feed"]').click());
+ for (let i = 0; i < 60 && !(await page.$('.notes-feed:not([data-booting]) > .row')); i++) await sleep(250);
const opened = await page.evaluate(() => { const b = [...document.querySelectorAll('button')].find((n) => (n.getAttribute('aria-label') || n.textContent).trim().toLowerCase() === 'new post'); if (b) { b.click(); return true; } return false; });
check('the composer opens', opened && !!(await page.$('coinos-text')));
@@ -98,8 +98,9 @@ try {
/plus a word/.test(await page.evaluate(() => (document.querySelector('.draft-preview') || {}).innerText || '')));
// and it puts itself away
+ // (the same Preview button, pressed: a toggle)
await page.evaluate(() => [...document.querySelectorAll('button')]
- .find((b) => /hide preview/i.test(b.getAttribute('aria-label') || ''))?.click());
+ .find((b) => /preview/i.test(b.getAttribute('aria-label') || '') && b.getAttribute('aria-pressed') === 'true')?.click());
await sleep(500);
check('and it closes again', !(await page.$('.draft-preview')));