Follow the new order and review screens in development browser checks
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
// Actual UI only. No page.request, fetch injection, approval API or DB access.
|
||||
const fs = require('node:fs');
|
||||
const { readTechnicalData, technicalData } = require('./review-data.cjs');
|
||||
const path = require('node:path');
|
||||
const crypto = require('node:crypto');
|
||||
const { isDeepStrictEqual } = require('node:util');
|
||||
@@ -50,13 +51,13 @@ function checkWindowsHello(job, planBytes) {
|
||||
assert(session.testsimulation === true && session.approval_origin === 'dev_test_browser_simulation' && session.principal === expected.expected_principal);
|
||||
await page.getByRole('status').filter({ hasText: 'SIMULIERT' }).waitFor();
|
||||
await page.getByRole('link', { name: 'Aufträge', exact: true }).click();
|
||||
await page.getByRole('button', { name: expected.operation_id, exact: true }).click();
|
||||
const op = page.locator('section').filter({ has: page.getByRole('heading', { name: 'Antrag / Ausführung ' + expected.operation_id, exact: true }) });
|
||||
const pending = JSON.parse(await op.locator('pre').first().innerText());
|
||||
await page.locator('tr[data-operation-id="' + expected.operation_id + '"]').getByRole('button').click();
|
||||
const op = page.locator('section[data-operation-id="' + expected.operation_id + '"]');
|
||||
const pending = await readTechnicalData(op, 'Technische Auftragsdaten');
|
||||
assert(pending.approval_state === 'pending_approval' && pending.job_count === 0 && pending.execution_state === null);
|
||||
await op.getByRole('button', { name: 'Unveränderlichen Plan zur Prüfung öffnen', exact: true }).click();
|
||||
const detail = page.locator('section').filter({ has: page.getByRole('heading', { name: 'Unveränderlicher Plan / Genehmigungsdetail', exact: true }) });
|
||||
const rendered = JSON.parse(await detail.getByLabel('Alle festen Zielpreviews, exakte Skriptinhalte/Hashes, Parameter, Rechte, Fristen, Rollout und Nachbedingungen', { exact: true }).innerText());
|
||||
await op.getByRole('button', { name: 'Antrag prüfen', exact: true }).click();
|
||||
const detail = page.locator('section[data-plan-id]');
|
||||
const rendered = await readTechnicalData(detail, 'Technische Plandaten');
|
||||
assert(rendered.plan_hash === expected.plan.plan_hash && crypto.createHash('sha256').update(Buffer.from(rendered.plan_payload_bytes)).digest('hex') === expected.plan.plan_hash);
|
||||
assert(JSON.stringify(rendered.plan_payload_bytes) === JSON.stringify(expected.plan.plan_payload_bytes));
|
||||
assert(rendered.jobs.length === 1 && rendered.resolved_targets.length === 1);
|
||||
@@ -70,16 +71,19 @@ function checkWindowsHello(job, planBytes) {
|
||||
assert(expected.stage === 'pending_approval' && expected.preapproval.jobs === 0
|
||||
&& expected.preapproval.outbox === 0 && expected.preapproval.permits === 0);
|
||||
assert(pending.plan_id === rendered.plan_id && pending.operation_id === expected.operation_id);
|
||||
await detail.getByLabel('Feste PowerShell-Prozessprofile', { exact: true })
|
||||
.getByText('Asset: ' + payload.asset_id + ' · Windows PowerShell5.1 · agent_service · RemoteSigned · nur Jobprozess', { exact: true }).waitFor();
|
||||
const script = detail.getByLabel('Skriptinhalt', { exact: true });
|
||||
await script.getByText('Windows PowerShell 5.1 · RemoteSigned für diesen Prozess', { exact: true }).waitFor();
|
||||
await script.getByText('Ausführungsdetails und Prüfsummen', { exact: true }).click();
|
||||
await script.getByText(payload.asset_id, { exact: true }).waitFor();
|
||||
await script.getByText('Profil', { exact: false }).filter({ hasText: 'agent_service' }).waitFor();
|
||||
}
|
||||
else if (expected.case === 'hello' || expected.case === 'cancel_queued') assert(payload.action.action === 'run_script' && payload.action.interpreter === 'posix_sh' && payload.action.script_utf8 === "printf '%s\\n' 'Hello World'\n" && payload.action.expected_stdout === 'Hello World\n');
|
||||
else assert(payload.action.action === 'refresh_inventory' && payload.action.scope === 'linux.base');
|
||||
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 });
|
||||
assert(await approve.isDisabled());
|
||||
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 approve.click();
|
||||
await op.locator('p.warning').filter({ hasText: 'Antrag: approved' }).waitFor();
|
||||
await (await technicalData(op, 'Technische Auftragsdaten')).filter({ hasText: '"approval_state": "approved"' }).waitFor();
|
||||
await page.getByRole('button', { name: 'Abmelden', exact: true }).click();
|
||||
} finally { await browser.close(); }
|
||||
})().catch(error => { console.log('CLOUD_UI_INCOMPLETE:' + error.constructor.name); process.exitCode = 1; });
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// Read only through actual UI clicks; inspect its normal HTTP response.
|
||||
const fs = require('node:fs');
|
||||
const { readTechnicalData } = require('./review-data.cjs');
|
||||
const path = require('node:path');
|
||||
const assert = require('node:assert/strict');
|
||||
const { chromium } = require('../../web/node_modules/playwright');
|
||||
@@ -31,15 +32,15 @@ function privateJson(file) {
|
||||
await page.getByLabel('Kunde', { exact: true }).selectOption(expected.tenant_id);
|
||||
assert.equal(await page.getByLabel('Kunde', { exact: true }).inputValue(), expected.tenant_id);
|
||||
await page.getByRole('link', { name: 'Aufträge', exact: true }).click();
|
||||
await page.getByRole('button', { name: expected.operation_id, exact: true }).click();
|
||||
const op = page.locator('section').filter({ has: page.getByRole('heading', { name: 'Antrag / Ausführung ' + expected.operation_id, exact: true }) });
|
||||
await page.locator('tr[data-operation-id="' + expected.operation_id + '"]').getByRole('button').click();
|
||||
const op = page.locator('section[data-operation-id="' + expected.operation_id + '"]');
|
||||
const response = page.waitForResponse(r => new URL(r.url()).pathname === `/api/v1/tenants/${expected.tenant_id}/jobs/${expected.job_id}` && r.status() === 200);
|
||||
await op.getByRole('button', { name: 'Job ' + expected.job_id + ' · succeeded', exact: true }).click();
|
||||
await op.locator('button[data-job-id="' + expected.job_id + '"]').click();
|
||||
const http = await (await response).json();
|
||||
const detail = page.locator('article').filter({ has: page.getByRole('heading', { name: 'Job ' + expected.job_id, exact: true }) });
|
||||
await detail.locator('pre').waitFor();
|
||||
const rendered = JSON.parse(await detail.locator('pre').innerText());
|
||||
assert.deepEqual(http, expected.result); assert.deepEqual(rendered, expected.result);
|
||||
const detail = page.locator('article[data-job-id="' + expected.job_id + '"]');
|
||||
|
||||
const rendered = await readTechnicalData(detail, 'Technische Ausführungsdaten');
|
||||
assert.equal(http.state, 'succeeded'); assert.deepEqual(http, expected.result); assert.deepEqual(rendered, expected.result);
|
||||
const observation = JSON.parse(Buffer.from(rendered.result.stdout).toString('utf8'));
|
||||
assert.equal(observation.data.unit, 'rmm-mvp-test.service'); assert.equal(observation.data.json_lines.length, 4);
|
||||
fs.writeFileSync(path.join(path.dirname(file), 'read-evidence.json'), JSON.stringify({ verified: true, http, rendered }), { mode: 0o600, flag: 'wx' });
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// Read the data shown by the interactive dev/test WebUI.
|
||||
async function technicalData(region, label) {
|
||||
const summary = region.getByText(label, { exact: true });
|
||||
const pre = region.getByLabel(label, { exact: true });
|
||||
await summary.waitFor();
|
||||
if (!await pre.isVisible()) await summary.click();
|
||||
await pre.waitFor();
|
||||
return pre;
|
||||
}
|
||||
|
||||
async function readTechnicalData(region, label) {
|
||||
const data = await technicalData(region, label);
|
||||
return JSON.parse(await data.innerText());
|
||||
}
|
||||
|
||||
module.exports = { technicalData, readTechnicalData };
|
||||
@@ -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