diff --git a/e2e/tests/keycloak-openmrs-flows.spec.ts b/e2e/tests/keycloak-openmrs-flows.spec.ts index fb68b584..e6aa71d0 100644 --- a/e2e/tests/keycloak-openmrs-flows.spec.ts +++ b/e2e/tests/keycloak-openmrs-flows.spec.ts @@ -20,10 +20,10 @@ test.beforeEach(async ({ page }) => { test('Creating an OpenMRS role creates the corresponding Keycloak role.', async ({ page }) => { // replay await page.goto(`${O3_URL}/openmrs/admin/users/role.list`); - await openmrs.addOpenMRSRole(); + await openmrs.addRole(); // verify - await keycloack.goToKeycloak(); + await keycloack.open(); await expect(page).toHaveURL(/.*console/); await keycloack.goToClients(); await keycloack.selectOpenMRSId() @@ -35,14 +35,14 @@ test('Creating an OpenMRS role creates the corresponding Keycloak role.', async await expect(page.getByText('Application: Uses Patient Summary')).toBeTruthy(); await expect(page.getByText('Application: Has Super User Privileges')).toBeTruthy(); await expect(page.getByText('Application: Administers System')).toBeTruthy(); - await openmrs.deleteOpenMRSRole(); + await openmrs.deleteRole(); }); test('Updating a synced OpenMRS role updates the corresponding Keycloak role.', async ({ page }) => { // replay await page.goto(`${O3_URL}/openmrs/admin/users/role.list`); - await openmrs.addOpenMRSRole(); - await keycloack.goToKeycloak(); + await openmrs.addRole(); + await keycloack.open(); await expect(page).toHaveURL(/.*console/); await keycloack.goToClients(); await keycloack.selectOpenMRSId(); @@ -55,7 +55,7 @@ test('Updating a synced OpenMRS role updates the corresponding Keycloak role.', await expect(page.getByText('Organizational: Registration Clerk')).toBeTruthy(); await expect(page.getByText('Application: Records Allergies')).toBeTruthy(); await page.goto(`${O3_URL}/openmrs/admin/users/role.list`); - await openmrs.updateOpenMRSRole(); + await openmrs.updateRole(); // verify await page.goto(`${KEYCLOAK_URL}/admin/master/console`); @@ -66,14 +66,14 @@ test('Updating a synced OpenMRS role updates the corresponding Keycloak role.', await page.getByTestId('attributesTab').click(); await expect(page.getByText('Application: Registers Patients')).toBeTruthy(); await expect(page.getByText('Application: Writes Clinical Notes')).toBeTruthy(); - await openmrs.deleteOpenMRSRole(); + await openmrs.deleteRole(); }); test('Deleting a synced OpenMRS role deletes the corresponding Keycloak role.', async ({ page }) => { // replay await page.goto(`${O3_URL}/openmrs/admin/users/role.list`); - await openmrs.addOpenMRSRole(); - await keycloack.goToKeycloak(); + await openmrs.addRole(); + await keycloack.open(); await expect(page).toHaveURL(/.*console/); await keycloack.goToClients(); await keycloack.selectOpenMRSId(); @@ -85,7 +85,7 @@ test('Deleting a synced OpenMRS role deletes the corresponding Keycloak role.', await expect(page.getByText('Application: Uses Patient Summary')).toBeTruthy(); await expect(page.getByText('Organizational: Registration Clerk')).toBeTruthy(); await expect(page.getByText('Application: Records Allergies')).toBeTruthy(); - await openmrs.deleteOpenMRSRole(); + await openmrs.deleteRole(); // verify await page.goto(`${KEYCLOAK_URL}/admin/master/console`); @@ -97,27 +97,27 @@ test('Deleting a synced OpenMRS role deletes the corresponding Keycloak role.', test('Creating a Superset role creates the corresponding Keycloak role.', async ({ page }) => { // replay - await superset.goToSuperset(); - await superset.addSupersetRole(); + await superset.open(); + await superset.addRole(); // verify - await keycloack.goToKeycloak(); + await keycloack.open(); await keycloack.goToClients(); await keycloack.selectSupersetId(); await expect(page.getByText(`${randomSupersetRoleName.roleName}`)).toBeVisible(); - await superset.deleteSupersetRole(); + await superset.deleteRole(); }); test('Updating a synced Superset role updates the corresponding Keycloak role.', async ({ page }) => { // replay - await superset.goToSuperset(); - await superset.addSupersetRole(); - await keycloack.goToKeycloak(); + await superset.open(); + await superset.addRole(); + await keycloack.open(); await keycloack.goToClients(); await keycloack.selectSupersetId(); await expect(page.getByText(`${randomSupersetRoleName.roleName}`)).toBeVisible(); await expect(page.getByText('')).toBeTruthy(); - await superset.updateSupersetRole(); + await superset.updateRole(); // verify await page.goto(`${KEYCLOAK_URL}/admin/master/console`); @@ -125,18 +125,18 @@ test('Updating a synced Superset role updates the corresponding Keycloak role.', await keycloack.selectSupersetId(); await expect(page.getByText(`${randomSupersetRoleName.roleName}`)).not.toBeVisible(); await expect(page.getByText(`${randomSupersetRoleName.updatedRoleName}`)).toBeVisible(); - await superset.deleteUpdatedSupersetRole(); + await superset.deleteUpdatedRole(); }); test('Deleting a synced Superset role deletes the corresponding Keycloak role.', async ({ page }) => { // replay - await superset.goToSuperset(); - await superset.addSupersetRole(); - await keycloack.goToKeycloak(); + await superset.open(); + await superset.addRole(); + await keycloack.open(); await keycloack.goToClients(); await keycloack.selectSupersetId(); await expect(page.getByText(`${randomSupersetRoleName.roleName}`)).toBeVisible(); - await superset.deleteSupersetRole(); + await superset.deleteRole(); await delay(30000); // verify @@ -148,29 +148,29 @@ test('Deleting a synced Superset role deletes the corresponding Keycloak role.', test('A synced role deleted from within Keycloak gets recreated in the subsequent polling cycle.', async ({ page }) => { // replay - await superset.goToSuperset(); - await superset.addSupersetRole(); + await superset.open(); + await superset.addRole(); // verify - await keycloack.goToKeycloak(); + await keycloack.open(); await keycloack.goToClients(); await keycloack.selectSupersetId(); await expect(page.getByText(`${randomSupersetRoleName.roleName}`)).toBeVisible(); - await superset.deleteSyncedSupersetRoleInKeycloak(); + await keycloack.deleteSyncedRole(); await expect(page.getByText(`${randomSupersetRoleName.roleName}`)).not.toBeVisible(); await delay(30000); await page.getByLabel('Manage').getByRole('link', { name: 'Clients' }).click(); await keycloack.selectSupersetId(); await expect(page.getByText(`${randomSupersetRoleName.roleName}`)).toBeVisible(); - await superset.deleteSupersetRole(); + await superset.deleteRole(); }); test('A (non-synced) role created from within Keycloak gets deleted in the subsequent polling cycle.', async ({ page }) => { // replay - await keycloack.goToKeycloak(); + await keycloack.open(); await keycloack.goToClients(); await keycloack.selectOpenMRSId(); - await keycloack.createRoleInKeycloak(); + await keycloack.createRole(); // verify await page.getByRole('link', { name: 'Client details' }).click(); diff --git a/e2e/tests/odoo-openmrs-flows.spec.ts b/e2e/tests/odoo-openmrs-flows.spec.ts index 42a015af..18a9312d 100644 --- a/e2e/tests/odoo-openmrs-flows.spec.ts +++ b/e2e/tests/odoo-openmrs-flows.spec.ts @@ -24,9 +24,9 @@ test('Ordering a lab test for an OpenMRS patient creates the corresponding Odoo await openmrs.saveLabOrder(); // verify - await odoo.goToOdoo(); + await odoo.open(); await expect(page).toHaveURL(/.*web/); - await odoo.searchCustomerInOdoo(); + 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(); @@ -40,9 +40,9 @@ test('Editing the details of an OpenMRS patient with a synced lab order edits th await page.getByRole('button', { name: 'Add', exact: true }).click(); await page.locator('#tab select').selectOption('857AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); await openmrs.saveLabOrder(); - await odoo.goToOdoo(); + await odoo.open(); await expect(page).toHaveURL(/.*web/); - await odoo.searchCustomerInOdoo(); + 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)").textContent(); @@ -53,7 +53,7 @@ test('Editing the details of an OpenMRS patient with a synced lab order edits th // verify await page.goto(`${ODOO_URL}`); - await odoo.searchCustomerInOdoo(); + await odoo.searchCustomer(); const updatedCustomer = await page.locator("tr.o_data_row:nth-child(1) td:nth-child(4)"); await expect(updatedCustomer).toHaveText(`${patientName.updatedFirstName}` + ' ' + `${patientName.givenName}`); await expect(quotation?.includes("Quotation")).toBeTruthy(); @@ -64,9 +64,9 @@ test('Ordering a drug for an OpenMRS patient creates the corresponding Odoo cust await openmrs.makeDrugOrder(); // verify - await odoo.goToOdoo(); + await odoo.open(); await expect(page).toHaveURL(/.*web/); - await odoo.searchCustomerInOdoo(); + 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(); @@ -77,9 +77,9 @@ test('Ordering a drug for an OpenMRS patient creates the corresponding Odoo cust test('Editing the details of an OpenMRS patient with a synced drug order edits the corresponding Odoo customer details.', async ({ page }) => { // replay await openmrs.makeDrugOrder(); - await odoo.goToOdoo(); + await odoo.open(); await expect(page).toHaveURL(/.*web/); - await odoo.searchCustomerInOdoo(); + 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)").textContent(); @@ -90,7 +90,7 @@ test('Editing the details of an OpenMRS patient with a synced drug order edits t // verify await page.goto(`${ODOO_URL}`); - await odoo.searchCustomerInOdoo(); + await odoo.searchCustomer(); const updatedCustomer = await page.locator("table tbody td.o_data_cell:nth-child(4)"); await expect(updatedCustomer).toHaveText(`${patientName.updatedFirstName}` + ' ' + `${patientName.givenName }`); @@ -100,9 +100,9 @@ test('Editing the details of an OpenMRS patient with a synced drug order edits t test('Revising a synced OpenMRS drug order edits the corresponding Odoo quotation line.', async ({ page }) => { // replay await openmrs.makeDrugOrder(); - await odoo.goToOdoo(); + await odoo.open(); await expect(page).toHaveURL(/.*web/); - await odoo.searchCustomerInOdoo(); + 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(); await page.getByRole('cell', { name: `${patientName.firstName + ' ' + patientName.givenName}` }).click(); @@ -115,7 +115,7 @@ test('Revising a synced OpenMRS drug order edits the corresponding Odoo quotatio // verify await page.goto(`${ODOO_URL}`); - await odoo.searchCustomerInOdoo(); + await odoo.searchCustomer(); await page.getByRole('cell', { name: `${patientName.firstName + ' ' + patientName.givenName}` }).click(); await expect(drugOrderItem).toContainText('8.0 Tablet'); await expect(drugOrderItem).toContainText('Thrice daily - 6 Days'); @@ -124,9 +124,9 @@ test('Revising a synced OpenMRS drug order edits the corresponding Odoo quotatio test('Discontinuing a synced OpenMRS drug order removes the corresponding Odoo quotation line.', async ({ page }) => { // replay await openmrs.makeDrugOrder(); - await odoo.goToOdoo(); + await odoo.open(); await expect(page).toHaveURL(/.*web/); - await odoo.searchCustomerInOdoo(); + 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)"); @@ -140,7 +140,7 @@ test('Discontinuing a synced OpenMRS drug order removes the corresponding Odoo q // verify await page.goto(`${ODOO_URL}`); - await odoo.searchCustomerInOdoo(); + await odoo.searchCustomer(); await expect(customer?.includes(`${patientName.firstName + ' ' + patientName.givenName}`)).toBeTruthy(); await expect(quotation).toHaveText('Cancelled'); await page.getByRole('cell', { name: `${patientName.firstName + ' ' + patientName.givenName}` }).click(); @@ -153,9 +153,9 @@ test('Ordering a drug with a free text medication dosage for an OpenMRS patient await openmrs.prescribeFreeTextMedicationDosage(); // verify - await odoo.goToOdoo(); + await odoo.open(); await expect(page).toHaveURL(/.*web/); - await odoo.searchCustomerInOdoo(); + 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(); diff --git a/e2e/tests/openmrs-senaite-flows.spec.ts b/e2e/tests/openmrs-senaite-flows.spec.ts index 66f3590f..4d072348 100644 --- a/e2e/tests/openmrs-senaite-flows.spec.ts +++ b/e2e/tests/openmrs-senaite-flows.spec.ts @@ -24,9 +24,9 @@ test('Ordering a lab test for an OpenMRS patient creates the corresponding SENAI await openmrs.saveLabOrder(); // verify - await senaite.goToSENAITE(); + await senaite.open(); await expect(page).toHaveURL(/.*senaite/); - await senaite.searchClientInSENAITE(); + await senaite.searchClient(); const client = await page.locator('table tbody tr:nth-child(1) td.contentcell.title div span a'); await expect(client).toContainText(`${patientName.firstName + ' ' + patientName.givenName}`); }); @@ -37,9 +37,9 @@ test('Editing the details of an OpenMRS patient with a synced lab order edits th await page.getByRole('button', { name: 'Add', exact: true }).click(); await page.locator('#tab select').selectOption('857AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); await openmrs.saveLabOrder(); - await senaite.goToSENAITE(); + await senaite.open(); await expect(page).toHaveURL(/.*senaite/); - await senaite.searchClientInSENAITE(); + await senaite.searchClient(); const client = await page.locator('table tbody tr:nth-child(1) td.contentcell.title div span a'); await expect(client).toContainText(`${patientName.firstName + ' ' + patientName.givenName}`); await page.goto(`${O3_URL}`); @@ -47,8 +47,8 @@ test('Editing the details of an OpenMRS patient with a synced lab order edits th await openmrs.updatePatientDetails(); // verify - await senaite.goToSENAITE(); - await senaite.searchClientInSENAITE(); + await senaite.open(); + await senaite.searchClient(); await expect(client).toContainText(`${patientName.updatedFirstName}` + ' ' + `${patientName.givenName }`); }); @@ -59,9 +59,9 @@ test('Editing a synced OpenMRS lab order edits the corresponding SENAITE analysi await page.getByRole('button', { name: 'Add', exact: true }).click(); await page.locator('#tab select').selectOption('857AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); await openmrs.saveLabOrder(); - await senaite.goToSENAITE(); + await senaite.open(); await expect(page).toHaveURL(/.*senaite/); - await senaite.searchClientInSENAITE(); + await senaite.searchClient(); const client = await page.locator('table tbody tr:nth-child(1) td.contentcell.title div'); await expect(client).toContainText(`${patientName.firstName + ' ' + patientName.givenName}`); await page.locator('table tbody tr:nth-child(1) td.contentcell.title div').click(); @@ -73,8 +73,8 @@ test('Editing a synced OpenMRS lab order edits the corresponding SENAITE analysi await openmrs.updateLabOrder(); // verify - await senaite.goToSENAITE(); - await senaite.searchClientInSENAITE(); + await senaite.open(); + await senaite.searchClient(); await expect(client).toContainText(`${patientName.firstName + ' ' + patientName.givenName}`); await page.locator('table tbody tr:nth-child(1) td.contentcell.title div').click(); @@ -88,9 +88,9 @@ test('Voiding a synced OpenMRS lab order cancels the corresponding SENAITE analy await page.getByRole('button', { name: 'Add', exact: true }).click(); await page.locator('#tab select').selectOption('857AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); await openmrs.saveLabOrder(); - await senaite.goToSENAITE(); + await senaite.open(); await expect(page).toHaveURL(/.*senaite/); - await senaite.searchClientInSENAITE(); + await senaite.searchClient(); const client = await page.locator('table tbody tr:nth-child(1) td.contentcell.title div'); await expect(client).toContainText(`${patientName.firstName + ' ' + patientName.givenName}`); await page.locator('table tbody tr:nth-child(1) td.contentcell.title div').click(); @@ -102,8 +102,8 @@ test('Voiding a synced OpenMRS lab order cancels the corresponding SENAITE analy await openmrs.voidEncounter(); // verify - await senaite.goToSENAITE(); - await senaite.searchClientInSENAITE(); + await senaite.open(); + await senaite.searchClient(); await expect(client).not.toHaveText(`${patientName.firstName + ' ' + patientName.givenName}`); }); @@ -113,9 +113,9 @@ test('Published coded lab results from SENAITE are viewable in the OpenMRS lab r await page.getByRole('button', { name: 'Add', exact: true }).click(); await page.locator('#tab select').selectOption('1325AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); await openmrs.saveLabOrder(); - await senaite.goToSENAITE(); + await senaite.open(); await expect(page).toHaveURL(/.*senaite/); - await senaite.searchClientInSENAITE(); + await senaite.searchClient(); await senaite.createPartition(); await page.getByRole('combobox', { name: 'Result' }).selectOption('664AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); await senaite.publishLabResults(); @@ -138,9 +138,9 @@ test('Published numeric lab results from SENAITE are viewable in the OpenMRS lab await page.getByRole('button', { name: 'Add', exact: true }).click(); await page.locator('#tab select').selectOption('655AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); await openmrs.saveLabOrder(); - await senaite.goToSENAITE(); + await senaite.open(); await expect(page).toHaveURL(/.*senaite/); - await senaite.searchClientInSENAITE(); + await senaite.searchClient(); await senaite.createPartition(); await page.locator('tr:nth-child(1) td.contentcell.Result div span input').fill('64'); await senaite.publishLabResults(); @@ -163,9 +163,9 @@ test('Published free text lab results from SENAITE are viewable in the OpenMRS l await page.getByRole('button', { name: 'Add', exact: true }).click(); await page.locator('#tab select').selectOption('161447AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); await openmrs.saveLabOrder(); - await senaite.goToSENAITE(); + await senaite.open(); await expect(page).toHaveURL(/.*senaite/); - await senaite.searchClientInSENAITE(); + await senaite.searchClient(); await senaite.createPartition(); await page.locator('div:nth-child(4) div table tbody tr td.contentcell.Result div span input').fill('Test result: Normal'); await senaite.publishLabResults(); diff --git a/e2e/tests/openmrs-superset-flows.spec.ts b/e2e/tests/openmrs-superset-flows.spec.ts index d4a7ddd2..db037cd3 100644 --- a/e2e/tests/openmrs-superset-flows.spec.ts +++ b/e2e/tests/openmrs-superset-flows.spec.ts @@ -16,7 +16,7 @@ test.beforeEach(async ({ page }) => { test('Creating an OpenMRS patient creates the patient in Superset patients table.', async ({ page }) => { // replay - await superset.goToSuperset(); + await superset.open(); await expect(page).toHaveURL(/.*superset/); await superset.selectDBSchema(); await superset.clearSQLEditor(); @@ -29,7 +29,7 @@ test('Creating an OpenMRS patient creates the patient in Superset patients table await superset.clearSQLEditor(); await page.goto(`${O3_URL}`); await openmrs.createPatient(); - await openmrs.searchOpenMRSPatientID(); + await openmrs.searchPatientID(); const patientIdentifier = await page.locator('#demographics section p:nth-child(2)').textContent(); // verify @@ -61,7 +61,7 @@ test('Creating an OpenMRS patient creates the patient in Superset patients table test('Creating an OpenMRS visit creates the visit in Superset visits table.', async ({ page }) => { // replay await openmrs.createPatient(); - await superset.goToSuperset(); + await superset.open(); await expect(page).toHaveURL(/.*superset/); await superset.selectDBSchema(); await superset.clearSQLEditor(); @@ -105,10 +105,10 @@ test('Creating an OpenMRS visit creates the visit in Superset visits table.', as test('Creating an OpenMRS order creates the order in Superset orders table.', async ({ page }) => { // replay await openmrs.createPatient(); - await openmrs.searchOpenMRSPatientID(); + await openmrs.searchPatientID(); const patientIdentifier = await page.locator('#demographics section p:nth-child(2)').textContent(); await openmrs.startPatientVisit(); - await superset.goToSuperset(); + await superset.open(); await expect(page).toHaveURL(/.*superset/); await superset.selectDBSchema(); await superset.clearSQLEditor(); @@ -160,10 +160,10 @@ test('Creating an OpenMRS order creates the order in Superset orders table.', as test('Creating an OpenMRS encounter creates the encounter in Superset encounters table.', async ({ page }) => { // replay await openmrs.createPatient(); - await openmrs.searchOpenMRSPatientID(); + await openmrs.searchPatientID(); const patientIdentifier = await page.locator('#demographics section p:nth-child(2)').textContent(); await openmrs.startPatientVisit(); - await superset.goToSuperset(); + await superset.open(); await expect(page).toHaveURL(/.*superset/); await superset.selectDBSchema(); await superset.clearSQLEditor(); @@ -228,10 +228,10 @@ test('Creating an OpenMRS encounter creates the encounter in Superset encounters test('Creating an OpenMRS condition creates the condition in Superset conditions table.', async ({ page }) => { // replay await openmrs.createPatient(); - await openmrs.searchOpenMRSPatientID(); + await openmrs.searchPatientID(); const patientIdentifier = await page.locator('#demographics section p:nth-child(2)').textContent(); await openmrs.startPatientVisit(); - await superset.goToSuperset(); + await superset.open(); await expect(page).toHaveURL(/.*superset/); await superset.selectDBSchema(); await superset.clearSQLEditor(); @@ -282,7 +282,7 @@ test('Creating an OpenMRS obs creates the observation in Superset observations t await openmrs.createPatient(); await openmrs.startPatientVisit(); const patient_uuid = await openmrs.getPatientUUID(); - await superset.goToSuperset(); + await superset.open(); await expect(page).toHaveURL(/.*superset/); await superset.selectDBSchema(); await superset.clearSQLEditor(); @@ -335,10 +335,10 @@ test('Creating an OpenMRS obs creates the observation in Superset observations t test('Creating an OpenMRS appointment creates the appointment in Superset appointments table.', async ({ page }) => { // replay await openmrs.createPatient(); - await openmrs.searchOpenMRSPatientID(); + await openmrs.searchPatientID(); const patientIdentifier = await page.locator('#demographics section p:nth-child(2)').textContent(); await openmrs.startPatientVisit(); - await superset.goToSuperset(); + await superset.open(); await expect(page).toHaveURL(/.*superset/); await superset.selectDBSchema(); await superset.clearSQLEditor(); @@ -388,7 +388,7 @@ test('Voiding an OpenMRS obs updates the observation in Superset observations ta await openmrs.startPatientVisit(); const patient_uuid = await openmrs.getPatientUUID(); await openmrs.addPatientBiometrics(); - await superset.goToSuperset(); + await superset.open(); await expect(page).toHaveURL(/.*superset/); await superset.selectDBSchema(); await superset.clearSQLEditor(); diff --git a/e2e/utils/functions/keycloak.ts b/e2e/utils/functions/keycloak.ts index add21c63..5b6ad926 100644 --- a/e2e/utils/functions/keycloak.ts +++ b/e2e/utils/functions/keycloak.ts @@ -1,5 +1,6 @@ import { Page, expect } from '@playwright/test'; import { randomOpenMRSRoleName } from '../functions/openmrs'; +import { randomSupersetRoleName } from '../functions/superset'; import { KEYCLOAK_URL } from '../configs/globalSetup'; import { delay } from './openmrs'; @@ -18,7 +19,7 @@ export class Keycloack { await delay(8000); } - async createRoleInKeycloak() { + async createRole() { await this.page.getByTestId('create-role').click(); await this.page.getByLabel('Role name').fill(`${randomKeycloakRoleName.roleName}`); await this.page.getByLabel('Description').fill('This is Keycloak test role'); @@ -52,4 +53,10 @@ export class Keycloack { await this.page.getByTestId('rolesTab').click(); } + async deleteSyncedRole() { + await this.page.getByRole('row', { name: `${randomSupersetRoleName.roleName}` }).getByLabel('Actions').click(); + await this.page.getByRole('menuitem', { name: 'Delete' }).click(); + await this.page.getByTestId('confirm').click(); + await expect(this.page.getByText(`The role has been deleted`)).toBeVisible(); + } } diff --git a/e2e/utils/functions/odoo.ts b/e2e/utils/functions/odoo.ts index 5f3f4ef4..27dddb2a 100644 --- a/e2e/utils/functions/odoo.ts +++ b/e2e/utils/functions/odoo.ts @@ -6,7 +6,7 @@ import { delay } from './openmrs'; export class Odoo { constructor(readonly page: Page) {} - async goToOdoo() { + async open() { await this.page.goto(`${ODOO_URL}`); if (`${process.env.TEST_PRO}` == 'true') { await this.page.getByRole('link', { name: 'Login with Single Sign-On' }).click(); @@ -20,7 +20,7 @@ export class Odoo { } } - async searchCustomerInOdoo() { + async searchCustomer() { await this.page.locator("//a[contains(@class, 'full')]").click(); await this.page.getByRole('menuitem', { name: 'Sales' }).click(); await delay(1500); @@ -28,5 +28,4 @@ export class Odoo { await this.page.getByPlaceholder('Search...').press('Enter'); await delay(2000); } - } diff --git a/e2e/utils/functions/openmrs.ts b/e2e/utils/functions/openmrs.ts index 27588a19..cace9d2d 100644 --- a/e2e/utils/functions/openmrs.ts +++ b/e2e/utils/functions/openmrs.ts @@ -93,7 +93,7 @@ export class OpenMRS { await this.page.getByRole('link', { name: `${patientFullName}` }).first().click(); } - async searchOpenMRSPatientID() { + async searchPatientID() { await this.searchPatient(`${patientName.firstName + ' ' + patientName.givenName}`); await expect(this.page.getByText('Actions', {exact: true})).toBeVisible(); await this.page.getByRole('button', { name: 'Actions', exact: true }).click(); @@ -336,7 +336,7 @@ export class OpenMRS { await delay(5000); } - async addOpenMRSRole() { + async addRole() { await this.page.getByRole('link', { name: 'Add Role' }).click(); await this.page.locator('#role').fill(`${randomOpenMRSRoleName.roleName}`); await this.page.locator('textarea[name="description"]').fill('Role for e2e test'); @@ -349,7 +349,7 @@ export class OpenMRS { await expect(this.page.getByText('Role saved')).toBeVisible(); } - async updateOpenMRSRole() { + 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'); @@ -359,7 +359,7 @@ export class OpenMRS { await expect(this.page.getByText('Role saved')).toBeVisible(); } - async unlinkInheritedOpenMRSRoles() { + async unlinkInheritedRoles() { await this.page.getByRole('link', { name: `${randomOpenMRSRoleName.roleName}` }).click(); await this.page.getByLabel('Application: Edits Existing Encounters').uncheck(); await this.page.getByLabel('Application: Enters Vitals').uncheck(); @@ -371,7 +371,7 @@ export class OpenMRS { await delay(2000); } - async unlinkUpdatedOpenMRSInheritedRoles() { + async unlinkUpdatedInheritedRoles() { await this.page.getByRole('link', { name: `${randomOpenMRSRoleName.roleName}` }).click(); await this.page.getByLabel('Application: Edits Existing Encounters').uncheck(); await this.page.getByLabel('Application: Enters Vitals').uncheck(); @@ -384,9 +384,9 @@ export class OpenMRS { await expect(this.page.getByText('Role saved')).toBeVisible(); } - async deleteOpenMRSRole() { + async deleteRole() { await this.page.goto(`${O3_URL}/openmrs/admin/users/role.list`); - await this.unlinkInheritedOpenMRSRoles(); + await this.unlinkInheritedRoles(); await this.page.getByRole('row', { name: `${randomOpenMRSRoleName.roleName}` }).getByRole('checkbox').check(); await this.page.getByRole('button', { name: 'Delete Selected Roles' }).click(); await expect(this.page.getByText(`${randomOpenMRSRoleName.roleName} deleted`)).toBeVisible(); diff --git a/e2e/utils/functions/senaite.ts b/e2e/utils/functions/senaite.ts index 8a1a9750..2d8494a2 100644 --- a/e2e/utils/functions/senaite.ts +++ b/e2e/utils/functions/senaite.ts @@ -6,7 +6,7 @@ import { delay } from './openmrs'; export class SENAITE { constructor(readonly page: Page) {} - async goToSENAITE() { + async open() { await this.page.goto(`${SENAITE_URL}`); if (!(`${process.env.TEST_PRO}` == 'true')) { await delay(3000); @@ -18,7 +18,7 @@ export class SENAITE { } } - async searchClientInSENAITE() { + async searchClient() { await this.page.getByRole('link', { name: 'Clients', exact: true }).click(); await this.page.getByRole('textbox', { name: 'Search' }).type(`${patientName.givenName}`); await this.page.locator('div.col-sm-3.text-right button:nth-child(2) i').click(); @@ -48,5 +48,4 @@ export class SENAITE { await this.page.getByRole('button', { name: 'Send' }).click(); await delay(8000); } - } diff --git a/e2e/utils/functions/superset.ts b/e2e/utils/functions/superset.ts index b65335d1..ae4c9f72 100644 --- a/e2e/utils/functions/superset.ts +++ b/e2e/utils/functions/superset.ts @@ -10,7 +10,7 @@ export var randomSupersetRoleName = { export class Superset { constructor(readonly page: Page) {} - async goToSuperset() { + async open() { await this.page.goto(`${SUPERSET_URL}`); } @@ -32,7 +32,7 @@ export class Superset { await delay(5000); } - async addSupersetRole() { + async addRole() { await this.page.getByRole('button', { name: 'triangle-down Settings' }).click(); await expect(this.page.getByText('List Roles')).toBeVisible(); await this.page.getByRole('link', { name: 'List Roles' }).click(); @@ -54,7 +54,7 @@ export class Superset { await delay(30000) } - async updateSupersetRole() { + async updateRole() { await this.page.goto(`${SUPERSET_URL}/roles/list/`); await this.page.getByRole('row', { name: `${randomSupersetRoleName.roleName}` }).getByRole('link').nth(1).click(); await delay(2000); @@ -67,7 +67,7 @@ export class Superset { await delay(30000); } - async deleteSupersetRole(){ + async deleteRole(){ await this.page.goto(`${SUPERSET_URL}/roles/list`); await this.page.getByRole('row', { name: `${randomSupersetRoleName.roleName}` }).getByRole('checkbox').check(); await this.page.getByRole('row', { name: `${randomSupersetRoleName.roleName}` }).getByRole('link').nth(2).click(); @@ -78,7 +78,7 @@ export class Superset { await expect(this.page.getByText(`${randomSupersetRoleName.roleName}`)).not.toBeVisible(); } - async deleteUpdatedSupersetRole(){ + async deleteUpdatedRole(){ await this.page.goto(`${SUPERSET_URL}/roles/list`); await this.page.getByRole('row', { name: `${randomSupersetRoleName.updatedRoleName}` }).getByRole('checkbox').check(); await this.page.getByRole('row', { name: `${randomSupersetRoleName.updatedRoleName}` }).getByRole('link').nth(2).click(); @@ -88,12 +88,4 @@ export class Superset { await expect(this.page.getByText(`Deleted Row`)).toBeVisible(); await expect(this.page.getByText(`${randomSupersetRoleName.updatedRoleName}`)).not.toBeVisible(); } - - async deleteSyncedSupersetRoleInKeycloak() { - await this.page.getByRole('row', { name: `${randomSupersetRoleName.roleName}` }).getByLabel('Actions').click(); - await this.page.getByRole('menuitem', { name: 'Delete' }).click(); - await this.page.getByTestId('confirm').click(); - await expect(this.page.getByText(`The role has been deleted`)).toBeVisible(); - } - } diff --git a/package.json b/package.json index fed2a293..cf25bf8c 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "!playwright-report/" ], "scripts": { - "e2e-tests-pro": "npx playwright test", + "e2e-tests-pro": "npx playwright test odoo-openmrs openmrs-senaite openmrs-superset", "e2e-tests-foss": "npx playwright test odoo-openmrs openmrs-senaite" }, "publishConfig": {