test: Cypress en Playwright e2e-suites voor login, agenda, cortex en verpleegrapportage
Configs voor beide runners, login via session caching, AI-chat mocks (SSE) voor deterministische Cortex-tests. Supabase local config toegevoegd. Auth-state en reports zijn gitignored. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
39
tests/playwright/cortex/command-center.spec.ts
Normal file
39
tests/playwright/cortex/command-center.spec.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { test, expect, type Page } from '@playwright/test';
|
||||
|
||||
// De pagina heeft twee textareas (desktop + mobiel layout). .first() pakt de zichtbare desktop-versie.
|
||||
const input = (page: Page) => page.getByPlaceholder('Typ of spreek wat je wilt doen...').first();
|
||||
|
||||
test.describe('Cortex Command Center - UI', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('/epd/cortex');
|
||||
await expect(input(page)).toBeVisible({ timeout: 10_000 });
|
||||
});
|
||||
|
||||
test('laadt de command center interface', async ({ page }) => {
|
||||
await expect(input(page)).toBeVisible();
|
||||
await expect(page.locator('text=Welkom bij Cortex Assistent').first()).toBeVisible();
|
||||
});
|
||||
|
||||
test('chat input accepteert tekst', async ({ page }) => {
|
||||
await input(page).fill('test invoer');
|
||||
await expect(input(page)).toHaveValue('test invoer');
|
||||
});
|
||||
|
||||
test('keyboard shortcut ⌘K focust de input', async ({ page }) => {
|
||||
await page.click('body');
|
||||
await page.keyboard.press('Meta+k');
|
||||
await expect(input(page)).toBeFocused();
|
||||
});
|
||||
|
||||
test('escape wist de input', async ({ page }) => {
|
||||
await input(page).fill('iets typen');
|
||||
await input(page).press('Escape');
|
||||
await expect(input(page)).toHaveValue('');
|
||||
});
|
||||
|
||||
test('toont voorbeeldcommandos in de empty state', async ({ page }) => {
|
||||
await expect(page.locator('text=Dagnotitie maken').first()).toBeVisible();
|
||||
await expect(page.locator('text=Patiënt zoeken').first()).toBeVisible();
|
||||
await expect(page.locator('text=Overdracht maken').first()).toBeVisible();
|
||||
});
|
||||
});
|
||||
63
tests/playwright/cortex/dagnotitie-flow.spec.ts
Normal file
63
tests/playwright/cortex/dagnotitie-flow.spec.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import { test, expect, type Page } from '@playwright/test';
|
||||
import { mockDagnotitieChat, mockZoekenChat, mockOverdrachtChat, mockOnbekendChat } from '../fixtures/ai-mocks';
|
||||
|
||||
// De pagina heeft twee textareas (desktop + mobiel layout). .first() pakt de zichtbare desktop-versie.
|
||||
const input = (page: Page) => page.getByPlaceholder('Typ of spreek wat je wilt doen...').first();
|
||||
|
||||
test.describe('Cortex - Demo flows', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('/epd/cortex');
|
||||
await expect(input(page)).toBeVisible({ timeout: 10_000 });
|
||||
});
|
||||
|
||||
test('dagnotitie flow: bericht → AI response → artifact verschijnt', async ({ page }) => {
|
||||
await mockDagnotitieChat(page, 'Jan de Vries');
|
||||
await input(page).fill('notitie jan de vries voelt zich goed vandaag');
|
||||
await input(page).press('Enter');
|
||||
await expect(page.locator('text=notitie jan de vries voelt zich goed vandaag').first()).toBeVisible({ timeout: 5_000 });
|
||||
await expect(page.locator('text=Genoteerd.').first()).toBeVisible({ timeout: 10_000 });
|
||||
});
|
||||
|
||||
test('dagnotitie flow: input is leeg na verzenden', async ({ page }) => {
|
||||
await mockDagnotitieChat(page);
|
||||
await input(page).fill('notitie jan medicatie gegeven');
|
||||
await input(page).press('Enter');
|
||||
await expect(input(page)).toHaveValue('', { timeout: 3_000 });
|
||||
});
|
||||
|
||||
test('zoeken flow: bericht → zoek-artifact verschijnt', async ({ page }) => {
|
||||
await mockZoekenChat(page, 'Marie');
|
||||
await input(page).fill('zoek marie');
|
||||
await input(page).press('Enter');
|
||||
await expect(page.locator('text=zoek marie').first()).toBeVisible({ timeout: 5_000 });
|
||||
await expect(page.locator('text=Even kijken.').first()).toBeVisible({ timeout: 10_000 });
|
||||
});
|
||||
|
||||
test('overdracht flow: bericht → overdracht-artifact', async ({ page }) => {
|
||||
await mockOverdrachtChat(page);
|
||||
await input(page).fill('overdracht');
|
||||
await input(page).press('Enter');
|
||||
await expect(page.locator('text=overdracht').first()).toBeVisible({ timeout: 5_000 });
|
||||
await expect(page.locator('text=Overdracht klaar.').first()).toBeVisible({ timeout: 10_000 });
|
||||
});
|
||||
|
||||
test('onbekende intent: AI vraagt om verduidelijking', async ({ page }) => {
|
||||
await mockOnbekendChat(page);
|
||||
await input(page).fill('xyz');
|
||||
await input(page).press('Enter');
|
||||
await expect(page.locator('text=snap niet helemaal wat je bedoelt').first()).toBeVisible({ timeout: 10_000 });
|
||||
});
|
||||
|
||||
test('meerdere berichten: chat history groeit', async ({ page }) => {
|
||||
await mockDagnotitieChat(page);
|
||||
await input(page).fill('notitie jan medicatie gegeven');
|
||||
await input(page).press('Enter');
|
||||
await expect(page.locator('text=Genoteerd.').first()).toBeVisible({ timeout: 10_000 });
|
||||
|
||||
await mockDagnotitieChat(page, 'Marie');
|
||||
await input(page).fill('notitie marie slaapt slecht');
|
||||
await input(page).press('Enter');
|
||||
await expect(page.locator('text=notitie jan medicatie gegeven').first()).toBeVisible();
|
||||
await expect(page.locator('text=notitie marie slaapt slecht').first()).toBeVisible();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user