openvibers/openvibe.live Commits

Live browser smoke: the Frame's page-view beacon is plumbing; SPA mode counts only the gate's own writes (#134)

OP OpenVibers committed 29 days ago · 298d82afb5 · 1 file, +6 −3

Two false failures came from running the browser smoke test against production (`BASE=https://openvibe.live`):

- **The Frame's page-view beacon:** the guest `/broadcast` sign-in gate counted `POST openvibe.network/api/frame/hit` as the page writing. That beacon is analytics plumbing like Live's own `/api/analytics`, so it is now allowed with it.
- **Home-page requests:** in SPA mode the check also counted the home page's own requests made before the move, such as a card asking for a missing thumbnail (`POST /api/thumbnails/generate/vod/5747`, an audio-only recording; Media#127 makes that answer immediate). It now counts only what happens after navigating to `/broadcast`.

With `CHANNEL=/@JapaneseOldGuy` (production has no `/@admin`), `BASE=https://openvibe.live npm run test:browser` passes every check. Test only.

Changes

ddiff --git a/test/browser/smoke.js b/test/browser/smoke.js
iindex 32cd365b..82d59e96 100644
---- a/test/browser/smoke.js
++++ b/test/browser/smoke.js
@@@ -215,14 +215,17 @@ const pageState = `(() => ({
if (!ONLY_SIGNED && !ROUTES_ONLY) {
const { cdp, errors } = await openPage(412);
const writes = [];
-- // Session plumbing (a guest's token refresh) and analytics beacons are not the page acting.
-- const plumbing = /\/api\/(auth\/|analytics)/;
++ // Session plumbing (a guest's token refresh) and analytics beacons (Live's own, and the OpenVibe Frame's
++ // page-view hit on openvibe.network) are not the page acting.
++ const plumbing = /\/api\/(auth\/|analytics|frame\/hit)/;
cdp.on('Network.requestWillBeSent', (p) => { if (p.request.method !== 'GET' && p.request.method !== 'HEAD' && p.request.url.includes('/api/') && !plumbing.test(p.request.url)) writes.push(`${p.request.method} ${p.request.url.replace(BASE, '')}`); });
for (const mode of ['direct', 'spa']) {
errors.length = 0;
writes.length = 0;
if (mode === 'direct') { await cdp.send('Page.navigate', { url: BASE + '/broadcast' }); await sleep(SETTLE); }
-- else { await cdp.send('Page.navigate', { url: BASE + '/' }); await sleep(SETTLE); await cdp.evaluate('navigate("/broadcast")'); await sleep(SETTLE); }
++ // In SPA mode only what happens after the move counts: the home page's own requests (a card asking for a
++ // missing thumbnail) are the home page acting, not the gate.
++ else { await cdp.send('Page.navigate', { url: BASE + '/' }); await sleep(SETTLE); writes.length = 0; await cdp.evaluate('navigate("/broadcast")'); await sleep(SETTLE); }
const st = await cdp.evaluate(`(() => {
const gate = document.getElementById('bc-signin-gate');
const ws = document.getElementById('bc-workspace');