Skip to content

Commit

Permalink
C2C-355: E2E tests for the observation forms
Browse files Browse the repository at this point in the history
  • Loading branch information
kdaud committed Sep 24, 2024
1 parent 0703d95 commit 1e7783b
Show file tree
Hide file tree
Showing 9 changed files with 1,203 additions and 151 deletions.
134 changes: 50 additions & 84 deletions e2e/tests/bahmni-odoo-flows.spec.ts

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions e2e/tests/diagnosis.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ test('Create and revise a diagnosis.', async ({ page }) => {
await bahmni.registerPatient();

// replay
await bahmni.navigateToPatientDashboard();
await bahmni.navigateToDiagnosis();
await page.locator('#name-0').fill('Candidiasis (B37.9)');
await page.getByText('Candidiasis (B37.9)').click();
await page.locator('#order-0').getByRole('button', { name: /primary/i }).click();
await page.locator('#certainty-0').getByRole('button', { name: /confirmed/i }).click();
await bahmni.saveOrder();
await bahmni.save();

// verify creation
await page.locator('#dashboard-link span.patient-name').click();
Expand All @@ -41,7 +42,7 @@ test('Create and revise a diagnosis.', async ({ page }) => {
await diagnosisOrderButton.waitFor({ state: 'visible' });
await diagnosisOrderButton.focus();
await diagnosisOrderButton.click();
await bahmni.saveOrder();
await bahmni.save();
await page.locator('#dashboard-link span.patient-name').click();
await expect(page.locator('#diagnosisName')).toContainText(/candidiasis/i);
await expect(page.locator('#order')).toContainText(/secondary/i);
Expand Down
10 changes: 5 additions & 5 deletions e2e/tests/lab-orders.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ test('Create, revise and discontinue lab tests.', async ({ page }) => {
await bahmni.registerPatient();

// replay
await bahmni.goToHomePage();
await bahmni.goToLabSamples();
await bahmni.navigateToPatientDashboard();
await bahmni.navigateToLabSamples();
await page.getByText('Blood', { exact: true }).click();
await page.getByText('Malaria').click();
await page.getByText('Urine').click();
Expand All @@ -31,7 +31,7 @@ test('Create, revise and discontinue lab tests.', async ({ page }) => {
await page.getByText('Bacteries').click();
await page.getByText('Sputum').click();
await page.getByText('Serial sputum bacilloscopy').click();
await bahmni.saveOrder();
await bahmni.save();

// verify creation
await page.locator('#dashboard-link span.patient-name').click();
Expand All @@ -52,7 +52,7 @@ test('Create, revise and discontinue lab tests.', async ({ page }) => {
await page.getByText('Urine Colour').click();
await page.getByText('Stool', { exact: true }).click();
await page.getByText('Stool Parasites').click();
await bahmni.saveOrder();
await bahmni.save();

// verify revision
await page.locator('#dashboard-link span.patient-name').click();
Expand All @@ -71,7 +71,7 @@ test('Create, revise and discontinue lab tests.', async ({ page }) => {
await page.locator('#selected-orders li').filter({ hasText: 'Blood Sugar' }).locator('i').nth(1).click();
await page.locator('#selected-orders li').filter({ hasText: 'Urine Colour' }).locator('i').nth(1).click();
await page.locator('#selected-orders li').filter({ hasText: 'Stool Colour' }).locator('i').nth(1).click();
await bahmni.saveOrder();
await bahmni.save();
await page.locator('#dashboard-link span.patient-name').click();
await expect(page.locator('#Lab-Orders').getByText('Blood Sugar')).not.toBeVisible();
await expect(page.locator('#Lab-Orders').getByText('Urine Colour')).not.toBeVisible();
Expand Down
6 changes: 3 additions & 3 deletions e2e/tests/medications.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test('Create, revise and discontinue a drug order.', async ({ page }) => {
await bahmni.registerPatient();

// replay
await bahmni.goToHomePage();
await bahmni.navigateToPatientDashboard();
await bahmni.navigateToMedications();
await bahmni.createMedication();

Expand All @@ -45,7 +45,7 @@ test('Create, revise and discontinue a drug order.', async ({ page }) => {
await page.locator('#uniform-dose-unit').selectOption('string:Comprime(s)');
await page.locator('#route').selectOption('string:Inhalation');
await page.getByRole('button', { name: 'Add' }).click();
await bahmni.saveOrder();
await bahmni.save();
await expect(medicationDetailsSelector).not.toContainText('2 Application(s)');
await expect(medicationDetailsSelector).toContainText('4 Comprime(s)');
await expect(medicationDetailsSelector).not.toContainText('Q3H');
Expand All @@ -57,7 +57,7 @@ test('Create, revise and discontinue a drug order.', async ({ page }) => {
await expect(drugNameSelector).toContainText('Aspirine Co 81mg (Comprime)');
await page.getByRole('button', { name: 'Stop' }).first().click();
await page.getByPlaceholder('Notes').fill('Patient allergic to medicine');
await bahmni.saveOrder();
await bahmni.save();
await page.locator('#dashboard-link span.patient-name').click();
const medicationStatus = await page.locator('#dashboard-treatments span.discontinued-text').first();
await expect(medicationStatus).toContainText('Stopped');
Expand Down
Loading

0 comments on commit 1e7783b

Please sign in to comment.