Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OZ-561: 'Actions in component A → effects in component B' pattern adoption. #85

Merged
merged 6 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 14 additions & 16 deletions e2e/tests/keycloak-openmrs-flows.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ test('Creating an OpenMRS role creates the corresponding Keycloak role.', async
// setup
homePage = new HomePage(page);
await page.goto(`${O3_URL}/openmrs/admin/users/role.list`);
await homePage.addOpenMRSRole();

// replay
await homePage.addOpenMRSRole();

// verify
await homePage.goToKeycloak();
await expect(page).toHaveURL(/.*console/);
await homePage.goToClients();
await homePage.goToOpenMRSClient();

// verify
await expect(page.getByText(`${randomOpenMRSRoleName.roleName}`)).toBeVisible();
await expect(page.getByText('Role for e2e test').first()).toBeVisible();
await homePage.goToOpenMRSClientAttributes();
Expand All @@ -39,9 +39,9 @@ test('Updating a synced OpenMRS role updates the corresponding Keycloak role.',
// setup
homePage = new HomePage(page);
await page.goto(`${O3_URL}/openmrs/admin/users/role.list`);
await homePage.addOpenMRSRole();

// replay
await homePage.addOpenMRSRole();
await homePage.goToKeycloak();
await expect(page).toHaveURL(/.*console/);
await homePage.goToClients();
Expand Down Expand Up @@ -74,9 +74,9 @@ test('Deleting a synced OpenMRS role deletes the corresponding Keycloak role.',
// setup
homePage = new HomePage(page);
await page.goto(`${O3_URL}/openmrs/admin/users/role.list`);
await homePage.addOpenMRSRole();

// replay
await homePage.addOpenMRSRole();
await homePage.goToKeycloak();
await expect(page).toHaveURL(/.*console/);
await homePage.goToClients();
Expand Down Expand Up @@ -104,9 +104,9 @@ test('Creating a Superset role creates the corresponding Keycloak role.', async
// setup
homePage = new HomePage(page);
await homePage.goToSuperset();
await homePage.addSupersetRole();

// replay
await homePage.addSupersetRole();
await homePage.goToKeycloak();
await homePage.goToClients();

Expand All @@ -123,15 +123,14 @@ test('Updating a synced Superset role updates the corresponding Keycloak role.',
homePage = new HomePage(page);
await homePage.goToSuperset();
await homePage.addSupersetRole();

// replay
await homePage.goToKeycloak();
await homePage.goToClients();
await homePage.goToSupersetClient();

await expect(page.getByText(`${randomSupersetRoleName.roleName}`)).toBeVisible();
await expect(page.getByText('')).toBeTruthy();

// replay
await homePage.updateSupersetRole();

// verify
Expand All @@ -150,13 +149,13 @@ test('Deleting a synced Superset role deletes the corresponding Keycloak role.',
await homePage.goToSuperset();
await homePage.addSupersetRole();

// replay
await homePage.goToKeycloak();
await homePage.goToClients();
await homePage.goToSupersetClient();

await expect(page.getByText(`${randomSupersetRoleName.roleName}`)).toBeVisible();

// replay
await homePage.deleteSupersetRole();
await delay(30000);

Expand All @@ -173,16 +172,15 @@ test('A synced role deleted from within Keycloak gets recreated in the subsequen
homePage = new HomePage(page);
await homePage.goToSuperset();
await homePage.addSupersetRole();

// replay
await homePage.goToKeycloak();
await homePage.goToClients();

// verify
// replay
await homePage.goToSupersetClient();
kdaud marked this conversation as resolved.
Show resolved Hide resolved

await expect(page.getByText(`${randomSupersetRoleName.roleName}`)).toBeVisible();
await homePage.deleteSyncedSupersetRoleInKeycloak();

// verify
await expect(page.getByText(`${randomSupersetRoleName.roleName}`)).not.toBeVisible();
await delay(30000);
await page.getByLabel('Manage').getByRole('link', { name: 'Clients' }).click();
Expand All @@ -198,15 +196,15 @@ test('A (non-synced) role created from within Keycloak gets deleted in the subse
await homePage.goToKeycloak();
await homePage.goToClients();
await homePage.goToOpenMRSClient();
await homePage.createRoleInKeycloak();

// replay
await homePage.createRoleInKeycloak();

// verify
await page.getByRole('link', { name: 'Client details' }).click();
await expect(page.getByText(`${randomKeycloakRoleName.roleName}`)).toBeVisible();
await delay(30000);
await page.getByLabel('Manage').getByRole('link', { name: 'Clients' }).click();

// verify
await homePage.goToOpenMRSClient();

await expect(page.getByText(`${randomKeycloakRoleName.roleName}`)).not.toBeVisible();
Expand Down
18 changes: 9 additions & 9 deletions e2e/tests/odoo-openmrs-flows.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ test('Ordering a lab test for an OpenMRS patient creates the corresponding Odoo
// setup
homePage = new HomePage(page);
await homePage.goToLabOrderForm();

// replay
await page.getByRole('button', { name: 'Add', exact: true }).click();
await page.locator('#tab select').selectOption('857AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA');
await homePage.saveLabOrder();

// replay
// verify
await homePage.goToOdoo();
await expect(page).toHaveURL(/.*web/);

// verify
await homePage.searchCustomerInOdoo();
const customer = await page.locator("table tbody td.o_data_cell:nth-child(4)").textContent();
await expect(customer?.includes(`${patientName.firstName + ' ' + patientName.givenName}`)).toBeTruthy();
Expand Down Expand Up @@ -66,13 +66,13 @@ test('Editing the details of an OpenMRS patient with a synced lab order edits th
test('Ordering a drug for an OpenMRS patient creates the corresponding Odoo customer with a filled quotation.', async ({ page }) => {
// setup
homePage = new HomePage(page);
await homePage.makeDrugOrder();

// replay
await homePage.goToOdoo();
await expect(page).toHaveURL(/.*web/);
await homePage.makeDrugOrder();

// verify
await homePage.goToOdoo();
await expect(page).toHaveURL(/.*web/);
await homePage.searchCustomerInOdoo();
const customer = await page.locator("table tbody td.o_data_cell:nth-child(4)").textContent();
await expect(customer?.includes(`${patientName.firstName + ' ' + patientName.givenName}`)).toBeTruthy();
Expand Down Expand Up @@ -174,14 +174,14 @@ test('Discontinuing a synced OpenMRS drug order removes the corresponding Odoo q
test('Ordering a drug with a free text medication dosage for an OpenMRS patient creates the corresponding Odoo customer with a filled quotation.', async ({ page }) => {
// setup
homePage = new HomePage(page);
await homePage.prescribeFreeTextMedicationDosage();

// replay
await homePage.prescribeFreeTextMedicationDosage();

// verify
await homePage.goToOdoo();
await expect(page).toHaveURL(/.*web/);
await homePage.searchCustomerInOdoo();

// verify
const customer = await page.locator("table tbody td.o_data_cell:nth-child(4)").textContent();
await expect(customer?.includes(`${patientName.firstName + ' ' + patientName.givenName}`)).toBeTruthy();

Expand Down
6 changes: 3 additions & 3 deletions e2e/tests/openmrs-senaite-flows.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ test('Ordering a lab test for an OpenMRS patient creates the corresponding SENAI
// setup
homePage = new HomePage(page);
await homePage.goToLabOrderForm();

// replay
await page.getByRole('button', { name: 'Add', exact: true }).click();
await page.locator('#tab select').selectOption('857AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA');
await homePage.saveLabOrder();

// replay
// verify
await homePage.goToSENAITE();
await expect(page).toHaveURL(/.*senaite/);

// verify
await homePage.searchClientInSENAITE();
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}`);
Expand Down
3 changes: 1 addition & 2 deletions e2e/tests/openmrs-superset-flows.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,6 @@ test('Voiding an OpenMRS obs updates the observation in Superset observations ta
await homePage.startPatientVisit();
const patient_uuid = await homePage.getPatientUUID();
await homePage.addPatientBiometrics();

// replay
await homePage.goToSuperset();
await expect(page).toHaveURL(/.*superset/);
await homePage.selectDBSchema();
Expand All @@ -424,6 +422,7 @@ test('Voiding an OpenMRS obs updates the observation in Superset observations ta
await expect(secondObsVoidedState).toContainText('false');
await expect(thirdObsVoidedState).toContainText('false');

// replay
await page.goto(`${O3_URL}/openmrs/spa/home`);
await homePage.searchPatient(`${patientName.firstName + ' ' + patientName.givenName}`);
await homePage.voidEncounter();
Expand Down