From 25a543db1c4ebb079bd4b576860bcfae6ba5f716 Mon Sep 17 00:00:00 2001 From: kdaud Date: Fri, 17 Jan 2025 09:41:40 +0300 Subject: [PATCH] =?UTF-8?q?Updated=20editing=20test=20patient=20+=20Fixed?= =?UTF-8?q?=20O3=20=E2=86=92=20ERPNext=20flows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- e2e/tests/erpnext-openmrs-flows.spec.ts | 22 +---------------- e2e/utils/functions/erpnext.ts | 32 ------------------------- e2e/utils/functions/openmrs.ts | 3 +-- package.json | 2 +- 4 files changed, 3 insertions(+), 56 deletions(-) diff --git a/e2e/tests/erpnext-openmrs-flows.spec.ts b/e2e/tests/erpnext-openmrs-flows.spec.ts index ef6917d..e2be726 100644 --- a/e2e/tests/erpnext-openmrs-flows.spec.ts +++ b/e2e/tests/erpnext-openmrs-flows.spec.ts @@ -25,8 +25,6 @@ test('Ordering a lab test for an OpenMRS patient creates the corresponding ERPNe await erpnext.open(); await erpnext.searchCustomer(); await expect(page.locator('div.list-row-container:nth-child(3) span:nth-child(2) a')).toContainText(`${patientName.firstName + ' ' + patientName.givenName}`); - await openmrs.voidPatient(); - await erpnext.deleteQuotation(); }); test('Ordering a drug for an OpenMRS patient creates the corresponding ERPNext customer with a filled quotation.', async ({ page }) => { @@ -44,8 +42,6 @@ test('Ordering a drug for an OpenMRS patient creates the corresponding ERPNext c await page.locator('#customer-dashboard_tab-tab').click(); await page.getByLabel('Dashboard').getByText('Quotation').click(); await expect(page.locator('div.list-row-container:nth-child(3) div:nth-child(3) span:nth-child(1) span').nth(1)).toHaveText('Draft'); - await openmrs.voidPatient(); - await erpnext.deleteQuotation(); }); test('Editing the details of an OpenMRS patient with a synced lab order edits the corresponding ERPNext customer details.', async ({ page }) => { @@ -66,8 +62,6 @@ test('Editing the details of an OpenMRS patient with a synced lab order edits th await page.goto(`${ERPNEXT_URL}/app/home`); await erpnext.searchCustomer(); await expect(page.locator('div.list-row-container:nth-child(3) span:nth-child(2) a')).toContainText(`${patientName.updatedFirstName}` + ' ' + `${patientName.givenName}`); - await openmrs.voidPatient(); - await erpnext.deleteQuotation(); }); test('Editing the details of an OpenMRS patient with a synced drug order edits the corresponding ERPNext customer details.', async ({ page }) => { @@ -89,8 +83,6 @@ test('Editing the details of an OpenMRS patient with a synced drug order edits t await page.goto(`${ERPNEXT_URL}/app/home`); await erpnext.searchCustomer(); await expect(page.locator('div.list-row-container:nth-child(3) span:nth-child(2) a')).toContainText(`${patientName.updatedFirstName}` + ' ' + `${patientName.givenName}`); - await openmrs.voidPatient(); - await erpnext.deleteQuotation(); }); test('Ending an OpenMRS patient visit with a synced drug order updates the corresponding ERPNext draft quotation to an open state.', async ({ page }) => { @@ -112,9 +104,6 @@ test('Ending an OpenMRS patient visit with a synced drug order updates the corre await page.goto(`${ERPNEXT_URL}/app/home`); await erpnext.searchQuotation(); await expect(page.locator('div.list-row-container:nth-child(3) div:nth-child(3) span:nth-child(1) span')).toHaveText('Open'); - await erpnext.voidQuotation(); - await openmrs.voidPatient(); - await erpnext.deleteQuotation(); }); test('Revising details of a synced OpenMRS drug order modifies the corresponding ERPNext quotation item.', async ({ page }) => { @@ -138,8 +127,6 @@ test('Revising details of a synced OpenMRS drug order modifies the corresponding await erpnext.searchQuotation(); await page.getByRole('link', { name: `${patientName.firstName + ' ' + patientName.givenName}` }).click(); await expect(page.locator('div.bold:nth-child(4) div:nth-child(2) div')).toHaveText('8'); - await openmrs.voidPatient(); - await erpnext.deleteQuotation(); }); test('Ordering a drug with a free text medication dosage for an OpenMRS patient creates the corresponding ERPNext customer with a filled quotation.', async ({ page }) => { @@ -155,8 +142,6 @@ test('Ordering a drug with a free text medication dosage for an OpenMRS patient await page.getByLabel('Dashboard').getByText('Quotation').click(); await erpnext.searchQuotation(); await expect(page.locator('div.list-row-container:nth-child(3) div:nth-child(3) span:nth-child(1) span').nth(1)).toHaveText('Draft'); - await openmrs.voidPatient(); - await erpnext.deleteQuotation(); }); test('Discontinuing a synced OpenMRS drug order for an ERPNext customer with a single quotation line removes the corresponding quotation.', async ({ page }) => { @@ -179,7 +164,6 @@ test('Discontinuing a synced OpenMRS drug order for an ERPNext customer with a s await erpnext.searchQuotation(); await expect(page.getByText(`${patientName.firstName + ' ' + patientName.givenName}`)).not.toBeVisible(); await expect(page.getByText('No Quotation found')).toBeVisible(); - await openmrs.voidPatient(); }); test('Discontinuing a synced OpenMRS lab order for an ERPNext customer removes the corresponding quotation.', async ({ page }) => { @@ -202,7 +186,6 @@ test('Discontinuing a synced OpenMRS lab order for an ERPNext customer removes t await erpnext.searchQuotation(); await expect(page.getByText(`${patientName.firstName + ' ' + patientName.givenName}`)).not.toBeVisible(); await expect(page.getByText('No Quotation found')).toBeVisible(); - await openmrs.voidPatient(); }); test('Ordering a drug for an OpenMRS patient within a visit creates the corresponding ERPNext customer with a filled quotation linked to the visit.', async ({ page }) => { @@ -230,13 +213,10 @@ test('Ordering a drug for an OpenMRS patient within a visit creates the correspo await erpnext.searchQuotation(); await expect(page.locator('div.list-row-container:nth-child(3) div:nth-child(3) span:nth-child(1) span')).toHaveText('Draft'); await expect(page.locator('div.list-row-container:nth-child(4) div:nth-child(3) span:nth-child(1) span')).toHaveText('Open'); - await erpnext.voidQuotation(); - await openmrs.voidPatient(); - await erpnext.deleteQuotation(); }); test.afterEach(async ({ page }) => { - await erpnext.deleteCustomer(); + await openmrs.voidPatient(); await openmrs.logout(); await page.close(); }); diff --git a/e2e/utils/functions/erpnext.ts b/e2e/utils/functions/erpnext.ts index 6372f2f..bc81be6 100644 --- a/e2e/utils/functions/erpnext.ts +++ b/e2e/utils/functions/erpnext.ts @@ -28,36 +28,4 @@ export class ERPNext { await this.page.getByPlaceholder(/party/i).clear(); await this.page.getByPlaceholder(/title/i).fill(`${patientName.givenName}`), delay(3500); } - - async deleteQuotation() { - await this.page.goto(`${ERPNEXT_URL}/app/quotation`); - await this.searchQuotation(); - await this.page.getByRole('checkbox', { name: 'Select All' }).check(), delay(2000); - await this.page.getByRole('button', { name: 'Actions' }).click(); - await expect(this.page.getByRole('link', { name: 'Delete' })).toBeVisible(); - await this.page.getByRole('link', { name: 'Delete' }).click(); - await this.page.getByRole('button', { name: 'Yes' }).click(); - await expect(this.page.getByText(/no quotation found/i)).toBeVisible(); - } - - async voidQuotation() { - await this.page.goto(`${ERPNEXT_URL}/app/quotation`); - await this.searchQuotation(); - await this.page.getByRole('checkbox', { name: 'Select All' }).check(), delay(2000); - await this.page.getByRole('button', { name: 'Actions' }).click(); - await expect(this.page.getByRole('link', { name: 'Cancel' })).toBeVisible(); - await this.page.getByRole('link', { name: 'Cancel' }).click(); - await this.page.getByRole('button', { name: 'Yes' }).click(); - } - - async deleteCustomer() { - await this.page.goto(`${ERPNEXT_URL}/app/customer`); - await this.searchCustomer(); - await this.page.getByRole('checkbox', { name: 'Select All' }).check(), delay(2000); - await this.page.getByRole('button', { name: 'Actions' }).click(); - await expect(this.page.getByRole('link', { name: 'Delete' })).toBeVisible(); - await this.page.getByRole('link', { name: 'Delete' }).click(); - await this.page.getByRole('button', { name: 'Yes' }).click(); - await expect(this.page.getByText(/no customer found/i)).toBeVisible(); - } } diff --git a/e2e/utils/functions/openmrs.ts b/e2e/utils/functions/openmrs.ts index ea00398..fd2f88b 100644 --- a/e2e/utils/functions/openmrs.ts +++ b/e2e/utils/functions/openmrs.ts @@ -321,7 +321,7 @@ export class OpenMRS { await this.page.getByRole('button', { name: /actions/i, exact: true }).click(); await this.page.getByRole('menuitem', { name: /edit patient details/i }).click(), delay(4000); await expect(this.page.locator('#givenName')).toBeVisible(); - await this.page.locator('#givenName').type(`${patientName.updatedFirstName}`), delay(2000); + await this.page.locator('#givenName').fill(`${patientName.updatedFirstName}`), delay(2000); await this.page.locator('label').filter({ hasText: /female/i }).locator('span').first().click(); await this.page.locator('div[aria-label="day, "]').fill('18'); await this.page.locator('div[aria-label="month, "]').fill('08'); @@ -346,7 +346,6 @@ export class OpenMRS { async updateRole() { await this.page.getByRole('link', { name: `${randomOpenMRSRoleName.roleName}` }).click(); - await this.page.locator('textarea[name="description"]').clear(); await this.page.locator('textarea[name="description"]').fill('Updated role description'); await this.page.getByLabel('Application: Registers Patients').check(); await this.page.getByLabel('Application: Writes Clinical Notes').check(); diff --git a/package.json b/package.json index b2d32f2..179ee6d 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "!playwright-report/" ], "scripts": { - "ozone-pro": "npx playwright test", + "ozone-pro": "npx playwright test openmrs-senaite", "ozone-foss": "npx playwright test odoo-openmrs erpnext-openmrs openmrs-senaite", "openmrs-distro-his": "npx playwright test odoo-openmrs openmrs-senaite" },