Enforce customer boundaries on token administration and finalize fleet navigation

This commit is contained in:
2026-11-17 22:05:44 +01:00
parent 0afaca1d64
commit 312da6f39e
25 changed files with 1207 additions and 208 deletions
+14 -7
View File
@@ -28,20 +28,27 @@ function readPrivate(file) {
const session = await (await response).json();
assert(session.testsimulation === true && session.approval_origin === 'dev_test_browser_simulation' && session.principal === expected.expected_principal && session.permissions.includes('devices:revoke'));
await page.getByRole('status').filter({ hasText: 'SIMULIERT' }).waitFor();
assert(await page.getByLabel('Mandant', { exact: true }).inputValue() === expected.tenant_id);
await page.getByRole('button', { name: expected.asset_id, exact: true }).click();
const article = page.locator('article').filter({ has: page.getByRole('heading', { name: 'Inventardetail ' + expected.asset_id, exact: true }) });
await article.locator('pre').waitFor(); const device = JSON.parse(await article.locator('pre').innerText());
await page.getByLabel('Kunde', { exact: true }).selectOption(expected.tenant_id);
assert(await page.getByLabel('Kunde', { exact: true }).inputValue() === expected.tenant_id);
const row = page.getByRole('row').filter({ has: page.getByLabel('Ziel ' + expected.asset_id, { exact: true }) });
await row.getByRole('button').click();
const article = page.locator('.device-detail');
await article.getByText('Technische Daten', { exact: true }).click();
const device = JSON.parse(await article.getByLabel('Vollständiges Geräteinventar', { exact: true }).innerText());
assert(device.agent_id === expected.agent_id && device.asset_id === expected.asset_id && device.presence === 'online');
assert(device.capabilities.length === 2 && device.capabilities.includes('linux.base/1') && device.capabilities.includes('heartbeat/1'));
const control = article.locator('details').filter({ has: page.locator('summary').filter({ hasText: /^Geräteidentität widerrufen$/ }) });
await control.locator('summary').click();
await article.getByText('Gerät verwalten', { exact: true }).click();
const summary = article.locator('summary').filter({ hasText: /^Geräteidentität widerrufen$/ });
await summary.click();
const control = summary.locator('..');
await control.getByLabel('Grund für Geräteidentität widerrufen', { exact: true }).fill('Native passive Linux MVP lifecycle acceptance; revoke only this separate nonexecuting test identity');
const nonce = await control.locator('code').innerText();
await control.getByLabel('Bestätigungskennung eingeben', { exact: true }).fill(nonce);
await control.getByRole('checkbox', { name: 'Ich bestätige diese konkrete administrative Wirkung ausdrücklich.' }).check();
const revocation = page.waitForResponse(r => new URL(r.url()).pathname === '/api/v1/tenants/' + expected.tenant_id + '/devices/' + expected.asset_id + '/revocation' && r.request().method() === 'POST');
await control.getByRole('button', { name: 'Geräteidentität widerrufen · ausdrücklich ausführen', exact: true }).click();
await control.locator('pre').filter({ hasText: '"revoked": true' }).waitFor();
const result = await revocation;
assert(result.ok() && (await result.json()).revoked === true);
assert(revocations === 1 && approvals === 0);
await page.getByRole('button', { name: 'Abmelden', exact: true }).click();
} finally { await browser.close(); }