Follow the new order and review screens in development browser checks
This commit is contained in:
@@ -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