diff --git a/e2e/tests/odoo-openmrs-flows.spec.ts b/e2e/tests/odoo-openmrs-flows.spec.ts index 8a6e739..c22888e 100644 --- a/e2e/tests/odoo-openmrs-flows.spec.ts +++ b/e2e/tests/odoo-openmrs-flows.spec.ts @@ -40,6 +40,8 @@ test('Editing the details of an OpenMRS patient with a synced lab order edits th 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 page.getByRole('cell', { name: `${patientName.firstName + ' ' + patientName.givenName}` }).click(); + await expect(page.locator('.o_group>table:nth-child(1) :nth-child(2) td:nth-child(2)>span')).toHaveText('08/16/2002'); // replay await page.goto(`${O3_URL}`); @@ -52,6 +54,9 @@ test('Editing the details of an OpenMRS patient with a synced lab order edits th await odoo.searchCustomer(); await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)')).toHaveText(`${patientName.updatedFirstName}` + ' ' + `${patientName.givenName}`); await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(8) span')).toHaveText('Quotation'); + await page.getByRole('cell', { name: `${patientName.firstName + ' ' + patientName.givenName}` }).click(); + await expect(page.locator('.o_group>table:nth-child(1) :nth-child(2) td:nth-child(2)>span')).not.toHaveText('08/16/2002'); + await expect(page.locator('.o_group>table:nth-child(1) :nth-child(2) td:nth-child(2)>span')).toHaveText('08/18/2003'); }); test('Ordering a drug for an OpenMRS patient creates the corresponding Odoo customer with a filled quotation.', async ({ page }) => { @@ -81,6 +86,8 @@ test('Editing the details of an OpenMRS patient with a synced drug order edits t 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 page.getByRole('cell', { name: `${patientName.firstName + ' ' + patientName.givenName}` }).click(); + await expect(page.locator('.o_group>table:nth-child(1) :nth-child(2) td:nth-child(2)>span')).toHaveText('08/16/2002'); // replay await page.goto(`${O3_URL}`); @@ -93,6 +100,9 @@ test('Editing the details of an OpenMRS patient with a synced drug order edits t await odoo.searchCustomer(); await expect(page.locator('table tbody td.o_data_cell:nth-child(4)')).toHaveText(`${patientName.updatedFirstName}` + ' ' + `${patientName.givenName }`); await expect(page.locator('tr.o_data_row:nth-child(1) td:nth-child(8) span')).toHaveText('Quotation'); + await page.getByRole('cell', { name: `${patientName.firstName + ' ' + patientName.givenName}` }).click(); + await expect(page.locator('.o_group>table:nth-child(1) :nth-child(2) td:nth-child(2)>span')).not.toHaveText('08/16/2002'); + await expect(page.locator('.o_group>table:nth-child(1) :nth-child(2) td:nth-child(2)>span')).toHaveText('08/18/2003'); }); test('Revising details of a synced OpenMRS drug order modifies the corresponding Odoo quotation line.', async ({ page }) => { diff --git a/e2e/utils/functions/openmrs.ts b/e2e/utils/functions/openmrs.ts index 6790b9e..48890a7 100644 --- a/e2e/utils/functions/openmrs.ts +++ b/e2e/utils/functions/openmrs.ts @@ -70,10 +70,9 @@ export class OpenMRS { await this.page.getByLabel('Family Name').clear(); await this.page.getByLabel('Family Name').fill(`${patientName.givenName}`); await this.page.locator('label').filter({ hasText: /^Male$/ }).locator('span').first().click(); - await this.page.locator('div').filter({ hasText: /^Date of Birth Known\?YesNo$/ }).getByRole('tab', { name: 'No' }).click(); - await expect(this.page.getByLabel('Estimated age in years')).toBeVisible(); - await this.page.getByLabel('Estimated age in years').clear(); - await this.page.getByLabel('Estimated age in years').fill(`${Math.floor(Math.random() * 99)}`); + await this.page.locator('div[aria-label="day, "]').fill('16'); + await this.page.locator('div[aria-label="month, "]').fill('08'); + await this.page.locator('div[aria-label="year, "]').fill('2002'); await expect(this.page.getByText('Register Patient')).toBeVisible(); await this.page.getByRole('button', { name: 'Register Patient' }).click(); await expect(this.page.getByText('New Patient Created')).toBeVisible(); @@ -360,6 +359,9 @@ export class OpenMRS { await this.page.getByLabel('First Name').type(`${patientName.updatedFirstName}`); await delay(2000); await this.page.locator('label').filter({ hasText: 'Female' }).locator('span').first().click(); + await this.page.locator('div[aria-label="day, "]').fill('18'); + await this.page.locator('div[aria-label="month, "]').fill('08'); + await this.page.locator('div[aria-label="year, "]').fill('2003'); await this.page.getByRole('button', { name: 'Update Patient' }).click(); await expect(this.page.getByText('Patient Details Updated')).toBeVisible(); patientName.firstName = `${patientName.updatedFirstName}`;