diff --git a/tests/browser/customer-management.spec.ts b/tests/browser/customer-management.spec.ts index 92b8802..06a8f6b 100644 --- a/tests/browser/customer-management.spec.ts +++ b/tests/browser/customer-management.spec.ts @@ -100,7 +100,17 @@ test('creates and renames a customer, opens its inventory, and hides editing for await page.getByRole('button', { name: 'Geräte von Nord GmbH anzeigen' }).click(); await expect(page.getByRole('heading', { name: 'Geräte', exact: true })).toBeVisible(); await expect(page.getByRole('combobox', { name: 'Kunde', exact: true })).toHaveValue(customerId); + await expect(page.getByRole('combobox', { name: 'Kunde im Gerätebestand', exact: true })).toHaveValue(customerId); await expect(page.getByRole('row').filter({ hasText: 'NORD-PC' })).toContainText('Nord GmbH'); + const navigation = page.getByRole('navigation', { name: 'Hauptnavigation' }); + await navigation.getByRole('link', { name: 'Aufträge', exact: true }).click(); + await expect(page.getByRole('combobox', { name: 'Kunde', exact: true })).toHaveValue(customerId); + await navigation.getByRole('link', { name: 'Skripte', exact: true }).click(); + await expect(page.getByRole('combobox', { name: 'Kunde', exact: true })).toHaveValue(customerId); + await navigation.getByRole('link', { name: 'Genehmigungen', exact: true }).click(); + await expect(page.locator('header').getByText('Nord GmbH')).toBeVisible(); + await navigation.getByRole('link', { name: 'Geräte', exact: true }).click(); + await expect(page.getByRole('combobox', { name: 'Kunde im Gerätebestand', exact: true })).toHaveValue(customerId); expect(mutations).toEqual([ { method: 'POST', path: '/api/v1/tenants', body: { name: 'Nord' } }, { method: 'PATCH', path: `/api/v1/tenants/${customerId}`, body: { name: 'Nord GmbH' } } diff --git a/tests/browser/order-composer.spec.ts b/tests/browser/order-composer.spec.ts index a527ebb..438e8ce 100644 --- a/tests/browser/order-composer.spec.ts +++ b/tests/browser/order-composer.spec.ts @@ -419,6 +419,10 @@ for (const library of [true, false]) { test('publishes versions in the library and keeps the earlier script readable', async ({ page }) => { const revisions = [{ ...script, script_sha256: hash(script.script_utf8) }]; + const otherScripts = [ + { ...revisions[0], revision_id: randomUUID(), name: 'Windows Übersicht', interpreter: 'powershell' }, + { ...revisions[0], revision_id: randomUUID(), name: 'Linux Übersicht', interpreter: 'bash' } + ]; const writes: string[] = []; await page.route(origin + '/fixture', (r) => r.fulfill({ @@ -434,8 +438,11 @@ test('publishes versions in the library and keeps the earlier script readable', await page.route(origin + '/api/v1/**', (r) => { const req = r.request(); const path = '/api/v1/tenants/' + tenantId + '/script-revisions'; - expect(new URL(req.url()).pathname).toBe(path); - if (req.method() === 'GET') return r.fulfill({ json: listing(revisions) }); + const url = new URL(req.url()); + expect(url.pathname).toBe(path); + if (req.method() === 'GET') return r.fulfill({ json: url.searchParams.has('cursor') + ? listing(otherScripts) + : { ...listing(revisions), next_cursor: 'second-page' } }); writes.push(path); expect(req.headers()['x-csrf-token']).toBe(auth.csrf_token); const body = req.postDataJSON(); @@ -451,6 +458,17 @@ test('publishes versions in the library and keeps the earlier script readable', return r.fulfill({ json: next }); }); await page.goto(origin + '/fixture'); + const library = page.getByRole('region', { name: 'Skriptbibliothek' }); + await library.getByLabel('Plattform', { exact: true }).selectOption('windows'); + await library.getByRole('searchbox', { name: 'Skriptname' }).fill(' ÜBERSICHT '); + await expect(library.locator('tbody tr')).toHaveCount(1); + await expect(library.locator('tbody tr')).toContainText('Windows Übersicht'); + await library.getByLabel('Plattform', { exact: true }).selectOption('linux'); + await expect(library.locator('tbody tr')).toContainText('Linux Übersicht'); + await library.getByRole('searchbox', { name: 'Skriptname' }).fill('ohne Treffer'); + await expect(library.getByText('Keine Skripte passen zu den Filtern.')).toBeVisible(); + await library.getByRole('button', { name: 'Filter zurücksetzen' }).click(); + await expect(library.locator('tbody tr')).toHaveCount(3); await page.getByRole('button', { name: script.name, exact: true }).click(); await page.getByRole('button', { name: 'Neue Version', exact: true }).click(); await page.getByLabel('Skriptinhalt').fill('uname -r\n'); diff --git a/web/src/approval-inbox.tsx b/web/src/approval-inbox.tsx index 63ebf3a..2a1c0b3 100644 --- a/web/src/approval-inbox.tsx +++ b/web/src/approval-inbox.tsx @@ -36,7 +36,7 @@ export function ApprovalInbox({ open, ownId }: { ownId: string; open: (tenantId: {v === 'pending' ? 'Offen' : 'Verlauf'} )} -
- )} + ) :
+ {fixedCustomer ? 'Kunde' : 'Aktiver Kunde'} + {customerName || (tenants.data ? 'Nicht verfügbar' : 'Wird geladen …')} +
} {auth.principal.simulated && (