Skip to content

Commit

Permalink
OZ-553: E2E test for discontinuation of synced drug order on Odoo quo…
Browse files Browse the repository at this point in the history
…tation with multiple lines. (#87)
  • Loading branch information
kdaud authored May 14, 2024
1 parent c2e1ee2 commit 25b6352
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion e2e/tests/odoo-openmrs-flows.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ test('Revising a synced OpenMRS drug order edits the corresponding Odoo quotatio
await expect(drugOrderItem).toContainText('Thrice daily - 6 Days');
});

test('Discontinuing a synced OpenMRS drug order removes the corresponding Odoo quotation line.', async ({ page }) => {
test('Discontinuing a synced OpenMRS drug order for an Odoo customer with a single quotation line removes the corresponding quotation.', async ({ page }) => {
// replay
await openmrs.createDrugOrder();
await odoo.open();
Expand All @@ -148,6 +148,41 @@ test('Discontinuing a synced OpenMRS drug order removes the corresponding Odoo q
await expect(QuotationItem).not.toHaveText('Aspirin 325mg');
});


test('Discontinuing a synced OpenMRS drug order for an Odoo customer with multiple quotation lines removes the corresponding quoatation.', async ({ page }) => {
// setup
await openmrs.goToLabOrderForm();
await page.getByRole('button', { name: 'Add', exact: true }).click();
await page.locator('#tab select').selectOption('857AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA');
await openmrs.saveLabOrder();
await openmrs.searchPatient(`${patientName.firstName + ' ' + patientName.givenName}`);
await openmrs.createDrugOrder();
await odoo.open();
await expect(page).toHaveURL(/.*web/);
await odoo.searchCustomer();
const customer = await page.locator("tr.o_data_row:nth-child(1) td:nth-child(4)").textContent();
await expect(customer?.includes(`${patientName.firstName + ' ' + patientName.givenName}`)).toBeTruthy();
const quotation = await page.locator("table tbody td.o_data_cell:nth-child(8)");
await expect(quotation).toHaveText('Quotation');
await page.getByRole('cell', { name: `${patientName.firstName + ' ' + patientName.givenName}` }).click();
const labOrderItem = await page.locator("tr.o_data_row:nth-child(1) td:nth-child(2) span:nth-child(1) span");
const drugOrderItem = await page.locator("tr.o_data_row:nth-child(2) td:nth-child(2) span:nth-child(1) span");
await expect(labOrderItem).toHaveText('Blood urea nitrogen');
await expect(drugOrderItem).toHaveText('Aspirin 325mg');

// replay
await page.goto(`${O3_URL}`);
await openmrs.searchPatient(`${patientName.firstName + ' ' + patientName.givenName}`);
await openmrs.discontinueDrugOrder();

// verify
await page.goto(`${ODOO_URL}`);
await odoo.searchCustomer();
await page.getByRole('cell', { name: `${patientName.firstName + ' ' + patientName.givenName}` }).click();
await expect(labOrderItem).toHaveText('Blood urea nitrogen');
await expect(page.getByText('Aspirin 325mg')).not.toBeVisible();
});

test('Ordering a drug with a free text medication dosage for an OpenMRS patient creates the corresponding Odoo customer with a filled quotation.', async ({ page }) => {
// replay
await openmrs.createDrugOrderWithFreeTextDosage();
Expand Down

0 comments on commit 25b6352

Please sign in to comment.