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 Oct 1, 2024
1 parent 0703d95 commit 3993522
Show file tree
Hide file tree
Showing 9 changed files with 1,196 additions and 151 deletions.
133 changes: 49 additions & 84 deletions e2e/tests/bahmni-odoo-flows.spec.ts

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions e2e/tests/diagnosis.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ test.beforeEach(async ({ page }) => {

await bahmni.login();
await expect(page.getByText(/registration/i)).toBeVisible();
await expect(page.getByText(/linical/i)).toBeVisible();
await expect(page.getByText(/clinical/i)).toBeVisible();
await expect(page.getByText(/admin/i)).toBeVisible();
await expect(page.getByText(/appointment scheduling/i)).toBeVisible();
await expect(page.getByText(/patient documents/i)).toBeVisible();
});

Expand All @@ -20,12 +19,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 +41,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
13 changes: 6 additions & 7 deletions e2e/tests/lab-orders.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ test.beforeEach(async ({ page }) => {

await bahmni.login();
await expect(page.getByText(/registration/i)).toBeVisible();
await expect(page.getByText(/linical/i)).toBeVisible();
await expect(page.getByText(/clinical/i)).toBeVisible();
await expect(page.getByText(/admin/i)).toBeVisible();
await expect(page.getByText(/appointment scheduling/i)).toBeVisible();
await expect(page.getByText(/patient documents/i)).toBeVisible();
});

Expand All @@ -19,8 +18,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 +30,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 +51,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 +70,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
9 changes: 4 additions & 5 deletions e2e/tests/medications.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ test.beforeEach(async ({ page }) => {

await bahmni.login();
await expect(page.getByText(/registration/i)).toBeVisible();
await expect(page.getByText(/linical/i)).toBeVisible();
await expect(page.getByText(/clinical/i)).toBeVisible();
await expect(page.getByText(/admin/i)).toBeVisible();
await expect(page.getByText(/appointment scheduling/i)).toBeVisible();
await expect(page.getByText(/patient documents/i)).toBeVisible();
});

Expand All @@ -19,7 +18,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 +44,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 +56,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 3993522

Please sign in to comment.