Skip to content

Commit

Permalink
Refined method names
Browse files Browse the repository at this point in the history
  • Loading branch information
kdaud committed May 8, 2024
1 parent 077e9df commit f7626a4
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 111 deletions.
64 changes: 32 additions & 32 deletions e2e/tests/keycloak-openmrs-flows.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ test.beforeEach(async ({ page }) => {
await openmrs.initiateLogin();
await expect(page).toHaveURL(/.*home/);
});

/*
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()
Expand All @@ -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();
Expand All @@ -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`);
Expand All @@ -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();
Expand All @@ -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`);
Expand All @@ -94,49 +94,49 @@ test('Deleting a synced OpenMRS role deletes the corresponding Keycloak role.',
const roleName = await page.locator('table tbody tr:nth-child(1) td:nth-child(1) a');
await expect(roleName).not.toHaveText(`${randomOpenMRSRoleName.roleName}`);
});

*/
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`);
await keycloack.goToClients();
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
Expand All @@ -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();
Expand Down
36 changes: 18 additions & 18 deletions e2e/tests/odoo-openmrs-flows.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();

Expand All @@ -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();
Expand All @@ -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 }`);
Expand All @@ -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();
Expand All @@ -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');
Expand All @@ -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)");
Expand All @@ -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();
Expand All @@ -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();

Expand Down
Loading

0 comments on commit f7626a4

Please sign in to comment.