diff --git a/e2e/tests/odoo-openmrs-flows.spec.ts b/e2e/tests/odoo-openmrs-flows.spec.ts index 58ebd388..348faa24 100644 --- a/e2e/tests/odoo-openmrs-flows.spec.ts +++ b/e2e/tests/odoo-openmrs-flows.spec.ts @@ -19,8 +19,7 @@ test.beforeEach(async ({ page }) => { test('Ordering a lab test for an OpenMRS patient creates the corresponding Odoo customer with a filled quotation.', async ({ page }) => { // replay await openmrs.goToLabOrderForm(); - await page.getByRole('button', { name: 'Add', exact: true }).click(); - await page.locator('#tab select').selectOption('857AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); + await page.getByPlaceholder('Search for a test type').fill('Blood urea nitrogen'); await openmrs.saveLabOrder(); // verify @@ -37,8 +36,7 @@ test('Ordering a lab test for an OpenMRS patient creates the corresponding Odoo test('Editing the details of an OpenMRS patient with a synced lab order edits the corresponding Odoo customer details.', async ({ page }) => { // replay await openmrs.goToLabOrderForm(); - await page.getByRole('button', { name: 'Add', exact: true }).click(); - await page.locator('#tab select').selectOption('857AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); + await page.getByPlaceholder('Search for a test type').fill('Blood urea nitrogen'); await openmrs.saveLabOrder(); await odoo.open(); await expect(page).toHaveURL(/.*web/); @@ -151,8 +149,7 @@ test('Discontinuing a synced OpenMRS drug order for an Odoo customer with a sing 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 page.getByPlaceholder('Search for a test type').fill('Blood urea nitrogen'); await openmrs.saveLabOrder(); await openmrs.searchPatient(`${patientName.firstName + ' ' + patientName.givenName}`); await openmrs.createDrugOrder(); diff --git a/e2e/tests/openmrs-senaite-flows.spec.ts b/e2e/tests/openmrs-senaite-flows.spec.ts index 187b6fa5..f06118af 100644 --- a/e2e/tests/openmrs-senaite-flows.spec.ts +++ b/e2e/tests/openmrs-senaite-flows.spec.ts @@ -19,8 +19,7 @@ test.beforeEach(async ({ page }) => { test('Ordering a lab test for an OpenMRS patient creates the corresponding SENAITE client with an analysis request.', async ({ page }) => { // replay await openmrs.goToLabOrderForm(); - await page.getByRole('button', { name: 'Add', exact: true }).click(); - await page.locator('#tab select').selectOption('857AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); + await page.getByPlaceholder('Search for a test type').fill('Blood urea nitrogen'); await openmrs.saveLabOrder(); // verify @@ -34,8 +33,7 @@ test('Ordering a lab test for an OpenMRS patient creates the corresponding SENAI test('Editing the details of an OpenMRS patient with a synced lab order edits the corresponding SENAITE client details.', async ({ page }) => { // replay await openmrs.goToLabOrderForm(); - await page.getByRole('button', { name: 'Add', exact: true }).click(); - await page.locator('#tab select').selectOption('857AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); + await page.getByPlaceholder('Search for a test type').fill('Blood urea nitrogen'); await openmrs.saveLabOrder(); await senaite.open(); await expect(page).toHaveURL(/.*senaite/); @@ -56,9 +54,9 @@ test('Editing the details of an OpenMRS patient with a synced lab order edits th test('Editing a synced OpenMRS lab order edits the corresponding SENAITE analysis request.', async ({ page }) => { // replay await openmrs.goToLabOrderForm(); - await page.getByRole('button', { name: 'Add', exact: true }).click(); - await page.locator('#tab select').selectOption('857AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); + await page.getByPlaceholder('Search for a test type').fill('Blood urea nitrogen'); await openmrs.saveLabOrder(); + await senaite.open(); await expect(page).toHaveURL(/.*senaite/); await senaite.searchClient(); @@ -85,8 +83,7 @@ test('Editing a synced OpenMRS lab order edits the corresponding SENAITE analysi test('Voiding a synced OpenMRS lab order cancels the corresponding SENAITE analysis request.', async ({ page }) => { // replay await openmrs.goToLabOrderForm(); - await page.getByRole('button', { name: 'Add', exact: true }).click(); - await page.locator('#tab select').selectOption('857AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); + await page.getByPlaceholder('Search for a test type').fill('Blood urea nitrogen'); await openmrs.saveLabOrder(); await senaite.open(); await expect(page).toHaveURL(/.*senaite/); @@ -99,7 +96,7 @@ test('Voiding a synced OpenMRS lab order cancels the corresponding SENAITE analy await expect(analysisRequest).toHaveText('Blood urea nitrogen Template'); await page.goto(`${O3_URL}`); await openmrs.searchPatient(`${patientName.firstName + ' ' + patientName.givenName}`); - await openmrs.voidEncounter(); + await openmrs.cancelLabOrder(); // verify await page.goto(`${SENAITE_URL}`); @@ -110,8 +107,7 @@ test('Voiding a synced OpenMRS lab order cancels the corresponding SENAITE analy test('Published coded lab results from SENAITE are viewable in the OpenMRS lab results viewer.', async ({ page }) => { // replay await openmrs.goToLabOrderForm(); - await page.getByRole('button', { name: 'Add', exact: true }).click(); - await page.locator('#tab select').selectOption('1325AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); + await page.getByPlaceholder('Search for a test type').fill('Hepatitis C test - qualitative'); await openmrs.saveLabOrder(); await senaite.open(); await expect(page).toHaveURL(/.*senaite/); @@ -135,8 +131,7 @@ test('Published coded lab results from SENAITE are viewable in the OpenMRS lab r test('Published numeric lab results from SENAITE are viewable in the OpenMRS lab results viewer.', async ({ page }) => { // replay await openmrs.goToLabOrderForm(); - await page.getByRole('button', { name: 'Add', exact: true }).click(); - await page.locator('#tab select').selectOption('655AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); + await page.getByPlaceholder('Search for a test type').fill('Total bilirubin'); await openmrs.saveLabOrder(); await senaite.open(); await expect(page).toHaveURL(/.*senaite/); @@ -160,8 +155,7 @@ test('Published numeric lab results from SENAITE are viewable in the OpenMRS lab test('Published free text lab results from SENAITE are viewable in the OpenMRS lab results viewer.', async ({ page }) => { // replay await openmrs.goToLabOrderForm(); - await page.getByRole('button', { name: 'Add', exact: true }).click(); - await page.locator('#tab select').selectOption('161447AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); + await page.getByPlaceholder('Search for a test type').fill('Stool microscopy with concentration'); await openmrs.saveLabOrder(); await senaite.open(); await expect(page).toHaveURL(/.*senaite/); diff --git a/e2e/utils/functions/openmrs.ts b/e2e/utils/functions/openmrs.ts index caff363f..1261be22 100644 --- a/e2e/utils/functions/openmrs.ts +++ b/e2e/utils/functions/openmrs.ts @@ -217,10 +217,12 @@ export class OpenMRS { await expect(this.page.getByText('Appointment cancelled successfully')).toBeVisible(); } - async createLabOrder() { + async goToLabOrderForm() { await this.page.getByLabel('Order basket', { exact: true }).click(); await this.page.getByRole('button', { name: 'Add', exact: true }).nth(1).click(); - await this.page.getByPlaceholder('Search for a test type').fill('Urobilinogen'); + } + + async saveLabOrder() { await delay(3000); await this.page.getByRole('button', { name: 'Order form' }).click(); await this.page.getByRole('button', { name: 'Save order' }).click(); @@ -229,29 +231,16 @@ export class OpenMRS { await delay(3000); } - async goToLabOrderForm() { - await this.page.getByLabel('Clinical forms').click(); - await delay(3000); - await expect(this.page.getByText('Laboratory Test Orders')).toBeVisible(); - await this.page.getByText('Laboratory Test Orders').click(); - } - - async saveLabOrder() { - await this.page.getByRole('button', { name: 'Save and close' }).click(); - await expect(this.page.getByText('Lab order(s) generated')).toBeVisible(); - await this.page.getByRole('button', { name: 'Close', exact: true }).click(); - await delay(5000); - } - async updateLabOrder() { - await this.page.getByRole('link', { name: 'Visits' }).click(); - await this.page.getByRole('tab', { name: 'All encounters' }).click(); - await this.page.getByRole('button', { name: 'Options', exact: true }).click(); - await this.page.getByRole('menuitem', { name: 'Edit this encounter' }).click(); - await this.page.locator('#tab select').selectOption('160225AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); - await this.page.getByRole('button', { name: 'Save and close' }).click(); - await expect(this.page.getByText('Lab order(s) generated')).toBeVisible(); - await delay(5000); + await this.page.getByRole('link', { name: 'Orders' }).click(); + await this.page.getByRole('button', { name: 'Options' }).nth(0).click(); + await this.page.getByRole('menuitem', { name: 'Modify order' }).click(); + await this.page.getByPlaceholder('Search for a test type').fill('Sickle cell screening test'); + await delay(3000); + await this.page.getByRole('button', { name: 'Order form' }).click(); + await this.page.getByRole('button', { name: 'Save order' }).click(); + await this.page.getByRole('button', { name: 'Sign and close' }).click(); + await delay(3000); } async voidEncounter() { @@ -265,6 +254,14 @@ export class OpenMRS { await delay(5000); } + async cancelLabOrder() { + await this.page.getByRole('link', { name: 'Orders' }).click(); + await this.page.getByRole('button', { name: 'Options' }).nth(0).click(); + await this.page.getByRole('menuitem', { name: 'Cancel Order' }).click(); + await this.page.getByRole('button', { name: 'Sign and close' }).click(); + await delay(3000); + } + async viewTestResults() { await this.searchPatient(`${patientName.firstName + ' ' + patientName.givenName}`); await this.page.getByRole('link', { name: 'Results Viewer' }).click();