diff --git a/e2e/tests/lab-orders.spec.ts b/e2e/tests/lab-orders.spec.ts index 6b47e6d..32897d5 100644 --- a/e2e/tests/lab-orders.spec.ts +++ b/e2e/tests/lab-orders.spec.ts @@ -14,7 +14,7 @@ test.beforeEach(async ({ page }) => { await expect(page.getByText(/patient documents/i)).toBeVisible(); }); -test('Record, revise and discontinue lab tests.', async ({ page }) => { +test('Create, revise and discontinue lab tests.', async ({ page }) => { // setup await bahmni.registerPatient(); @@ -32,7 +32,7 @@ test('Record, revise and discontinue lab tests.', async ({ page }) => { await page.getByText('Serial sputum bacilloscopy').click(); await bahmni.saveOrder(); - // verify + // verify creation await page.locator('#dashboard-link span.patient-name').click(); await expect(page.locator('#Lab-Orders').getByText('Malaria')).toBeVisible(); await expect(page.locator('#Lab-Orders').getByText('Gravindex')).toBeVisible(); @@ -40,6 +40,7 @@ test('Record, revise and discontinue lab tests.', async ({ page }) => { await expect(page.locator('#Lab-Orders').getByText('Bacteria')).toBeVisible(); await expect(page.locator('#Lab-Orders').getByText('Serial sputum bacilloscopy')).toBeVisible(); + // verify revision await page.locator('#view-content :nth-child(1).btn--success').click(); await page.getByText('Orders', { exact: true }).click(); await page.getByText('Blood', { exact: true }).click(); @@ -52,6 +53,7 @@ test('Record, revise and discontinue lab tests.', async ({ page }) => { await page.getByText('Stool Parasites').click(); await bahmni.saveOrder(); + // verify revision await page.locator('#dashboard-link span.patient-name').click(); await expect(page.locator('#Lab-Orders').getByText('Malaria')).not.toBeVisible(); await expect(page.locator('#Lab-Orders').getByText('Blood Sugar')).toBeVisible(); @@ -61,6 +63,18 @@ test('Record, revise and discontinue lab tests.', async ({ page }) => { await expect(page.locator('#Lab-Orders').getByText('Stool Parasites')).toBeVisible(); await expect(page.locator('#Lab-Orders').getByText('Bacteria')).toBeVisible(); await expect(page.locator('#Lab-Orders').getByText('Serial sputum bacilloscopy')).toBeVisible(); + + // verify cancellation + await page.locator('#view-content :nth-child(1).btn--success').click(); + await page.getByText('Orders', { exact: true }).click(); + 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 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(); + await expect(page.locator('#Lab-Orders').getByText('Stool Colour')).not.toBeVisible(); }); test.afterEach(async ({ page }) => { diff --git a/e2e/tests/medications.spec.ts b/e2e/tests/medications.spec.ts index 4ba0127..6d0109d 100644 --- a/e2e/tests/medications.spec.ts +++ b/e2e/tests/medications.spec.ts @@ -14,7 +14,7 @@ test.beforeEach(async ({ page }) => { await expect(page.getByText(/patient documents/i)).toBeVisible(); }); -test('Record, revise and discontinue a drug order.', async ({ page }) => { +test('Create, revise and discontinue a drug order.', async ({ page }) => { // setup await bahmni.registerPatient(); @@ -35,7 +35,7 @@ test('Record, revise and discontinue a drug order.', async ({ page }) => { await page.getByRole('button', { name: 'Add' }).click(); await bahmni.saveOrder(); - // verify + // verify creation await page.locator('#dashboard-link span.patient-name').click(); const drugNameSelector = await page.locator('treatment-table td.drug.active-drug span'); const medicationDetailsSelector = await page.locator('#dashboard-treatments td.dosage span:nth-child(1)'); @@ -45,6 +45,7 @@ test('Record, revise and discontinue a drug order.', async ({ page }) => { await expect(medicationDetailsSelector).toContainText('Estomac vide'); await expect(medicationDetailsSelector).toContainText('Topique'); + // verify revision await page.locator('#view-content :nth-child(1).btn--success').click(); await page.getByText('Medications', { exact: true }).click(); await page.locator('#ordered-drug-orders button:nth-child(1) i').first().click(); @@ -63,6 +64,7 @@ test('Record, revise and discontinue a drug order.', async ({ page }) => { await expect(medicationDetailsSelector).not.toContainText('Ampoule(s)'); await expect(medicationDetailsSelector).toContainText('Inhalation'); + // verify cancellation await page.locator('#view-content :nth-child(1).btn--success').click(); await page.getByText('Medications', { exact: true }).click(); const drugSelector = await page.locator('strong.drug-name').first();