Make execution controls and maintenance workflows easier to use
This commit is contained in:
@@ -21,7 +21,7 @@ test('dev/test browser simulation: login → fixed plan → pending → explicit
|
||||
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: 'Neuer Auftrag', exact: true }).click();
|
||||
await page.getByRole('button', { name: 'Weiter zum Skript' }).click();
|
||||
await page.getByRole('button', { name: /Weiter (zum Skript|zur Aktion)/ }).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();
|
||||
|
||||
@@ -8,15 +8,13 @@ test('real dev browser membership/catalog read and administrative controls stay
|
||||
const catalog = page.waitForResponse(r => new URL(r.url()).pathname.endsWith('/package-recipes'));
|
||||
await test.step('management:login-banner', async () => { await login(page); await expect(page.getByRole('status')).toContainText('SIMULIERT'); });
|
||||
await page.getByRole('link', {name:'Verwaltung',exact:true}).click();
|
||||
await page.getByRole('link', {name:'Paketkataloge',exact:true}).click();
|
||||
await page.getByRole('link', {name:'Erweitert',exact:true}).click();
|
||||
await test.step('management:catalog-response', async () => { expect((await catalog).status()).toBe(200); });
|
||||
await test.step('management:catalog-heading', async () => { await expect(page.getByRole('heading', { name: 'Unveränderlicher Paketkatalog und Artefakte' })).toBeVisible(); });
|
||||
await page.getByRole('link', {name:'Rechte & Ausführungsstopp',exact:true}).click();
|
||||
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: 'Neuer Auftrag', exact: true }).click();
|
||||
await page.getByText('Weitere Wartungsaktionen', { exact: true }).click();
|
||||
await test.step('management:stop-status', async () => { await expect(page.getByRole('status', { name: 'Ausführungsstatus' })).toHaveText(/Neue Starts sind (freigegeben|gestoppt)/); });
|
||||
await page.getByRole('link', {name:'Erweitert',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'); });
|
||||
|
||||
@@ -55,6 +55,7 @@ test('creates with selected rights, displays once, copies, revokes and keeps sec
|
||||
}
|
||||
});
|
||||
await mount(page);
|
||||
await page.getByRole('button', { name: 'Neues Token', exact: true }).click();
|
||||
await expect(page.getByRole('checkbox', { name: /Inventar lesen/ })).toBeChecked();
|
||||
await expect(page.getByRole('checkbox', { name: /Genehmigung einreichen/ })).not.toBeChecked();
|
||||
await page.getByLabel('Name', { exact: true }).fill('MCP client');
|
||||
@@ -74,6 +75,9 @@ test('creates with selected rights, displays once, copies, revokes and keeps sec
|
||||
await page.getByRole('button', { name: 'Widerruf bestätigen' }).click();
|
||||
await expect(page.getByRole('status')).toContainText('widerrufen');
|
||||
await expect(page.getByRole('button', { name: 'Widerrufen', exact: true })).toHaveCount(0);
|
||||
await expect(page.getByText('Keine aktiven Tokens.')).toBeVisible();
|
||||
await page.getByRole('button', { name: 'Verlauf', exact: true }).click();
|
||||
await expect(page.getByRole('cell', { name: /Widerrufen am/ })).toBeVisible();
|
||||
});
|
||||
|
||||
test('clears a displayed secret on session switch and refuses a simulated management session', async ({ page }) => {
|
||||
@@ -81,6 +85,7 @@ test('clears a displayed secret on session switch and refuses a simulated manage
|
||||
? { tokens: [], allowed_scopes: ['inventory:read'], default_scopes: ['inventory:read'] }
|
||||
: { ...metadata, token: syntheticSecret } }));
|
||||
await mount(page);
|
||||
await page.getByRole('button', { name: 'Neues Token', exact: true }).click();
|
||||
await page.getByLabel('Name', { exact: true }).fill('MCP client');
|
||||
await page.getByRole('button', { name: 'Token erstellen', exact: true }).click();
|
||||
await expect(page.getByLabel('Einmaliger Token')).toHaveValue(syntheticSecret);
|
||||
@@ -100,11 +105,13 @@ test('discards a late create response after the owning session changes', async (
|
||||
await route.fulfill({ json: { tokens: [], allowed_scopes: ['inventory:read'], default_scopes: ['inventory:read'] } });
|
||||
});
|
||||
await mount(page);
|
||||
await page.getByRole('button', { name: 'Neues Token', exact: true }).click();
|
||||
await page.getByLabel('Name', { exact: true }).fill('MCP client');
|
||||
await page.getByRole('button', { name: 'Token erstellen', exact: true }).click();
|
||||
const creation = await pending;
|
||||
await page.evaluate(next => (window as unknown as { renderTokenFixture: (session: unknown) => void }).renderTokenFixture(next),
|
||||
{ ...auth, csrf_token: 'replacement-session' });
|
||||
await page.getByRole('button', { name: 'Neues Token', exact: true }).click();
|
||||
await expect(page.getByLabel('Name', { exact: true })).toHaveValue('');
|
||||
await creation.fulfill({ json: { ...metadata, token: syntheticSecret } });
|
||||
await expect(page.getByLabel('Einmaliger Token')).toHaveCount(0);
|
||||
|
||||
@@ -38,7 +38,8 @@ test('simulated human prepares root request through UI only, without approving',
|
||||
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: 'Neuer Auftrag', exact: true }).click();
|
||||
await page.getByText('Weitere Wartungsaktionen', { exact: true }).click();
|
||||
await page.getByRole('link', { name: 'Verwaltung', exact: true }).click();
|
||||
await page.getByRole('link', { name: 'Erweitert', 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') {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -24,7 +24,7 @@ test('real TLS UI: login, tenant, fixed preview, pending, reload, CSRF denial an
|
||||
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: 'Neuer Auftrag', exact: true }).click();
|
||||
await page.getByRole('button', { name: 'Weiter zum Skript' }).click();
|
||||
await page.getByRole('button', { name: /Weiter (zum Skript|zur Aktion)/ }).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();
|
||||
|
||||
Reference in New Issue
Block a user