Follow the new order and review screens in development browser checks
This commit is contained in:
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user