Skip to content

Commit

Permalink
OZ-365: Corrected drug order form link + Added formatting changes. (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdaud authored Oct 5, 2023
1 parent a5303d0 commit 670cd0f
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 97 deletions.
20 changes: 10 additions & 10 deletions e2e/tests/testAnalyticsIntegration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { patientName } from '../utils/functions/testBase';

let homePage: HomePage;

test.beforeEach(async ({ page }) => {
const homePage = new HomePage(page);
await homePage.initiateLogin();
test.beforeEach(async ({ page }) => {
const homePage = new HomePage(page);
await homePage.initiateLogin();

await expect(page).toHaveURL(/.*home/);
await expect(page).toHaveURL(/.*home/);

await homePage.createPatient();
await homePage.createPatient();
});

test('Starting an OpenMRS visit increases visits count in Superset', async ({ page }) => {
Expand Down Expand Up @@ -199,8 +199,8 @@ test('Adding an OpenMRS patient appointment increases appointments count in Supe
await expect(updatedCount).toBeGreaterThan(initialCount);
});

test.afterEach(async ({ page }) => {
const homePage = new HomePage(page);
await homePage.deletePatient();
await page.close();
});
test.afterEach(async ({ page }) => {
const homePage = new HomePage(page);
await homePage.deletePatient();
await page.close();
});
168 changes: 84 additions & 84 deletions e2e/tests/testKeycloakIntegration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,105 +4,105 @@ import { randomRoleName } from '../utils/functions/testBase';

let homePage: HomePage;

test.beforeEach(async ({ page }) => {
const homePage = new HomePage(page);
await homePage.initiateLogin();
test.beforeEach(async ({ page }) => {
const homePage = new HomePage(page);
await homePage.initiateLogin();

await expect(page).toHaveURL(/.*home/);
await expect(page).toHaveURL(/.*home/);
});

test('Creating an OpenMRS role syncs the role into Keycloak', async ({ page }) => {
// setup
await page.goto(`${process.env.E2E_BASE_URL}/openmrs/admin/users/role.list`);
const homePage = new HomePage(page);
await homePage.addRole();
// setup
await page.goto(`${process.env.E2E_BASE_URL}/openmrs/admin/users/role.list`);
const homePage = new HomePage(page);
await homePage.addRole();

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

// verify
await expect(page.getByText(`${randomRoleName.roleName}`)).toBeVisible();
await expect(page.getByText('Role for e2e test').first()).toBeVisible();
await page.getByRole('link', { name: `${randomRoleName.roleName}` }).click();
await page.getByTestId('attributesTab').click();
await expect(page.getByText('Organizational: Registration Clerk')).toBeTruthy();
await expect(page.getByText('Application: Edits Existing Encounters')).toBeTruthy();
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 page.goto(`${process.env.E2E_BASE_URL}/openmrs/admin/users/role.list`);
await homePage.unlinkInheritedRoles();
});
// verify
await expect(page.getByText(`${randomRoleName.roleName}`)).toBeVisible();
await expect(page.getByText('Role for e2e test').first()).toBeVisible();
await page.getByRole('link', { name: `${randomRoleName.roleName}` }).click();
await page.getByTestId('attributesTab').click();
await expect(page.getByText('Organizational: Registration Clerk')).toBeTruthy();
await expect(page.getByText('Application: Edits Existing Encounters')).toBeTruthy();
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 page.goto(`${process.env.E2E_BASE_URL}/openmrs/admin/users/role.list`);
await homePage.unlinkInheritedRoles();
});

test('Updating a synced OpenMRS role updates the corresponding role in Keycloak', async ({ page }) => {
// setup
await page.goto(`${process.env.E2E_BASE_URL}/openmrs/admin/users/role.list`);
const homePage = new HomePage(page);
await homePage.addRole();
test('Updating a synced OpenMRS role updates the corresponding role in Keycloak', async ({ page }) => {
// setup
await page.goto(`${process.env.E2E_BASE_URL}/openmrs/admin/users/role.list`);
const homePage = new HomePage(page);
await homePage.addRole();

// reply
await homePage.goToKeycloak();
await homePage.goToRoles();
await expect(page.getByText(`${randomRoleName.roleName}`)).toBeVisible();
await expect(page.getByText('Role for e2e test').first()).toBeVisible();
await page.getByRole('link', { name: `${randomRoleName.roleName}` }).click();
await page.getByTestId('attributesTab').click();
await expect(page.getByText('Application: Enters Vitals')).toBeTruthy();
await expect(page.getByText('Application: Edits Existing Encounters')).toBeTruthy();
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 page.goto(`${process.env.E2E_BASE_URL}/openmrs/admin/users/role.list`);
await homePage.updateRole();
// reply
await homePage.goToKeycloak();
await homePage.goToRoles();
await expect(page.getByText(`${randomRoleName.roleName}`)).toBeVisible();
await expect(page.getByText('Role for e2e test').first()).toBeVisible();
await page.getByRole('link', { name: `${randomRoleName.roleName}` }).click();
await page.getByTestId('attributesTab').click();
await expect(page.getByText('Application: Enters Vitals')).toBeTruthy();
await expect(page.getByText('Application: Edits Existing Encounters')).toBeTruthy();
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 page.goto(`${process.env.E2E_BASE_URL}/openmrs/admin/users/role.list`);
await homePage.updateRole();

// verify
await page.goto(`${process.env.E2E_KEYCLOAK_URL}/admin/master/console/`);
await homePage.goToRoles();
await page.getByRole('link', { name: `${randomRoleName.roleName}` }).click();
await page.getByTestId('attributesTab').click();
await expect(page.getByText('Updated role description')).toBeTruthy();
await page.getByTestId('attributesTab').click();
await expect(page.getByText('Application: Registers Patients')).toBeTruthy();
await expect(page.getByText('Application: Writes Clinical Notes')).toBeTruthy();
await page.goto(`${process.env.E2E_BASE_URL}/openmrs/admin/users/role.list`);
await homePage.unlinkUpdatedInheritedRoles();
});
// verify
await page.goto(`${process.env.E2E_KEYCLOAK_URL}/admin/master/console/`);
await homePage.goToRoles();
await page.getByRole('link', { name: `${randomRoleName.roleName}` }).click();
await page.getByTestId('attributesTab').click();
await expect(page.getByText('Updated role description')).toBeTruthy();
await page.getByTestId('attributesTab').click();
await expect(page.getByText('Application: Registers Patients')).toBeTruthy();
await expect(page.getByText('Application: Writes Clinical Notes')).toBeTruthy();
await page.goto(`${process.env.E2E_BASE_URL}/openmrs/admin/users/role.list`);
await homePage.unlinkUpdatedInheritedRoles();
});

test('Deleting a synced OpenMRS role deletes the corresponding role in Keycloak', async ({ page }) => {
// setup
await page.goto(`${process.env.E2E_BASE_URL}/openmrs/admin/users/role.list`);
const homePage = new HomePage(page);
await homePage.addRole();
test('Deleting a synced OpenMRS role deletes the corresponding role in Keycloak', async ({ page }) => {
// setup
await page.goto(`${process.env.E2E_BASE_URL}/openmrs/admin/users/role.list`);
const homePage = new HomePage(page);
await homePage.addRole();

// reply
await homePage.goToKeycloak();
await homePage.goToRoles();
await expect(page.getByText(`${randomRoleName.roleName}`)).toBeVisible();
await expect(page.getByText('Role for e2e test').first()).toBeVisible();
await page.getByRole('link', { name: `${randomRoleName.roleName}` }).click();
await page.getByTestId('attributesTab').click();
await expect(page.getByText('Application: Enters Vitals')).toBeTruthy();
await expect(page.getByText('Application: Edits Existing Encounters')).toBeTruthy();
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 page.goto(`${process.env.E2E_BASE_URL}/openmrs/admin/users/role.list`);
await homePage.unlinkInheritedRoles();
await homePage.deleteRole();
// reply
await homePage.goToKeycloak();
await homePage.goToRoles();
await expect(page.getByText(`${randomRoleName.roleName}`)).toBeVisible();
await expect(page.getByText('Role for e2e test').first()).toBeVisible();
await page.getByRole('link', { name: `${randomRoleName.roleName}` }).click();
await page.getByTestId('attributesTab').click();
await expect(page.getByText('Application: Enters Vitals')).toBeTruthy();
await expect(page.getByText('Application: Edits Existing Encounters')).toBeTruthy();
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 page.goto(`${process.env.E2E_BASE_URL}/openmrs/admin/users/role.list`);
await homePage.unlinkInheritedRoles();
await homePage.deleteRole();

// verify
await page.goto(`${process.env.E2E_KEYCLOAK_URL}/admin/master/console/`);
await homePage.goToRoles();
const roleName = await page.locator('table tbody tr:nth-child(1) td:nth-child(1) a');
await expect(roleName).not.toHaveText(`${randomRoleName.roleName}`);
await page.goto(`${process.env.E2E_BASE_URL}/openmrs/admin/users/role.list`);
await homePage.addRole();
});
// verify
await page.goto(`${process.env.E2E_KEYCLOAK_URL}/admin/master/console/`);
await homePage.goToRoles();
const roleName = await page.locator('table tbody tr:nth-child(1) td:nth-child(1) a');
await expect(roleName).not.toHaveText(`${randomRoleName.roleName}`);
await page.goto(`${process.env.E2E_BASE_URL}/openmrs/admin/users/role.list`);
await homePage.addRole();
});

test.afterEach(async ({ page }) => {
const homePage = new HomePage(page);
await homePage.deleteRole();
await page.getByRole('link', { name: 'Log out' }).click();
await page.close();
});
});
4 changes: 2 additions & 2 deletions e2e/tests/testOdooIntegration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ test('Revising a synced drug order edits corresponding quotation line in Odoo',
await page.locator("table tbody tr:nth-child(1) td.o_data_cell.o_field_cell.o_list_many2one.o_readonly_modifier.o_required_modifier").textContent();
await expect(customer?.includes(`${patientName.firstName + ' ' + patientName.givenName}`)).toBeTruthy();
await page.getByRole('cell', { name: `${patientName.firstName + ' ' + patientName.givenName}` }).click();
const drugOrderItem = await page.locator("table tbody tr:nth-child(1) td.o_data_cell.o_field_cell.o_list_text.o_section_and_note_text_cell.o_required_modifier span");
const drugOrderItem = await page.locator("table tbody tr:nth-child(1) td.o_data_cell.o_field_cell.o_list_text.o_section_and_note_text_cell.o_required_modifier span");

await expect(drugOrderItem).toContainText('4.0 Tablet');
await expect(drugOrderItem).toContainText('Twice daily - 5 Days');
Expand Down Expand Up @@ -162,7 +162,7 @@ test('Discontinuing a synced drug order cancels corresponding quotation line in
await page.locator("table tbody tr:nth-child(1) td.o_data_cell.o_field_cell.o_badge_cell.o_readonly_modifier span");
await expect(quotation).toHaveText('Quotation');
await page.getByRole('cell', { name: `${patientName.firstName + ' ' + patientName.givenName}` }).click();
const drugOrderItem = await page.locator("table tbody tr:nth-child(1) td.o_data_cell.o_field_cell.o_list_many2one.o_product_configurator_cell.o_required_modifier span span");
const drugOrderItem = await page.locator("table tbody tr:nth-child(1) td.o_data_cell.o_field_cell.o_list_many2one.o_product_configurator_cell.o_required_modifier span span");
await expect(drugOrderItem).toHaveText('Aspirin 325mg');

// replay
Expand Down
2 changes: 1 addition & 1 deletion e2e/utils/functions/testBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ export class HomePage {
await this.page.getByRole('button', { name: 'Add', exact: true }).nth(0).click();
await delay(2000);
await this.page.getByPlaceholder('Search for a drug or orderset (e.g. "Aspirin")').fill('Aspirin 325mg');
await this.page.getByRole('listitem').filter({ hasText: 'Aspirin 325mg — 325mg — tabletImmediately add to basket' }).click();
await this.page.getByRole('button', { name: 'Order form' }).click();
await delay(4000);
await this.page.getByPlaceholder('Dose').fill('4');
await this.page.getByRole('button', { name: 'Open', exact: true }).nth(1).click();
Expand Down

0 comments on commit 670cd0f

Please sign in to comment.