19 lines
1.2 KiB
JavaScript
19 lines
1.2 KiB
JavaScript
import { start } from './lib.mjs';
|
|
const BASE = process.env.NEXUS_BASE || 'http://127.0.0.1:18112';
|
|
const pw = process.argv[2]; const S = process.argv[3];
|
|
const b = await start();
|
|
try {
|
|
await b.login(BASE, 'claude', pw);
|
|
await b.viewport(1200, 800, { dsf: 2, mobile: false });
|
|
for (const theme of ['light', 'dark']) {
|
|
await b.send('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-color-scheme', value: theme }] });
|
|
await b.goto(BASE + '/ui/chat');
|
|
for (const [name, sel] of [['Knopf', '#chat button[type=submit]'], ['Link', 'header nav a'], ['Feld', '#chat textarea'], ['Auswahl', '#chat select']]) {
|
|
await b.send('Input.dispatchKeyEvent', { type: 'keyDown', key: 'Tab', code: 'Tab' }); await b.send('Input.dispatchKeyEvent', { type: 'keyUp', key: 'Tab', code: 'Tab' });
|
|
const r = await b.eval(`(() => { const e = document.querySelector(${JSON.stringify(sel)}); e.focus(); const cs = getComputedStyle(e); return JSON.stringify({ trifft: e.matches(':focus-visible'), outline: cs.outlineStyle + ' ' + cs.outlineWidth + ' ' + cs.outlineColor, boxShadow: cs.boxShadow.slice(0, 40) }); })()`);
|
|
console.log(theme, name.padEnd(8), r);
|
|
}
|
|
await b.shot(`${S}/cdp/fokus-${theme}.png`);
|
|
}
|
|
} finally { b.close(); }
|