Follow the new order and review screens in development browser checks

This commit is contained in:
2026-11-17 22:52:08 +01:00
parent 60f964e0d7
commit b683d6bfb5
8 changed files with 138 additions and 87 deletions
+26 -18
View File
@@ -23,27 +23,35 @@ test('real TLS UI: login, tenant, fixed preview, pending, reload, CSRF denial an
expect(authCookie?.httpOnly).toBe(true); expect(authCookie?.secure).toBe(true); expect(authCookie?.sameSite).toBe('Strict');
await page.getByRole('checkbox', { name: `Ziel ${asset}`, exact: true }).check();
await page.getByRole('link', { name: 'Aufträge', exact: true }).click();
await page.getByRole('link', { name: 'Auftrag planen', exact: true }).click();
await page.getByLabel('Exakte UTF-8 Skriptbytes', { exact: false }).fill("printf '%s\\n' 'Hello World'\n");
await page.getByLabel('Erwartete stdout-Ausgabe', { exact: false }).fill('Hello World\n');
await page.getByRole('link', { name: 'Neuer Auftrag', exact: true }).click();
await page.getByRole('button', { name: 'Weiter zum Skript' }).click();
await page.getByRole('radio', { name: 'Einmaliges Skript' }).check();
await page.getByLabel('Skriptinhalt', { exact: true }).fill("printf '%s\\n' 'Hello World'\n");
await page.getByText('Zeitfenster und Ausführungsoptionen', { exact: true }).click();
await page.getByLabel('Laufzeit je Gerät in Sekunden').fill('60');
await page.getByLabel('Erwartete Standardausgabe (optional)', { exact: true }).fill('Hello World\n');
await page.getByLabel('Begründung', { exact: true }).fill('Authenticated synthetic local fixture · pending-only browser contract; do not execute');
await page.getByRole('button', { name: 'Plan erstellen · noch keine Ausführung' }).click();
const approve = page.getByRole('button', { name: 'SIMULIERT: Diesen festen Plan ausdrücklich genehmigen' });
await expect(approve).toBeDisabled();
await expect(page.getByText('Nicht genehmigungsfähig:', { exact: false })).toHaveCount(0);
await page.getByRole('button', { name: 'Antrag absenden · pending_approval' }).click();
const op = page.locator('section').filter({ has: page.getByRole('heading', { name: /^Antrag \/ Ausführung / }) });
await expect(op.locator('p.warning')).toContainText('Antrag: pending_approval');
await expect(op.locator('pre')).toContainText('"job_count": 0');
await expect(op.locator('pre')).toContainText('"execution_state": null');
const operationHeading = await op.getByRole('heading', { name: /^Antrag \/ Ausführung / }).innerText();
const operationId = operationHeading.replace('Antrag / Ausführung ', '').trim();
await page.getByRole('button', { name: 'Zusammenfassung ansehen' }).click();
const approve = page.getByRole('button', { name: 'SIMULIERT: Genehmigen' });
await expect(approve).toHaveCount(0);
await expect(page.getByRole('button', { name: 'Zur Genehmigung einreichen' })).toBeEnabled();
await page.getByRole('button', { name: 'Zur Genehmigung einreichen' }).click();
const op = page.locator('section[data-operation-id]');
await op.getByText('Technische Auftragsdaten', { exact: true }).click();
await expect(op.getByLabel('Technische Auftragsdaten', { exact: true })).toContainText('"approval_state": "pending_approval"');
await expect(op.getByLabel('Technische Auftragsdaten', { exact: true })).toContainText('"job_count": 0');
await expect(op.getByLabel('Technische Auftragsdaten', { exact: true })).toContainText('"execution_state": null');
const operationId = await op.getAttribute('data-operation-id');
if (!operationId) throw new Error('Operation ID missing');
expect(operationId).toMatch(/^[0-9a-f-]{36}$/);
await page.reload();
await expect(page.getByRole('status')).toContainText('SIMULIERT');
await page.getByRole('button', { name: operationId, exact: true }).click();
await expect(op.locator('p.warning')).toContainText('Antrag: pending_approval');
await page.getByRole('button', { name: 'Unveränderlichen Plan zur Prüfung öffnen' }).click();
await page.getByRole('checkbox', { name: 'Ich habe sämtliche festen Ziele', exact: false }).check();
await expect(op).toHaveAttribute('data-operation-id', operationId);
await op.getByText('Technische Auftragsdaten', { exact: true }).click();
await expect(op.getByLabel('Technische Auftragsdaten', { exact: true })).toContainText('"approval_state": "pending_approval"');
await page.getByRole('button', { name: 'Antrag prüfen' }).click();
await expect(approve).toBeDisabled();
await page.getByRole('checkbox', { name: 'Ich habe die Geräte, den Inhalt und die Ausführungsrechte geprüft.', exact: false }).check();
await expect(approve).toBeEnabled(); // We intentionally do NOT click approval in this run.
expect(authorizationRequests).toBe(0);
// Negative CSRF check uses a real UI logout click, never an authorization request.