24 lines
1.8 KiB
JavaScript
24 lines
1.8 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 b = await start();
|
|
const aendern = a => `(async () => { const cs = document.body.getAttribute('data-csrf'); await fetch('/ui/modelle/${a}', {method:'POST', redirect:'manual', headers:{'content-type':'application/x-www-form-urlencoded'}, body:new URLSearchParams({csrf: cs, name: 'zweit'})}); return 1; })()`;
|
|
const aktiv = `JSON.stringify({tag: document.activeElement.tagName, text: (document.activeElement.textContent || '').trim().slice(0, 14), titel: document.activeElement.title || '', zeile: (document.activeElement.closest('tr') || {textContent: ''}).textContent.trim().slice(0, 10), wert: document.activeElement.value || ''})`;
|
|
try {
|
|
await b.login(BASE, 'claude', pw);
|
|
await b.viewport(1200, 800, { dsf: 1, mobile: false });
|
|
await b.goto(BASE + '/ui/modelle');
|
|
await b.eval(aendern('entladen')); await new Promise(r => setTimeout(r, 5000));
|
|
await b.goto(BASE + '/ui/modelle');
|
|
// Fall 1: Knopf „Bearbeiten“ der Zeile testmodell
|
|
await b.eval(`(() => { const k = Array.from(document.querySelectorAll('button[data-dialog]')).find(x => x.closest('tr').textContent.includes('testmodell')); k.focus(); return 1; })()`);
|
|
console.log('Knopf fokussiert:', await b.eval(aktiv));
|
|
await b.eval(aendern('laden')); await new Promise(r => setTimeout(r, 9000));
|
|
console.log('9 s später :', await b.eval(aktiv));
|
|
// Fall 2: Auswahlfeld „Alle: Engine“
|
|
await b.eval(`(() => { const s = document.querySelector('select'); s.focus(); return 1; })()`);
|
|
console.log('Auswahl fokussiert:', await b.eval(aktiv));
|
|
await b.eval(aendern('entladen')); await new Promise(r => setTimeout(r, 9000));
|
|
console.log('9 s später :', await b.eval(aktiv));
|
|
} finally { b.close(); }
|