Skip to content

Commit

Permalink
Address reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
kdaud committed Aug 20, 2024
1 parent edd2d34 commit 2eeb438
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
18 changes: 16 additions & 2 deletions e2e/tests/lab-orders.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -32,14 +32,15 @@ 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();
await expect(page.locator('#Lab-Orders').getByText('Stool Colour')).toBeVisible();
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();
Expand All @@ -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();
Expand All @@ -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 }) => {
Expand Down
20 changes: 10 additions & 10 deletions e2e/tests/medications.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -35,16 +35,19 @@ test('Record, revise and discontinue a drug order.', async ({ page }) => {
await page.getByRole('button', { name: 'Add' }).click();
await bahmni.saveOrder();

// verify
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)');
// verify creation
const drugNameSelector = await page.locator('#ordered-drug-orders strong.drug-name').first();
const medicationDetailsSelector = await page.locator('#ordered-drug-orders div.drug-details').first();
await expect(drugNameSelector).toHaveText('Aspirine Co 81mg (Comprime)');
await expect(medicationDetailsSelector).toContainText('2 Application(s)');
await expect(medicationDetailsSelector).toContainText('Q3H');
await expect(medicationDetailsSelector).toContainText('Estomac vide');
await expect(medicationDetailsSelector).toContainText('Topique');
await page.locator('#dashboard-link span.patient-name').click();
const medicationSelector = await page.locator('treatment-table td.drug.active-drug span');
await expect(medicationSelector).toHaveText('Aspirine Co 81mg (Comprime)');

// 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();
Expand All @@ -55,18 +58,15 @@ test('Record, revise and discontinue a drug order.', async ({ page }) => {
await page.locator('#route').selectOption('string:Inhalation');
await page.getByRole('button', { name: 'Add' }).click();
await bahmni.saveOrder();
await page.locator('#dashboard-link span.patient-name').click();
await expect(medicationDetailsSelector).not.toContainText('2 Application(s)');
await expect(medicationDetailsSelector).toContainText('4 Comprime(s)');
await expect(medicationDetailsSelector).not.toContainText('Q3H');
await expect(medicationDetailsSelector).toContainText('Q4H,');
await expect(medicationDetailsSelector).not.toContainText('Ampoule(s)');
await expect(medicationDetailsSelector).toContainText('Inhalation');

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();
await expect(drugSelector).toContainText('Aspirine Co 81mg (Comprime)');
// verify cancellation
await expect(drugNameSelector).toContainText('Aspirine Co 81mg (Comprime)');
await page.getByRole('button', { name: 'Stop' }).first().click();
await page.getByPlaceholder('Notes').clear();
await page.getByPlaceholder('Notes').fill('Patient allergic to medicine');
Expand Down

0 comments on commit 2eeb438

Please sign in to comment.