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:
92
tests/cypress/agenda/agenda.cy.ts
Normal file
92
tests/cypress/agenda/agenda.cy.ts
Normal file
@@ -0,0 +1,92 @@
|
||||
const MOCK_PATIENT = {
|
||||
id: 'test-patient-uuid',
|
||||
name_family: 'Robot',
|
||||
name_given: ['Robbert'],
|
||||
birth_date: '1990-01-01',
|
||||
identifier_client_number: '99001',
|
||||
};
|
||||
|
||||
const FHIR_RESPONSE = {
|
||||
entry: [{
|
||||
resource: {
|
||||
id: MOCK_PATIENT.id,
|
||||
name: [{ family: MOCK_PATIENT.name_family, given: MOCK_PATIENT.name_given }],
|
||||
birthDate: MOCK_PATIENT.birth_date,
|
||||
identifier: [{ system: 'http://example.com/client/999.7.6', value: MOCK_PATIENT.identifier_client_number }],
|
||||
},
|
||||
}],
|
||||
};
|
||||
|
||||
describe('Agenda', () => {
|
||||
beforeEach(() => {
|
||||
cy.login();
|
||||
cy.visit('/epd/agenda');
|
||||
});
|
||||
|
||||
it('laadt de agendapagina', () => {
|
||||
cy.contains('h1', 'Agenda').should('be.visible');
|
||||
cy.contains('Nieuwe Afspraak').should('be.visible');
|
||||
});
|
||||
|
||||
it('toont navigatieknoppen en weergave-switcher', () => {
|
||||
cy.contains('Vandaag').should('be.visible');
|
||||
cy.contains('Dag').should('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Afspraak maken', () => {
|
||||
beforeEach(() => {
|
||||
cy.intercept('GET', '/api/fhir/Patient**', FHIR_RESPONSE).as('patientSearch');
|
||||
cy.login();
|
||||
cy.visit('/epd/agenda');
|
||||
});
|
||||
|
||||
it('opent de "Nieuwe Afspraak" modal', () => {
|
||||
cy.contains('Nieuwe Afspraak').click();
|
||||
cy.get('[role="dialog"]').should('be.visible');
|
||||
cy.get('[role="dialog"]').contains('Nieuwe Afspraak');
|
||||
});
|
||||
|
||||
it('modal toont alle verplichte velden', () => {
|
||||
cy.contains('Nieuwe Afspraak').click();
|
||||
cy.get('[role="dialog"]').within(() => {
|
||||
cy.get('input[placeholder*="Zoek op naam"]').should('be.visible');
|
||||
cy.get('input[type="date"]').should('be.visible');
|
||||
cy.get('input[type="time"]').first().should('be.visible');
|
||||
cy.contains('button', 'Afspraak maken').should('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
it('zoeken naar patiënt toont resultaat', () => {
|
||||
cy.contains('Nieuwe Afspraak').click();
|
||||
cy.get('[role="dialog"]').within(() => {
|
||||
cy.get('input[placeholder*="Zoek op naam"]').type('Robbert');
|
||||
});
|
||||
cy.wait('@patientSearch');
|
||||
cy.contains('Robbert Robot').should('be.visible');
|
||||
});
|
||||
|
||||
it('selecteren van patiënt vult het veld in', () => {
|
||||
cy.contains('Nieuwe Afspraak').click();
|
||||
cy.get('[role="dialog"]').within(() => {
|
||||
cy.get('input[placeholder*="Zoek op naam"]').type('Robbert');
|
||||
});
|
||||
cy.wait('@patientSearch');
|
||||
cy.contains('Robbert Robot').click();
|
||||
cy.get('.bg-teal-50').should('be.visible');
|
||||
});
|
||||
|
||||
it('afspraak maken knop is uitgeschakeld zonder patiënt', () => {
|
||||
cy.contains('Nieuwe Afspraak').click();
|
||||
cy.get('[role="dialog"]').within(() => {
|
||||
cy.contains('button', 'Afspraak maken').should('be.disabled');
|
||||
});
|
||||
});
|
||||
|
||||
it('sluiten sluit de modal', () => {
|
||||
cy.contains('Nieuwe Afspraak').click();
|
||||
cy.get('[role="dialog"]').should('be.visible');
|
||||
cy.get('[role="dialog"]').contains('button', 'Sluiten').click();
|
||||
cy.get('[role="dialog"]').should('not.exist');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user