Verify the order filter form with accessible labels

This commit is contained in:
2026-11-18 09:17:01 +01:00
parent 14a271f61a
commit 61688bcd4b
2 changed files with 34 additions and 1 deletions
+33
View File
@@ -63,6 +63,39 @@ test.afterAll(async () => {
await server?.close();
});
test('applies order filters from the first page and clears them on reset', async ({ page }) => {
const requests: URL[] = [];
await page.route(origin + '/auth/config', r => r.fulfill({ json: {
dev_login_enabled: true, oidc_configured: false, oidc_login_url: null
} }));
await page.route(origin + '/auth/session', r => r.fulfill({ json: auth }));
await page.route(origin + '/api/v1/**', r => {
const url = new URL(r.request().url());
if (url.pathname === '/api/v1/tenants') return r.fulfill({ json: listing(auth.tenants) });
if (url.pathname.endsWith('/operations')) requests.push(url);
return r.fulfill({ json: listing([]) });
});
await page.goto(origin + '/#auftraege');
await expect(page.getByText('Für diesen Kunden gibt es noch keine Aufträge.')).toBeVisible();
const area = page.getByRole('form', { name: 'Aufträge filtern' });
await area.getByLabel('Auftrag', { exact: true }).fill(' Kernel ');
await area.getByLabel('Gerät', { exact: true }).fill('test-linux');
await area.getByLabel('Status', { exact: true }).selectOption('succeeded');
await area.getByLabel('Von', { exact: true }).fill('2026-11-17');
await area.getByLabel('Bis einschließlich', { exact: true }).fill('2026-11-17');
await area.getByRole('button', { name: 'Filtern', exact: true }).click();
await expect(page.getByText('Keine Aufträge passen zu den Filtern.')).toBeVisible();
const request = requests.at(-1)?.searchParams;
expect(request?.get('cursor')).toBeNull();
expect(request?.get('q')).toBe('Kernel');
expect(request?.get('device')).toBe('test-linux');
expect(request?.get('status')).toBe('succeeded');
expect(Date.parse(request!.get('until')!) - Date.parse(request!.get('from')!)).toBe(86400000);
await area.getByRole('button', { name: 'Filter zurücksetzen' }).click();
await expect(page.getByText('Für diesen Kunden gibt es noch keine Aufträge.')).toBeVisible();
expect(requests.at(-1)?.searchParams.has('device')).toBe(false);
});
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'];
+1 -1
View File
@@ -442,7 +442,7 @@ function Operations({ tenantId, open, customerName, filters, apply }: {
}}>
<label>Auftrag<input type="search" maxLength={120} value={draft.q} onChange={e => setDraft({ ...draft, q:e.target.value })} placeholder="Name oder Anlass"/></label>
<label>Gerät<input type="search" maxLength={120} value={draft.device} onChange={e => setDraft({ ...draft, device:e.target.value })} placeholder="Hostname oder Geräte-ID"/></label>
<label>Status<select value={draft.status} onChange={e => setDraft({ ...draft, status:e.target.value })}>
<label>Status<select aria-label="Status" value={draft.status} onChange={e => setDraft({ ...draft, status:e.target.value })}>
<option value="">Alle Status</option>
{orderStatuses.map(status => <option key={status} value={status}>{statusText(status)}</option>)}
</select></label>