test: Klicktests admin2ereignisse.1 bis .4 bestanden (#1211)

Prozess admin2ereignisse angelegt; .1 bis .4 gegen eine lokale Testinstanz mit Seed-Daten ✓,
Berichte in testberichte/. .5 (echte Ereignisse aus dem Betrieb) offen.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-23 09:34:14 +01:00
parent 92365da7ad
commit efc66cdb6d
7 changed files with 70 additions and 1 deletions

View File

@ -0,0 +1,22 @@
// admin2ereignisse.4 (#1211): Zugriff für Nutzer und Lage der Überschriften über der fixierten Kopfzeile.
// Aufruf: node ereignisse-zugriff.mjs <Admin-Passwort> <Nutzer-Passwort>. Umgebung: NEXUS_BASE (Standard http://127.0.0.1:18119 als Basis in der Datei).
import * as cdp from './lib.mjs';
const BASE = process.env.NEXUS_BASE || 'http://127.0.0.1:18119';
const b = await cdp.start({ port: 9380 });
const sleep = ms => new Promise(r => setTimeout(r, ms));
const res = [];
const ok = (n, c, d = '') => { res.push(!!c); console.log((c ? 'ok ' : 'FEHLER') + ' ' + n + (d ? ' – ' + d : '')); };
try {
await b.login(BASE, 'nutzer', process.argv[3]);
const s1 = await b.eval(`fetch('/ui/api/historie?fenster=1h&reihe=gpu_speicher_mb').then(r => r.status)`);
const s2 = await b.eval(`fetch('/ui/verlauf').then(r => r.status)`);
ok('Nutzer: Verlaufs-API 403', s1 === 403, 'Status ' + s1);
ok('Nutzer: Seite Verlauf 403', s2 === 403, 'Status ' + s2);
await b.login(BASE, 'claude', process.argv[2]);
for (const id of ['verlauf-ereignisse', 'verlauf-gruppe-gpu']) {
await b.goto(BASE + '/ui/verlauf'); await sleep(1500);
const r = await b.eval(`(() => { document.getElementById('${id}').scrollIntoView(); const h = document.querySelector('header').getBoundingClientRect().bottom; const t = document.querySelector('#${id} h2').getBoundingClientRect().top; return { h: Math.round(h), t: Math.round(t), ok: t >= h }; })()`);
ok('Überschrift über der Kopfzeile: ' + id, r.ok, JSON.stringify(r));
}
} finally { b.close(); }
console.log(res.every(Boolean) ? 'ERGEBNIS: alle ' + res.length + ' ok' : 'ERGEBNIS: Fehler');