weavesignal/tests/wizard/shoot.mjs
The WeaveSignal contributors a9e61f1cba WeaveSignal 1.1.0
CHANGELOG.md has the detail, and deploy/cloudron/CHANGELOG.md the package's.

- Hosts in their own studios: a host sends from BUTT, Mixxx, OBS, vMix or ffmpeg over
  Icecast or SRT with a show key; the feed stands by on the desk, the schedule hands over
  at the post, and automation covers a dropped link.
- A monitor link for each host: their state, the counts, their return and their controls.
- The desk's counts turn amber, then red; Ctrl+R twice restarts playout; the studio app's
  version in the top bar.
- A station that is not set up yet says so.
- The studio app's chat and the per-address limits fixed on Cloudron.
2026-11-18 08:37:44 +00:00

55 lines
2.1 KiB
JavaScript

// SPDX-License-Identifier: AGPL-3.0-only
// SPDX-FileCopyrightText: 2026 The WeaveSignal contributors
//
// Screenshots of one page at the three sizes the wizards are checked at, in both themes
// (ADR-0237): 1,440 x 900, 390 x 844 (a phone) and 2,560 x 1,440.
//
// PLAYWRIGHT_CORE=/path/to/node_modules/playwright-core \
// node tests/wizard/shoot.mjs http://127.0.0.1:18950/index.html target/wizard/player
//
// writes target/wizard/player-1440-dark.png and so on. Playwright is not a dependency of the
// repository (see tests/m2/drive.mjs).
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const { chromium } = require(process.env.PLAYWRIGHT_CORE ?? 'playwright-core');
export const SIZES = [
{ name: '1440', width: 1440, height: 900 },
{ name: '390', width: 390, height: 844, mobile: true },
{ name: '2560', width: 2560, height: 1440 },
];
export const THEMES = ['dark', 'light'];
/** Run `each(page, {size, theme})` in a fresh context per size and theme. */
export async function everySize(browser, each) {
for (const size of SIZES) {
for (const theme of THEMES) {
const context = await browser.newContext({
viewport: { width: size.width, height: size.height },
deviceScaleFactor: 1,
isMobile: !!size.mobile,
hasTouch: !!size.mobile,
colorScheme: theme,
reducedMotion: 'reduce',
});
const page = await context.newPage();
await each(page, { size, theme });
await context.close();
}
}
}
if (import.meta.url === `file://${process.argv[1]}`) {
const [url, out] = process.argv.slice(2);
if (!url || !out) {
console.error('usage: shoot.mjs <url> <output prefix>');
process.exit(2);
}
const browser = await chromium.launch({ headless: true, executablePath: process.env.CHROMIUM });
await everySize(browser, async (page, { size, theme }) => {
await page.goto(url, { waitUntil: 'networkidle' });
await page.waitForTimeout(300);
await page.screenshot({ path: `${out}-${size.name}-${theme}.png`, fullPage: true });
});
await browser.close();
}