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.
59 lines
3.2 KiB
JavaScript
59 lines
3.2 KiB
JavaScript
// Read-only live check of server metadata rendering: connect muted, stay in the default channel,
|
|
// count rendered group labels/icons, channel icons/banners and avatars, screenshot the tree.
|
|
// node scripts/smoke-tree.mjs --server 10.10.10.160:9987 --out docs/evidence/runtime/<name>
|
|
import { launchApp } from './lib/electron-app.mjs';
|
|
import { mkdirSync, writeFileSync, mkdtempSync, rmSync } from 'node:fs';
|
|
import { tmpdir } from 'node:os';
|
|
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
const argv = process.argv.slice(2);
|
|
const opt = (n, d) => (argv.indexOf(`--${n}`) >= 0 ? argv[argv.indexOf(`--${n}`) + 1] : d);
|
|
const out = path.resolve(root, opt('out', 'smoke-out'));
|
|
mkdirSync(out, { recursive: true });
|
|
const profile = mkdtempSync(path.join(tmpdir(), 'teamspeach-tree-'));
|
|
const result = { steps: [], console: [] };
|
|
let app;
|
|
try {
|
|
app = await launchApp({ profile });
|
|
const page = await app.firstWindow();
|
|
page.on('console', (m) => result.console.push(`${m.type()}: ${m.text()}`));
|
|
page.on('pageerror', (e) => result.console.push(`pageerror: ${e.message}`));
|
|
await page.waitForSelector('#view-onboarding', { state: 'visible', timeout: 20000 });
|
|
await page.fill('#onboarding-nick', 'TeamsPeach-Probe');
|
|
await page.click('#onboarding-submit');
|
|
await page.waitForSelector('#view-app', { state: 'visible', timeout: 20000 });
|
|
await page.click('#btn-mute');
|
|
await page.fill('#connect-address', opt('server'));
|
|
await page.click('#connect-submit');
|
|
await page.waitForFunction(() => window.teamspeachDiagnostics.snapshot().conn === 'connected', null, { timeout: 60000 });
|
|
await page.waitForTimeout(8000);
|
|
const counts = await page.evaluate(() => ({
|
|
channels: document.querySelectorAll('#tree .channel-row').length,
|
|
channelIcons: document.querySelectorAll('#tree .channel-icon img').length,
|
|
banners: document.querySelectorAll('#tree .channel-row.has-banner').length,
|
|
groupLabels: Array.from(document.querySelectorAll('#tree .group-label')).filter((e) => !e.hidden).map((e) => e.textContent),
|
|
groupIconImages: document.querySelectorAll('#tree .group-icon img').length,
|
|
builtinBadges: document.querySelectorAll('#tree .group-icon svg').length,
|
|
avatars: document.querySelectorAll('#tree .avatar.has-image').length,
|
|
countries: Array.from(document.querySelectorAll('#tree .country')).map((e) => e.textContent),
|
|
errorToasts: Array.from(document.querySelectorAll('.toast[data-kind="error"]')).map((e) => e.textContent),
|
|
}));
|
|
result.steps.push({ name: 'tree metadata rendered', ...counts });
|
|
console.log(JSON.stringify(counts));
|
|
await page.screenshot({ path: path.join(out, '40-tree-metadata.png') });
|
|
await page.hover('#connection-list .connection-row').then(() => page.click('#connection-list .connection-close'));
|
|
await page.waitForTimeout(800);
|
|
result.ok = counts.errorToasts.length === 0;
|
|
} catch (err) {
|
|
result.ok = false;
|
|
result.error = String(err.stack || err);
|
|
console.error(result.error);
|
|
} finally {
|
|
if (app) await app.close().catch(() => {});
|
|
rmSync(profile, { recursive: true, force: true });
|
|
}
|
|
writeFileSync(path.join(out, 'result.json'), JSON.stringify(result, null, 2));
|
|
process.exit(result.ok ? 0 : 1);
|