Skip to content

Commit

Permalink
OZ-252: Discontinuing a synced lab order cancels corresponding quotat…
Browse files Browse the repository at this point in the history
…ion line in Odoo (#99)
  • Loading branch information
kdaud authored Jul 12, 2024
1 parent 498b002 commit bbc11a0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
4 changes: 3 additions & 1 deletion e2e/tests/erpnext-openmrs-flows.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ test.beforeEach(async ({ page }) => {

test('Ordering a lab test for an OpenMRS patient creates the corresponding ERPNext customer.', async ({ page }) => {
// replay
await openmrs.createLabOrder();
await openmrs.goToLabOrderForm();
await page.getByPlaceholder('Search for a test type').fill('Blood urea nitrogen');
await openmrs.saveLabOrder();

// verify
await erpnext.open();
Expand Down
24 changes: 24 additions & 0 deletions e2e/tests/odoo-openmrs-flows.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,30 @@ test('Ordering a drug with a free text medication dosage for an OpenMRS patient
await expect(quotation?.includes("Quotation")).toBeTruthy();
});

test('Discontinuing a synced OpenMRS lab order for an Odoo customer with a single quotation line cancels the corresponding quotation.', async ({ page }) => {
// replay
await openmrs.goToLabOrderForm();
await page.getByPlaceholder('Search for a test type').fill('Blood urea nitrogen');
await openmrs.saveLabOrder();
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.goto(`${O3_URL}`);
await openmrs.searchPatient(`${patientName.firstName + ' ' + patientName.givenName}`);
await openmrs.cancelLabOrder();

// verify
await page.goto(`${ODOO_URL}`);
await odoo.searchCustomer();
await expect(customer?.includes(`${patientName.firstName + ' ' + patientName.givenName}`)).toBeTruthy();
await expect(quotation).toHaveText('Cancelled');
});

test.afterEach(async ({ page }) => {
await openmrs.voidPatient();
await page.close();
Expand Down

0 comments on commit bbc11a0

Please sign in to comment.