docs: roadmap log CAD-14 phase 4a+4b + proof test options workflow

This commit is contained in:
Agent Zero
2026-09-16 23:25:22 +02:00
parent d5acf76d0b
commit 2b5905506f
2 changed files with 58 additions and 5 deletions
@@ -23,7 +23,7 @@ interface VerifyWindow {
}
test('zeichnen erzeugt GENAU EIN Element an der Klick-Position', async ({ page }) => {
test.setTimeout(60000);
test.setTimeout(120000);
await page.goto(BASE_URL);
await page.fill('input[type=email]', 'admin@media-on.de');
await page.fill('input[type=password]', 'WebCAD2026!');
@@ -106,12 +106,19 @@ test('zeichnen erzeugt GENAU EIN Element an der Klick-Position', async ({ page }
const drs = await (await fetch(`${BASE_URL}/api/projects/${proj.id}/drawings`, { headers: { Authorization: `Bearer ${token}` } })).json();
let total = 0;
for (const d of drs) {
const els = await (await fetch(`${BASE_URL}/api/drawings/${d.id}/elements`, { headers: { Authorization: `Bearer ${token}` } })).json();
total += els.length;
if (els.length > 0) console.log(`DRAWING ${d.id}: ${els.length} Elemente`);
const raw = await (await fetch(`${BASE_URL}/api/drawings/${d.id}/elements`, { headers: { Authorization: `Bearer ${token}` } })).json();
total += raw.length;
// CAD-14: rohe DB-Zeile hat properties_json (String) — parse und
// melde Elemente mit chordCount (fuer die Options-Abnahme unten).
for (const e of raw) {
const parsed = typeof e.properties_json === 'string' ? JSON.parse(e.properties_json) : (e.properties_json ?? {});
if (parsed && parsed.chordCount !== undefined) {
console.log(`ELEMENT MIT CHORDCOUNT in ${d.id}:`, parsed.chordCount);
}
}
}
dbCount = total;
if (total >= 1) { console.log('GEFUNDEN in drawings:', drs.map((d: any) => d.id)); break; }
if (total >= 1) break;
}
expect(dbCount, `Genau 1 Element muss in der DB landen (vor ${beforeDbCount}, nach ${dbCount})`).toBe(1);
@@ -129,4 +136,49 @@ test('zeichnen erzeugt GENAU EIN Element an der Klick-Position', async ({ page }
});
expect(sel, 'Selection-Bridge muss erreichbar sein').toBeTruthy();
expect(sel!.ids.length, `Genau 1 Element muss ausgewaehlt sein, got ${sel!.ids.length}`).toBe(1);
// ABNAHME 4: Tool-Optionen erreichen das Werkzeug (Phase 4a).
// Traversen-Werkzeug waehlen, chordCount=3 im Options-Panel setzen,
// Traverse ziehen, properties.chordCount muss 3 sein.
await page.locator('[data-v2tool="truss"], [data-tool="truss"]').first().click();
await page.waitForTimeout(300);
const chordInput = page.locator('.tool-options-panel input[type=number]').first();
// chordCount-Feld ueber Label finden (Gurtrohre)
const chordRow = page.locator('.toolopt-row', { hasText: 'Gurtrohre' });
await chordRow.locator('input').fill('3');
await page.waitForTimeout(300);
// Traverse ziehen (wie Linie)
const tStart = cx - 160;
const tStartY = cy + 120;
await page.mouse.move(tStart, tStartY);
await page.mouse.down();
await page.mouse.move(tStart + 150, tStartY, { steps: 6 });
await page.mouse.up();
await page.waitForTimeout(800);
const trussEl = await page.evaluate(() => {
const w = window as unknown as { __cad14Truss?: { id: string; chordCount: number } | null };
return w.__cad14Truss ?? null;
});
// Alternativ: ueber die DB pruefen (Autosave-Poll) — rohe DB-Zeile hat
// properties_json (String), nicht properties.
let chordInDb: unknown = null;
for (let i = 0; i < 8; i++) {
await page.waitForTimeout(5000);
const drs = await (await fetch(`${BASE_URL}/api/projects/${proj.id}/drawings`, { headers: { Authorization: `Bearer ${token}` } })).json();
let found = false;
for (const d of drs) {
const raw = await (await fetch(`${BASE_URL}/api/drawings/${d.id}/elements`, { headers: { Authorization: `Bearer ${token}` } })).json();
for (const e of raw) {
const parsed = typeof e.properties_json === 'string' ? JSON.parse(e.properties_json) : (e.properties_json ?? {});
if (String(e.type) === 'truss' && (parsed as any)?.chordCount === 3) {
chordInDb = parsed.chordCount;
found = true;
break;
}
}
if (found) break;
}
if (chordInDb !== null) break;
}
expect(String(chordInDb), 'chordCount=3 muss beim gezeichneten Element ankommen').toBe('3');
});