Preserve accumulated client implementation since v0.1.4, including local identities, multi-server state, chat, administration, audio and streaming controls. Refine official-source layout, original artwork, responsive composer overflow, settings navigation and chat scroll anchoring. Current verification: Node suite passes; isolated packaged chat and responsive control smokes pass without device capture. Native core is reused, not rebuilt in this pass. Strict whole-screen visual parity remains incomplete; no 1:1 or cross-platform acceptance claim. Local checkpoint only; no release or push.
86 lines
7.7 KiB
JavaScript
86 lines
7.7 KiB
JavaScript
import { installGeneratedStreams, watchGeneratedStream } from './generated-stream.mjs';
|
|
|
|
// Runs inside the existing guarded hidden application. Network state is synthetic; both receivers and
|
|
// their RTP/media are real local WebRTC. A second native connection is created but never connects.
|
|
export async function checkStreamExtras({ app, page, check, screenshot }) {
|
|
const inspect = () => page.evaluate(() => ({
|
|
joins: window.__joins, leaves: [...window.__leaves],
|
|
watches: window.teamspeachDiagnostics.snapshot().watches,
|
|
tiles: [...document.querySelectorAll('.stream-view')].map(tile => ({ id: tile.dataset.streamId, hidden: tile.hidden,
|
|
x: tile.getBoundingClientRect().x, y: tile.getBoundingClientRect().y, width: tile.getBoundingClientRect().width,
|
|
height: tile.getBoundingClientRect().height, aspect: tile.querySelector('video').videoWidth / tile.querySelector('video').videoHeight })),
|
|
}));
|
|
await app.evaluate(({ BrowserWindow }) => BrowserWindow.getAllWindows()[0].setContentSize(1600, 1000));
|
|
await page.waitForTimeout(100);
|
|
const before = await inspect();
|
|
await page.evaluate(() => document.querySelector('[data-stream-id="stage-mira"] [data-role="stream-hide"]').click());
|
|
check(await page.locator('[data-stream-id="stage-mira"]').isHidden(), 'Hide removes a tile from layout, not its receiving session');
|
|
await page.evaluate(() => document.querySelector('.stream-hidden-list button').click());
|
|
const shown = await inspect();
|
|
check(shown.joins === before.joins && shown.leaves.length === before.leaves.length && shown.watches.length === before.watches.length,
|
|
'Show restores the existing receiver without join/leave', { before, shown });
|
|
await page.evaluate(() => document.querySelector('[data-stream-id="stage-mira"] .stream-tile-order').click());
|
|
const focused = await inspect();
|
|
const focusTile = focused.tiles.find(tile => tile.id === 'stage-mira'), stripTile = focused.tiles.find(tile => tile.id === 'stage-oleg');
|
|
check(!stripTile.hidden && focusTile.width * focusTile.height > stripTile.width * stripTile.height, 'Focus enlarges one receiver and preserves a visible secondary strip', focused.tiles);
|
|
await page.evaluate(() => document.querySelector('.stream-layout-menu > button').click());
|
|
check(await page.locator('[data-stream-id="stage-oleg"]').isVisible(), 'Automatic layout resets focus');
|
|
await page.locator('[data-stream-id="stage-oleg"] .stream-tile-order').focus();
|
|
await page.keyboard.press('Alt+ArrowLeft');
|
|
const reordered = await inspect();
|
|
const first = reordered.tiles.find(tile => tile.id === 'stage-mira'), second = reordered.tiles.find(tile => tile.id === 'stage-oleg');
|
|
check(second.y < first.y || (second.y === first.y && second.x < first.x), 'Alt+arrow changes tile order', reordered.tiles);
|
|
await page.locator('[data-stream-id="stage-mira"] .stream-tile-order').dragTo(page.locator('[data-stream-id="stage-oleg"]'));
|
|
const dragged = await inspect();
|
|
const a = dragged.tiles.find(tile => tile.id === 'stage-mira'), b = dragged.tiles.find(tile => tile.id === 'stage-oleg');
|
|
check(a.y < b.y || (a.y === b.y && a.x < b.x), 'Hidden Chromium drag reorders existing tiles', dragged.tiles);
|
|
check(dragged.tiles.filter(tile => !tile.hidden).every(tile => Math.abs(tile.width / tile.height - tile.aspect) < 0.02),
|
|
'Tile rectangles use actual decoded source aspect', dragged.tiles);
|
|
await page.keyboard.down('Shift');
|
|
try { await page.locator('[data-stream-id="stage-oleg"] .stream-tile-order').dragTo(page.locator('[data-stream-id="stage-mira"]')); }
|
|
finally { await page.keyboard.up('Shift'); }
|
|
check(await page.locator('[data-stream-id="stage-oleg"]').getAttribute('data-layout-pip') === 'true', 'Shift drag creates internal tile overlay without native PiP');
|
|
await screenshot('stream-extras-internal-pip');
|
|
await page.locator('[data-stream-id="stage-oleg"] .stream-tile-unpin').click();
|
|
check(await page.locator('[data-stream-id="stage-oleg"]').getAttribute('data-layout-pip') !== 'true', 'Unpin returns existing receiver to normal grid');
|
|
await page.evaluate(() => document.querySelector('.stream-layout-menu > button:nth-child(2)').click());
|
|
check(await page.locator('#server-tree-overlay #stream-area').count() === 1, 'Tree overlay moves the existing stage');
|
|
await screenshot('stream-extras-tree-overlay');
|
|
await page.evaluate(() => document.querySelector('.stream-layout-menu > button:nth-child(2)').click());
|
|
check((await inspect()).joins === before.joins, 'Moving stage back does not subscribe again');
|
|
|
|
await app.evaluate(({ BrowserWindow }) => BrowserWindow.getAllWindows()[0].setContentSize(880, 560));
|
|
await page.evaluate(async () => { const { S } = await import('./js/state.js'); S.prefs.streamStageRatio = 0.15; (await import('./js/watch.js')).applyWatchPrefs(); });
|
|
await page.waitForFunction(() => document.querySelectorAll('.stream-pagination button').length >= 2);
|
|
await page.locator('.stream-pagination button').nth(1).click();
|
|
check(await page.locator('.stream-pagination button').nth(1).getAttribute('aria-current') === 'page', 'Page control selects the next real tile page');
|
|
await screenshot('stream-extras-pagination');
|
|
await page.evaluate(async () => { const { S } = await import('./js/state.js'); S.prefs.streamStageRatio = 0.55; (await import('./js/watch.js')).applyWatchPrefs(); document.querySelector('.stream-layout-menu > button').click(); });
|
|
|
|
const created = await page.evaluate(() => window.teamspeach.createConnection());
|
|
if (!created?.ok) throw new Error(`Second native connection failed: ${JSON.stringify(created)}`);
|
|
const id = created.connection.id;
|
|
await page.waitForFunction(id => window.teamspeachDiagnostics.snapshot().connections.some(conn => conn.id === id && conn.core === 'ready'), id);
|
|
await page.evaluate(async id => { (await import('./js/state.js')).connectionById(id).inputEnabled = false; }, id);
|
|
const snapshot = await page.evaluate(async () => structuredClone((await import('./js/state.js')).connectionById('c1').snap));
|
|
await app.evaluate(({ BrowserWindow }, { id, snapshot }) => {
|
|
const wc = BrowserWindow.getAllWindows()[0].webContents;
|
|
wc.send('core:event', { connectionId: id, event: 'audio_state', input_muted: true, output_muted: true, transmitting: false });
|
|
wc.send('core:event', { connectionId: id, event: 'state', state: 'connected', address: 'fixture-second.invalid', reason: null });
|
|
wc.send('core:event', { ...snapshot, event: 'snapshot', connectionId: id });
|
|
}, { id, snapshot });
|
|
await page.locator(`[data-connection-id="${id}"] .connection-item`).click();
|
|
await installGeneratedStreams(page, [['stage-mira', 11, 'Second connection — same stream id', '#374965']], id);
|
|
await watchGeneratedStream(page, 'stage-mira');
|
|
const multi = await inspect();
|
|
check(multi.watches.filter(w => w.id === 'stage-mira').length === 2 && multi.watches.some(w => w.connectionId === id && w.framesDecoded > 10),
|
|
'Same stream id on two connections owns independent decoded receivers', multi.watches);
|
|
await page.locator('[data-connection-id="c1"] .connection-item').click();
|
|
const c1Before = (await inspect()).watches.filter(w => w.connectionId === 'c1');
|
|
const closed = await page.evaluate(id => window.teamspeach.closeConnection(id), id);
|
|
if (!closed?.ok) throw new Error(`Second native connection close failed: ${JSON.stringify(closed)}`);
|
|
await page.waitForFunction(() => window.teamspeachDiagnostics.snapshot().watches.every(w => w.connectionId === 'c1'));
|
|
await page.waitForFunction(previous => previous.every(old => window.teamspeachDiagnostics.snapshot().watches.some(now => now.connectionId === old.connectionId && now.id === old.id && now.framesDecoded > old.framesDecoded)), c1Before);
|
|
check(true, 'Closing second connection leaves first connection receivers decoding');
|
|
}
|