Follow the new order and review screens in development browser checks
This commit is contained in:
@@ -20,21 +20,30 @@ test('dev/test browser simulation: login → fixed plan → pending → explicit
|
||||
await expect(page.getByRole('status')).toContainText('kein menschlicher Produktions-Freigabenachweis');
|
||||
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('Dev/test browser simulation · Hello World');
|
||||
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 page.getByRole('button', { name: 'Zusammenfassung ansehen' }).click();
|
||||
const approve = page.getByRole('button', { name: 'SIMULIERT: Genehmigen' });
|
||||
await expect(approve).toHaveCount(0);
|
||||
await page.getByRole('button', { name: 'Zur Genehmigung einreichen' }).click();
|
||||
const op = page.locator('section[data-operation-id]');
|
||||
await expect(op.locator('.state-pending_approval')).toBeVisible();
|
||||
await op.getByRole('button', { name: 'Antrag prüfen', exact: true }).click();
|
||||
await expect(approve).toBeDisabled();
|
||||
await page.getByRole('button', { name: 'Antrag absenden · pending_approval' }).click();
|
||||
await expect(page.getByText('Antrag: pending_approval', { exact: false })).toBeVisible();
|
||||
await page.getByRole('checkbox', { name: 'Ich habe sämtliche festen Ziele', exact: false }).check();
|
||||
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();
|
||||
await approve.click(); // The only approval path: visible, interactive UI action.
|
||||
await expect(page.getByText('Antrag: approved', { exact: false })).toBeVisible();
|
||||
await expect(page.getByText('Ausführung: succeeded', { exact: false })).toBeVisible({ timeout: 90000 });
|
||||
await page.getByRole('button', { name: /^Job / }).first().click();
|
||||
await expect(page.getByRole('heading', { name: /^Job / })).toBeVisible();
|
||||
await op.getByText('Technische Auftragsdaten', { exact: true }).click();
|
||||
const data = op.getByLabel('Technische Auftragsdaten', { exact: true });
|
||||
await expect(data).toContainText('"approval_state": "approved"');
|
||||
await expect(data).toContainText('"execution_state": "succeeded"', { timeout: 90000 });
|
||||
await op.locator('button[data-job-id]').first().click();
|
||||
await expect(page.getByRole('heading', { name: /^Ergebnis für / })).toBeVisible();
|
||||
await page.getByRole('button', { name: 'Abmelden', exact: true }).click();
|
||||
});
|
||||
|
||||
@@ -15,7 +15,9 @@ test('real dev browser membership/catalog read and administrative controls stay
|
||||
await test.step('management:membership-heading', async () => { await expect(page.getByRole('heading', { name: 'Mitgliedschaft und Ausführungsstopp' })).toBeVisible(); });
|
||||
await test.step('management:unknown-stop', async () => { await expect(page.getByText('unknown — kein lesender Stopstatus-Endpunkt angekündigt', { exact: false })).toBeVisible(); });
|
||||
await page.getByRole('link', {name:'Aufträge',exact:true}).click();
|
||||
await page.getByRole('link', {name:'Auftrag planen',exact:true}).click();
|
||||
await page.getByRole('link', { name: 'Neuer Auftrag', exact: true }).click();
|
||||
await page.getByText('Weitere Wartungsaktionen', { exact: true }).click();
|
||||
await page.getByRole('link', { name: 'Wartungsauftrag planen', exact: true }).click();
|
||||
await test.step('management:action-option', async () => { await expect(page.getByLabel('Aktion', { exact: true }).locator('option[value="apt_native_acceptance"]')).toHaveCount(1); });
|
||||
await test.step('management:select-native', async () => { await page.getByLabel('Aktion', { exact: true }).selectOption('apt_native_acceptance'); });
|
||||
await test.step('management:native-hint', async () => { await expect(page.getByText('NUR SIMULIERTE DEV/TEST-NATIVABNAHME.', { exact: false })).toBeVisible(); });
|
||||
|
||||
@@ -37,7 +37,9 @@ test('simulated human prepares root request through UI only, without approving',
|
||||
await page.getByRole('combobox', { name: 'Kunde', exact: true }).selectOption(text(expected.tenant_id));
|
||||
await page.getByRole('checkbox', { name: `Ziel ${text(expected.asset_id)}`, 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.getByRole('link', { name: 'Neuer Auftrag', exact: true }).click();
|
||||
await page.getByText('Weitere Wartungsaktionen', { exact: true }).click();
|
||||
await page.getByRole('link', { name: 'Wartungsauftrag planen', exact: true }).click();
|
||||
await page.getByLabel('Aktion', { exact: true }).selectOption(text(request.action));
|
||||
if (request.action === 'run_script') {
|
||||
const variants = params.variants;
|
||||
@@ -62,14 +64,16 @@ test('simulated human prepares root request through UI only, without approving',
|
||||
await page.getByLabel('Stopp nach Fehlern', { exact: true }).fill('1');
|
||||
await page.getByLabel('Begründung', { exact: true }).fill(text(request.reason));
|
||||
await page.getByRole('button', { name: 'Plan erstellen · noch keine Ausführung' }).click();
|
||||
const detail = page.locator('section').filter({ has: page.getByRole('heading', { name: 'Unveränderlicher Plan / Genehmigungsdetail', exact: true }) });
|
||||
await expect(detail.locator('pre[aria-label^="Alle festen Zielpreviews"]')).toBeVisible();
|
||||
const plan = object(JSON.parse(await detail.locator('pre[aria-label^="Alle festen Zielpreviews"]').innerText()));
|
||||
const detail = page.locator('section[data-plan-id]');
|
||||
await detail.getByText('Technische Plandaten', { exact: true }).click();
|
||||
await expect(detail.getByLabel('Technische Plandaten', { exact: true })).toBeVisible();
|
||||
const plan = object(JSON.parse(await detail.getByLabel('Technische Plandaten', { exact: true }).innerText()));
|
||||
expect(createHash('sha256').update(bytes(plan.plan_payload_bytes)).digest('hex')).toBe(plan.plan_hash);
|
||||
await detail.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('pre').first()).toContainText('"job_count": 0');
|
||||
const operation = object(JSON.parse(await op.locator('pre').first().innerText()));
|
||||
await detail.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('"job_count": 0');
|
||||
const operation = object(JSON.parse(await op.getByLabel('Technische Auftragsdaten', { exact: true }).innerText()));
|
||||
expect(operation.approval_state).toBe('pending_approval'); expect(operation.execution_state).toBeNull();
|
||||
expect(authorizationRequests).toBe(0);
|
||||
const output = resolve(text(expected.output_file));
|
||||
@@ -98,15 +102,17 @@ test('one opted-in immutable dev/test action: inspect all fixed bytes → UI cli
|
||||
await page.getByRole('combobox', { name: 'Kunde', exact: true }).selectOption(text(expected.tenant_id));
|
||||
const operation = text(expected.operation_id);
|
||||
await page.getByRole('link', { name: 'Aufträge', exact: true }).click();
|
||||
await page.getByRole('button', { name: operation, exact: true }).click();
|
||||
const op = page.locator('section').filter({ has: page.getByRole('heading', { name: `Antrag / Ausführung ${operation}`, exact: true }) });
|
||||
await expect(op.locator('p.warning')).toContainText('Antrag: pending_approval');
|
||||
await expect(op.locator('pre').first()).toContainText('"job_count": 0');
|
||||
await expect(op.locator('pre').first()).toContainText('"execution_state": null');
|
||||
await op.getByRole('button', { name: 'Unveränderlichen Plan zur Prüfung öffnen' }).click();
|
||||
const detail = page.locator('section').filter({ has: page.getByRole('heading', { name: 'Unveränderlicher Plan / Genehmigungsdetail', exact: true }) });
|
||||
await expect(detail.locator('pre[aria-label^="Alle festen Zielpreviews"]')).toBeVisible();
|
||||
const plan = object(JSON.parse(await detail.locator('pre[aria-label^="Alle festen Zielpreviews"]').innerText()));
|
||||
await page.locator('tr[data-operation-id="' + operation + '"]').getByRole('button').click();
|
||||
const op = page.locator('section[data-operation-id="' + operation + '"]');
|
||||
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');
|
||||
await op.getByRole('button', { name: 'Antrag prüfen' }).click();
|
||||
const detail = page.locator('section[data-plan-id]');
|
||||
await detail.getByText('Technische Plandaten', { exact: true }).click();
|
||||
await expect(detail.getByLabel('Technische Plandaten', { exact: true })).toBeVisible();
|
||||
const plan = object(JSON.parse(await detail.getByLabel('Technische Plandaten', { exact: true }).innerText()));
|
||||
expect(plan.plan_hash).toBe(expected.plan_hash);
|
||||
expect(bytes(plan.plan_payload_bytes)).toEqual(bytes(expected.plan_payload_bytes));
|
||||
expect(createHash('sha256').update(bytes(plan.plan_payload_bytes)).digest('hex')).toBe(expected.plan_hash);
|
||||
@@ -176,12 +182,13 @@ test('one opted-in immutable dev/test action: inspect all fixed bytes → UI cli
|
||||
expect(action).toEqual({ action: 'set_service_state', unit: 'rmm-mvp-test.service', state: expected.case === 'service_start' ? 'running' : 'stopped' });
|
||||
expect(payload.max_runtime_seconds).toBe(180);
|
||||
}
|
||||
const approve = detail.getByRole('button', { name: 'SIMULIERT: Diesen festen Plan ausdrücklich genehmigen', exact: true });
|
||||
const approve = detail.getByRole('button', { name: 'SIMULIERT: Genehmigen', exact: true });
|
||||
await expect(approve).toBeDisabled();
|
||||
await detail.getByRole('checkbox', { name: 'Ich habe sämtliche festen Ziele', exact: false }).check();
|
||||
await detail.getByRole('checkbox', { name: 'Ich habe die Geräte, den Inhalt und die Ausführungsrechte geprüft.', exact: false }).check();
|
||||
await expect(approve).toBeEnabled();
|
||||
await approve.click(); // Deliberately no API client, injected fetch, route or direct approval request.
|
||||
await expect(op.locator('p.warning')).toContainText('Antrag: approved');
|
||||
await expect(op.locator('pre').first()).toContainText('"job_count": 1');
|
||||
await op.getByText('Technische Auftragsdaten', { exact: true }).click();
|
||||
await expect(op.getByLabel('Technische Auftragsdaten', { exact: true })).toContainText('"approval_state": "approved"');
|
||||
await expect(op.getByLabel('Technische Auftragsdaten', { exact: true })).toContainText('"job_count": 1');
|
||||
await page.getByRole('button', { name: 'Abmelden', exact: true }).click();
|
||||
});
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -9,17 +9,19 @@ test('preserved real VM: pending fixed Hello World → UI click → confirmed re
|
||||
if (!asset || !operation) throw new Error('Fixed VM asset and existing pending operation required');
|
||||
await login(page);
|
||||
await page.getByRole('link', { name: 'Aufträge', exact: true }).click();
|
||||
await page.getByRole('button', { name: operation, exact: true }).click();
|
||||
const op = page.locator('section').filter({ has: page.getByRole('heading', { name: `Antrag / Ausführung ${operation}`, exact: true }) });
|
||||
await expect(op.locator('p.warning')).toContainText('Antrag: pending_approval');
|
||||
await expect(op.locator('pre').first()).toContainText('"job_count": 0');
|
||||
await expect(op.locator('pre').first()).toContainText('"execution_state": null');
|
||||
await op.getByRole('button', { name: 'Unveränderlichen Plan zur Prüfung öffnen' }).click();
|
||||
const detail = page.locator('section').filter({ has: page.getByRole('heading', { name: 'Unveränderlicher Plan / Genehmigungsdetail', exact: true }) });
|
||||
await expect(detail.locator('pre[aria-label^="Alle festen Zielpreviews"]')).toBeVisible();
|
||||
await page.locator('tr[data-operation-id="' + operation + '"]').getByRole('button').click();
|
||||
const op = page.locator('section[data-operation-id="' + operation + '"]');
|
||||
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');
|
||||
await op.getByRole('button', { name: 'Antrag prüfen' }).click();
|
||||
const detail = page.locator('section[data-plan-id]');
|
||||
await detail.getByText('Technische Plandaten', { exact: true }).click();
|
||||
await expect(detail.getByLabel('Technische Plandaten', { exact: true })).toBeVisible();
|
||||
// Inspect the complete rendered immutable preview, not a separately fetched
|
||||
// or caller-supplied payload. Refuse all root/package/reboot/extra-target jobs.
|
||||
const plan = JSON.parse(await detail.locator('pre[aria-label^="Alle festen Zielpreviews"]').innerText());
|
||||
const plan = JSON.parse(await detail.getByLabel('Technische Plandaten', { exact: true }).innerText());
|
||||
expect(plan.resolved_targets).toHaveLength(1);
|
||||
expect(plan.resolved_targets[0].asset_id).toBe(asset);
|
||||
expect(plan.jobs).toHaveLength(1);
|
||||
@@ -32,16 +34,18 @@ test('preserved real VM: pending fixed Hello World → UI click → confirmed re
|
||||
expect(Date.parse(payload.start_before)).toBeGreaterThan(Date.now());
|
||||
expect(createHash('sha256').update(Buffer.from(plan.plan_payload_bytes)).digest('hex')).toBe(plan.plan_hash);
|
||||
await expect(detail).toContainText(plan.plan_hash);
|
||||
const approve = detail.getByRole('button', { name: 'SIMULIERT: Diesen festen Plan ausdrücklich genehmigen', exact: true });
|
||||
const approve = detail.getByRole('button', { name: 'SIMULIERT: Genehmigen', exact: true });
|
||||
await expect(approve).toBeDisabled();
|
||||
await detail.getByRole('checkbox', { name: 'Ich habe sämtliche festen Ziele', exact: false }).check();
|
||||
await detail.getByRole('checkbox', { name: 'Ich habe die Geräte, den Inhalt und die Ausführungsrechte geprüft.', exact: false }).check();
|
||||
await expect(approve).toBeEnabled();
|
||||
await approve.click(); // Only actual UI interaction; no request/API approval.
|
||||
await expect(op.locator('p.warning')).toContainText('Antrag: approved');
|
||||
await expect(op.locator('pre').first()).toContainText('"job_count": 1');
|
||||
await expect(op.locator('p.warning')).toContainText('Ausführung: succeeded', { timeout: 90000 });
|
||||
await op.getByRole('button', { name: /^Job / }).click();
|
||||
await expect(op.getByRole('heading', { name: /^Job / })).toBeVisible();
|
||||
await expect(op.locator('article pre')).toContainText('"postconditions_passed": true');
|
||||
await op.getByText('Technische Auftragsdaten', { exact: true }).click();
|
||||
await expect(op.getByLabel('Technische Auftragsdaten', { exact: true })).toContainText('"approval_state": "approved"');
|
||||
await expect(op.getByLabel('Technische Auftragsdaten', { exact: true })).toContainText('"job_count": 1');
|
||||
await expect(op.getByLabel('Technische Auftragsdaten', { exact: true })).toContainText('"execution_state": "succeeded"', { timeout: 90000 });
|
||||
await op.locator('button[data-job-id]').click();
|
||||
await expect(op.getByRole('heading', { name: /^Ergebnis für / })).toBeVisible();
|
||||
await op.getByText('Technische Ausführungsdaten', { exact: true }).click();
|
||||
await expect(op.getByLabel('Technische Ausführungsdaten', { exact: true })).toContainText('"postconditions_passed": true');
|
||||
await page.getByRole('button', { name: 'Abmelden', exact: true }).click();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user