Make execution controls and maintenance workflows easier to use

This commit is contained in:
2026-11-17 23:52:03 +01:00
parent a397dd7ae4
commit f6e658ce35
13 changed files with 221 additions and 40 deletions
+55
View File
@@ -63,6 +63,61 @@ test.afterAll(async () => {
await server?.close();
});
test('uses the execution stop status and blocks restart planning until the device reports support', async ({ page }) => {
const api = '/api/v1/tenants/' + tenantId;
const permissions = [...auth.permissions, 'tenant:stop', 'system:execute'];
let stopped = false, ready = false;
const writes: unknown[] = [];
await page.route(origin + '/auth/config', r => r.fulfill({ json: {
dev_login_enabled: false, local_login_enabled: true, oidc_configured: false, oidc_login_url: null
} }));
await page.route(origin + '/auth/session', r => r.fulfill({ json: { ...auth, permissions, principal: { ...auth.principal, simulated: false } } }));
await page.route(origin + '/api/v1/**', r => {
const req = r.request(), pathname = new URL(req.url()).pathname;
if (pathname === '/api/v1/tenants') return r.fulfill({ json: listing(auth.tenants) });
if (pathname === '/api/v1/approvals') return r.fulfill({ json: { ...listing([]), pending_count: 0 } });
if (pathname === api + '/execution-stop' && req.method() === 'GET') {
return r.fulfill({ json: { tenant_id: tenantId, changes_stopped: stopped } });
}
if (pathname === api + '/devices') return r.fulfill({ json: listing([windows]) });
if (pathname === api + '/devices/' + windows.asset_id) return r.fulfill({ json: {
...windows, tenant_id: tenantId,
capabilities: ready ? ['reboot', 'rmm.sync.v1', 'windows.reboot/1', 'helper.system.v1', 'system:reboot'] : []
} });
if (req.method() !== 'GET') writes.push(req.postDataJSON());
return r.fulfill({ status: 409, json: { code: 'UNSUPPORTED_CAPABILITY' } });
});
await page.goto(origin + '/#verwaltung/rechte');
const status = page.getByRole('status', { name: 'Ausführungsstatus' });
await expect(status).toHaveText('Neue Starts sind freigegeben');
await expect(page.getByText('Mandantenausführung stoppen', { exact: true })).toBeVisible();
stopped = true;
await page.reload();
await expect(status).toHaveText('Neue Starts sind gestoppt');
await expect(page.getByText('Mandantenausführung stoppen', { exact: true })).toHaveCount(0);
await expect(page.getByText('Mandantenausführung wieder zulassen', { exact: true })).toBeVisible();
expect(writes).toHaveLength(0);
await page.goto(origin + '/#auftraege/neu');
await page.getByRole('checkbox', { name: /test-windows/ }).check();
await page.getByRole('button', { name: 'Weiter zur Aktion' }).click();
await page.getByRole('radio', { name: 'Gerät neu starten' }).check();
await page.getByLabel('Begründung', { exact: true }).fill('Neustart prüfen');
const plan = page.getByRole('button', { name: 'Zusammenfassung ansehen' });
await expect(page.getByRole('alert')).toContainText('keine Neustartfähigkeit');
await expect(plan).toBeDisabled();
expect(writes).toHaveLength(0);
ready = true;
await expect(plan).toBeEnabled({ timeout: 8000 });
await plan.click();
await expect(page.getByRole('alert')).toContainText('unterstützt die ausgewählte Ausführung noch nicht');
expect(writes).toEqual([expect.objectContaining({
action: 'reboot', targets: { asset_ids: [windows.asset_id] },
parameters: expect.objectContaining({ execution_identity: 'system', reconnect_timeout_seconds: 180 })
})]);
});
test('shows the bound script text alongside single and per-device results', async ({ page }) => {
const operationId = randomUUID();
const multiOperationId = randomUUID();