aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/live-stream-test.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/live-stream-test.js b/tools/live-stream-test.js
index 56dcb71..cf5e056 100644
--- a/tools/live-stream-test.js
+++ b/tools/live-stream-test.js
@@ -224,6 +224,30 @@ try {
const rowSel = '.live-message[data-key="' + chat.id + '"]';
check('comments use the group-chat bubble and shared composer', await page.$(rowSel + ' .chat-bubble') && await page.$('.live-page coinos-text#msg-draft'));
check('...drawn plain on a phone, no bubble walls', await page.evaluate((q) => { const b = document.querySelector(q); return b && getComputedStyle(b).borderStyle === 'none' && getComputedStyle(b).display === 'block'; }, rowSel + ' .chat-bubble'));
+ // the message box is on screen without scrolling the page: the chat takes
+ // the room left under the stream, down to the nav (it was a fixed 60vh and
+ // the card ran off the bottom, where a swipe inside the chat couldn't
+ // bring it up)
+ {
+ const fit = await page.evaluate(() => {
+ window.scrollTo(0, 0);
+ const r = (q) => document.querySelector(q)?.getBoundingClientRect();
+ const box = r('.live-page coinos-text#msg-draft'), nav = r('.app-bottom-nav'), chat = document.querySelector('.live-page .live-chat');
+ return { box: box && Math.round(box.bottom), nav: nav ? Math.round(nav.top) : innerHeight, chat: chat.clientHeight, behaviour: getComputedStyle(chat).overscrollBehaviorY };
+ });
+ check('on a phone the message box sits on screen, over the nav', fit.box && fit.box <= fit.nav && fit.chat >= 120, JSON.stringify(fit));
+ check('...and the chat no longer holds a scroll that reaches its end', fit.behaviour === 'auto');
+ // a wall of chat: the box stays where it is, the newest line just above it
+ await page.addStyleTag({ content: '.live-page .live-chat::before{content:"";flex:none;height:3000px}' }).then((el) => el.evaluate((n) => { n.id = 'tall-chat'; }));
+ await page.evaluate(() => { const c = document.querySelector('.live-page .live-chat'); c.scrollTop = c.scrollHeight; });
+ const tall = await page.evaluate(() => {
+ const r = (q) => document.querySelector(q)?.getBoundingClientRect();
+ const c = document.querySelector('.live-page .live-chat'), last = c.lastElementChild.getBoundingClientRect(), nav = r('.app-bottom-nav');
+ return { box: Math.round(r('.live-page coinos-text#msg-draft').bottom), nav: nav ? Math.round(nav.top) : innerHeight, last: Math.round(last.bottom), chatBottom: Math.round(c.getBoundingClientRect().bottom), pageY: window.scrollY };
+ });
+ check('...with a long chat too, the newest line showing above it', tall.box <= tall.nav && tall.last <= tall.chatBottom + 1 && tall.pageY === 0, JSON.stringify(tall));
+ await page.evaluate(() => document.getElementById('tall-chat')?.remove());
+ }
check('another client’s e-only reaction arrives on the comment', await waitFor(id => document.querySelector('.live-message[data-key="'+id+'"] .chat-reacts')?.textContent.includes('👍'), 6000, chat.id));
check('per-comment zap receipts show under the bubble', await waitFor(id => document.querySelector('.live-message[data-key="'+id+'"] .zap-tally')?.textContent.includes('5'), 6000, chat.id));
await page.click(rowSel + ' .chat-bubble');