Skip to content

Commit

Permalink
OZ-525: E2E test verifying that patient's weight is synced to Odoo
Browse files Browse the repository at this point in the history
  • Loading branch information
kdaud committed Dec 4, 2024
1 parent ed131b5 commit ff54875
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
18 changes: 18 additions & 0 deletions e2e/tests/odoo-openmrs-flows.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,24 @@ test('Discontinuing a synced OpenMRS lab order for an Odoo customer with a singl
await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(8) span')).toHaveText('Cancelled');
});

test('Ordering a lab test for an OpenMRS patient with weight creates the corresponding Odoo customer, with a quotation that includes the weight.', async ({ page }) => {
// replay
await openmrs.captureBiometrics();
await openmrs.navigateToLabOrderForm();
await page.getByRole('searchbox').fill('Blood urea nitrogen');
await openmrs.saveLabOrder();

// verify
await odoo.open();
await odoo.navigateToSales();
await odoo.searchCustomer();
await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)')).toContainText(`${patientName.firstName + ' ' + patientName.givenName}`);
await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(8) span')).toHaveText('Quotation');
await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(7) span')).toHaveText('$ 27.50');
await page.getByRole('cell', { name: `${patientName.firstName + ' ' + patientName.givenName}` }).click();
await expect(page.locator('.o_group :nth-child(1) tbody :nth-child(3) :nth-child(2)>span')).toContainText('75');
});

test.afterEach(async ({ page }) => {
await openmrs.voidPatient();
await openmrs.logout();
Expand Down
10 changes: 10 additions & 0 deletions e2e/utils/functions/openmrs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,16 @@ export class OpenMRS {
await delay(5000);
}

async captureBiometrics() {
await this.page.getByRole('link', { name: 'Vitals & Biometrics' }).click();
await this.page.getByRole('button', { name: 'Record biometrics' }).click();
await this.page.getByRole('spinbutton', { name: 'Weight' }).fill('75');
await this.page.getByRole('spinbutton', { name: 'Height' }).fill('168');
await this.page.getByRole('spinbutton', { name: 'MUAC' }).fill('12.5');
await this.page.getByRole('button', { name: 'Save and close' }).click();
await expect(this.page.getByText('Vitals and Biometrics saved')).toBeVisible();
}

async voidEncounter() {
await this.page.getByRole('link', { name: 'Visits' }).click();
await this.page.getByRole('tab', { name: 'All encounters' }).click();
Expand Down

0 comments on commit ff54875

Please sign in to comment.