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

C2C-346: E2e tests for the Bahmni-OpenELIS flows . #14

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ ODOO_USERNAME=admin
ODOO_PASSWORD=admin

# OpenELIS test user credentials
OpenELIS_USERNAME=admin
OpenELIS_PASSWORD=adminADMIN!
OPENELIS_USERNAME=admin
OPENELIS_PASSWORD=adminADMIN!
39 changes: 19 additions & 20 deletions e2e/tests/bahmni-odoo-flows.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, expect } from '@playwright/test';
import { Odoo } from '../utils/functions/odoo';
import { BAHMNI_URL, ODOO_URL } from '../utils/configs/globalSetup';
import { Bahmni, patientName } from '../utils/functions/bahmni';
import { Bahmni, delay, patientName } from '../utils/functions/bahmni';

let bahmni: Bahmni;
let odoo: Odoo;
Expand All @@ -17,19 +17,18 @@ test.beforeEach(async ({ page }) => {
await expect(page.getByText(/appointment scheduling/i)).toBeVisible();
await expect(page.getByText(/patient documents/i)).toBeVisible();
await bahmni.registerPatient();
await bahmni.goToHomePage();
await bahmni.navigateToPatientDashboard();
});

test('Ordering a lab test for a Bahmni patient creates the corresponding Odoo customer with a filled quotation.', async ({ page }) => {
// setup
await bahmni.goToLabSamples();
await bahmni.navigateToLabSamples();

// replay
await bahmni.createLabOrder();

// verify
await odoo.open();
await expect(page).toHaveURL(/.*web/);
await odoo.searchCustomer();
const customerSelector = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)');
await expect(customerSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`);
Expand All @@ -45,10 +44,9 @@ test('Ordering a lab test for a Bahmni patient creates the corresponding Odoo cu

test('Editing the details of a Bahmni patient with a synced lab order edits the corresponding Odoo customer details.', async ({ page }) => {
// setup
await bahmni.goToLabSamples();
await bahmni.navigateToLabSamples();
await bahmni.createLabOrder();
await odoo.open();
await expect(page).toHaveURL(/.*web/);
await odoo.searchCustomer();
const customerSelector = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)');
await expect(customerSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`);
Expand All @@ -61,6 +59,7 @@ test('Editing the details of a Bahmni patient with a synced lab order edits the

// verify
await page.goto(`${ODOO_URL}`);
await delay(5000);
await odoo.searchCustomer();
const updatedCustomer = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)');
await expect(updatedCustomer).toHaveText(`${patientName.updatedGivenName}` + ' ' + `${patientName.familyName}`);
Expand All @@ -69,10 +68,9 @@ test('Editing the details of a Bahmni patient with a synced lab order edits the

test('Revising a synced Bahmni lab order edits the corresponding Odoo quotation line.', async ({ page }) => {
// setup
await bahmni.goToLabSamples();
await bahmni.navigateToLabSamples();
await bahmni.createLabOrder();
await odoo.open();
await expect(page).toHaveURL(/.*web/);
await odoo.searchCustomer();
const customerSelector = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)');
await expect(customerSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`);
Expand All @@ -83,12 +81,13 @@ test('Revising a synced Bahmni lab order edits the corresponding Odoo quotation
await expect(labTest).toHaveText('Malaria');

// replay
await page.goto(`${BAHMNI_URL}`);
await bahmni.goToLabSamples();
await bahmni.navigateToPatientDashboard();
await bahmni.navigateToLabSamples();
await bahmni.reviseLabOrder();

// verify
await page.goto(`${ODOO_URL}`);
await delay(5000);
await odoo.searchCustomer();
await expect(customerSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`);
await expect(statusSelector).toHaveText('Devis');
Expand All @@ -97,12 +96,11 @@ test('Revising a synced Bahmni lab order edits the corresponding Odoo quotation
await expect(labTest).toHaveText('Hematocrite');
});

test('Discontinuing a synced Bahmni lab order edits the corresponding Odoo quotation line.', async ({ page }) => {
test('Discontinuing a synced Bahmni lab order for an Odoo customer with a single quotation line removes the corresponding quotation.', async ({ page }) => {
// setup
await bahmni.goToLabSamples();
await bahmni.navigateToLabSamples();
await bahmni.createLabOrder();
await odoo.open();
await expect(page).toHaveURL(/.*web/);
await odoo.searchCustomer();
const customerSelector = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)');
await expect(customerSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`);
Expand All @@ -113,12 +111,13 @@ test('Discontinuing a synced Bahmni lab order edits the corresponding Odoo quota
await expect(labTest).toHaveText('Malaria');

// replay
await page.goto(`${BAHMNI_URL}`);
await bahmni.goToLabSamples();
await bahmni.navigateToPatientDashboard();
await bahmni.navigateToLabSamples();
await bahmni.discontinueLabOrder();

// verify
await page.goto(`${ODOO_URL}`);
await delay(5000);
await odoo.searchCustomer();
await expect(customerSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`);
await expect(statusSelector).toHaveText('Annulé');
Expand Down Expand Up @@ -152,7 +151,6 @@ test('Editing the details of a Bahmni patient with a synced drug order edits the
await bahmni.navigateToMedications();
await bahmni.createMedication();
await odoo.open();
await expect(page).toHaveURL(/.*web/);
await odoo.searchCustomer();
const customerSelector = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)');
await expect(customerSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`);
Expand All @@ -163,6 +161,7 @@ test('Editing the details of a Bahmni patient with a synced drug order edits the

// verify
await page.goto(`${ODOO_URL}`);
await delay(5000);
await odoo.searchCustomer();
const updatedCustomer = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)');
await expect(updatedCustomer).toHaveText(`${patientName.updatedGivenName}` + ' ' + `${patientName.familyName}`);
Expand All @@ -173,7 +172,6 @@ test('Revising a synced OpenMRS drug order edits the corresponding Odoo quotatio
await bahmni.navigateToMedications();
await bahmni.createMedication();
await odoo.open();
await expect(page).toHaveURL(/.*web/);
await odoo.searchCustomer();
const customerSelector = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)');
await expect(customerSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`);
Expand All @@ -184,12 +182,13 @@ test('Revising a synced OpenMRS drug order edits the corresponding Odoo quotatio
await expect(medicationDescrptionSelector).toContainText('Aspirine Co 81mg | 560.0 Ampoule(s) | 2.0 Application(s) - Q3H - 5 Semaine(s)');

// replay
await page.goto(`${BAHMNI_URL}`);
await bahmni.navigateToPatientDashboard();
await bahmni.navigateToMedications();
await bahmni.editMedicationDetails();

// verify
await page.goto(`${ODOO_URL}`);
await delay(5000);
await odoo.searchCustomer();
await page.getByRole('cell', { name: `${patientName.givenName + ' ' + patientName.familyName }` }).click();
await expect(drugNameSelector).toContainText('Aspirine Co 81mg');
Expand All @@ -201,7 +200,6 @@ test('Discontinuing a synced Bahmni drug order for an Odoo customer with a singl
await bahmni.navigateToMedications();
await bahmni.createMedication();
await odoo.open();
await expect(page).toHaveURL(/.*web/);
await odoo.searchCustomer();
const customerSelector = await page.locator('tr.o_data_row:nth-child(1) td:nth-child(4)');
await expect(customerSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`);
Expand All @@ -214,12 +212,13 @@ test('Discontinuing a synced Bahmni drug order for an Odoo customer with a singl
await expect(medicationDescrptionSelector).toContainText('Aspirine Co 81mg | 560.0 Ampoule(s) | 2.0 Application(s) - Q3H - 5 Semaine(s)');

// replay
await page.goto(`${BAHMNI_URL}`);
await bahmni.navigateToPatientDashboard();
await bahmni.navigateToMedications();
await bahmni.discontinueMedication();

// verify
await page.goto(`${ODOO_URL}`);
await delay(5000);
await odoo.searchCustomer();
await expect(customerSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`);
await expect(statusSelector).toHaveText('Annulé');
Expand Down
209 changes: 209 additions & 0 deletions e2e/tests/bahmni-openelis-flows.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
import { test, expect } from '@playwright/test';
import { Bahmni, patientName } from '../utils/functions/bahmni';
import { OpenELIS } from '../utils/functions/openelis';
import { BAHMNI_URL, OPENELIS_URL } from '../utils/configs/globalSetup';

let bahmni: Bahmni;
let openelis: OpenELIS;

test.beforeEach(async ({ page }) => {
bahmni = new Bahmni(page);
openelis = new OpenELIS(page);

await bahmni.login();
await expect(page.getByText(/registration/i)).toBeVisible();
await expect(page.getByText(/linical/i)).toBeVisible();
await expect(page.getByText(/admin/i)).toBeVisible();
await expect(page.getByText(/appointment scheduling/i)).toBeVisible();
await expect(page.getByText(/patient documents/i)).toBeVisible();
await bahmni.registerPatient();
await bahmni.navigateToPatientDashboard();
});

test('Ordering a lab test for a Bahmni patient creates the corresponding OpenElis client with an analysis request.', async ({ page }) => {
// setup
await bahmni.navigateToLabSamples();

// replay
await bahmni.createLabOrder();

// verify
await openelis.open();
await expect(page).toHaveURL(/.*openelis/);
await openelis.searchClient();

const clientSelector = await page.locator("#todaySamplesToCollectListContainer-slick-grid div.slick-cell.l1.r1");
await expect(clientSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`);

await page.locator('#todaySamplesToCollectListContainer-slick-grid div.slick-viewport div.slick-cell.l6.r6.cell-title a').click();
await expect(page.locator('#tests_1')).toHaveValue('Malaria')
});


test('Editing the details of a Bahmni patient with a synced lab order edits the corresponding OpenELIS client details.', async ({ page }) => {
// setup
await bahmni.navigateToLabSamples();
await bahmni.createLabOrder();
await openelis.open();
await expect(page).toHaveURL(/.*openelis/);
await openelis.searchClient();
const clientSelector = await page.locator("#todaySamplesToCollectListContainer-slick-grid div.slick-cell.l1.r1");
await expect(clientSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`);

// replay
await page.goto(`${BAHMNI_URL}`);
await bahmni.updatePatientDetails();

// verify
await openelis.open();
await openelis.searchClient();
await expect(clientSelector).toHaveText(`${patientName.updatedGivenName}` + ' ' + `${patientName.familyName}`);
});

test('Revising a synced Bahmni lab order edits the corresponding OpenELIS client analysis request.', async ({ page }) => {
// setup
await bahmni.navigateToLabSamples();
await bahmni.createLabOrder();
await openelis.open();
await expect(page).toHaveURL(/.*openelis/);
await openelis.searchClient();
const clientSelector = await page.locator("#todaySamplesToCollectListContainer-slick-grid div.slick-cell.l1.r1");
await expect(clientSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`);
await page.locator('#todaySamplesToCollectListContainer-slick-grid div.slick-viewport div.slick-cell.l6.r6.cell-title a').click();
await expect(page.locator('#tests_1')).toHaveValue('Malaria')

// replay
await bahmni.navigateToPatientDashboard();
await bahmni.navigateToLabSamples();
await bahmni.reviseLabOrder();

// verify
await openelis.open();
await openelis.searchClient();
await expect(clientSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`);

await page.locator('#todaySamplesToCollectListContainer-slick-grid div.slick-viewport div.slick-cell.l6.r6.cell-title a').click();
await expect(page.locator('#tests_1')).toHaveValue('Hematocrite');
});

test('Voiding a synced OpenMRS lab order cancels the corresponding OpenElis analysis request.', async ({ page }) => {
// setup
await bahmni.navigateToLabSamples();
await bahmni.createLabOrder();
await openelis.open();
await expect(page).toHaveURL(/.*openelis/);
await openelis.searchClient();
const clientSelector = await page.locator("#todaySamplesToCollectListContainer-slick-grid div.slick-cell.l1.r1");
await expect(clientSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`);
await page.locator('#todaySamplesToCollectListContainer-slick-grid div.slick-viewport div.slick-cell.l6.r6.cell-title a').click();
await expect(page.locator('#tests_1')).toHaveValue('Malaria')

// replay
await bahmni.navigateToPatientDashboard();
await bahmni.navigateToLabSamples();
await bahmni.discontinueLabOrder();

// verify
await openelis.open();
await openelis.searchClient();
await expect(page.getByText(`${patientName.givenName + ' ' + patientName.familyName}`)).not.toBeVisible();
});

test('Published coded lab results from OpenELIS are viewable in the Bahmni lab results viewer.', async ({ page }) => {
// setup
await bahmni.navigateToLabSamples();
await bahmni.createLabOrder();

// replay
await openelis.open();
await expect(page).toHaveURL(/.*openelis/);
await openelis.searchClient();

const clientSelector = await page.locator("#todaySamplesToCollectListContainer-slick-grid div.slick-cell.l1.r1");
await expect(clientSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`);
await openelis.collectSample();
await page.locator('a#todaySamplesCollectedListContainerId').click();
await page.locator('#todaySamplesCollectedListContainer-slick-grid div.ui-state-default.slick-headerrow-column.l2.r2 input[type=text]').type(`${patientName.familyName}`);

await openelis.enterLabResults();
await page.locator('a#todaySamplesCollectedListContainerId').click();
await page.locator('#todaySamplesCollectedListContainer-slick-grid div.ui-state-default.slick-headerrow-column.l2.r2 input[type=text]').type(`${patientName.familyName}`);
await openelis.validateLabResults();
await page.locator('#todaySamplesCollectedListContainer-slick-grid div.ui-state-default.slick-headerrow-column.l2.r2 input[type=text]').type(`${patientName.familyName}`);
const status = await page.locator('#todaySamplesCollectedListContainer-slick-grid div.slick-viewport div div:nth-child(1) div.slick-cell.l8.r8.cell-title');
await expect(status).toHaveText('Yes');

// verify
await bahmni.navigateToPatientDashboard();
await expect(page.locator('#Lab-Results').getByText('Malaria')).toBeVisible();
await expect(page.locator('#Lab-Results span.value')).toHaveText('Negatif');
});

test('Published numerical lab results from OpenELIS are viewable in the Bahmni lab results viewer.', async ({ page }) => {
// setup
await bahmni.navigateToLabSamples();
await page.getByText('Blood', { exact: true }).click();
await page.getByText('Lymphocites').click();
await bahmni.saveOrder();

// replay
await openelis.open();
await expect(page).toHaveURL(/.*openelis/);
await openelis.searchClient();

const clientSelector = await page.locator("#todaySamplesToCollectListContainer-slick-grid div.slick-cell.l1.r1");
await expect(clientSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`);
await openelis.collectSample();
await page.locator('a#todaySamplesCollectedListContainerId').click();
await page.locator('#todaySamplesCollectedListContainer-slick-grid div.ui-state-default.slick-headerrow-column.l2.r2 input[type=text]').type(`${patientName.familyName}`);

await openelis.enterNumericalResults();
await page.locator('a#todaySamplesCollectedListContainerId').click();
await page.locator('#todaySamplesCollectedListContainer-slick-grid div.ui-state-default.slick-headerrow-column.l2.r2 input[type=text]').type(`${patientName.familyName}`);
await openelis.validateLabResults();
await page.locator('#todaySamplesCollectedListContainer-slick-grid div.ui-state-default.slick-headerrow-column.l2.r2 input[type=text]').type(`${patientName.familyName}`);
const status = await page.locator('#todaySamplesCollectedListContainer-slick-grid div.slick-viewport div div:nth-child(1) div.slick-cell.l8.r8.cell-title');
await expect(status).toHaveText('Yes');

// verify
await bahmni.navigateToPatientDashboard();
await expect(page.locator('#Lab-Results').getByText('Lymphocytes')).toBeVisible();
await expect(page.locator('#Lab-Results span.value')).toHaveText('13.7');
});

test('Published free text lab results from OpenELIS are viewable in the Bahmni lab results viewer.', async ({ page }) => {
// setup
await bahmni.navigateToLabSamples();
await page.getByText('Urine', { exact: true }).click();
await page.getByText('Urobilinogen').click();
await bahmni.saveOrder();

// replay
await openelis.open();
await expect(page).toHaveURL(/.*openelis/);
await openelis.searchClient();

const clientSelector = await page.locator("#todaySamplesToCollectListContainer-slick-grid div.slick-cell.l1.r1");
await expect(clientSelector).toHaveText(`${patientName.givenName + ' ' + patientName.familyName}`);
await openelis.collectSample();
await page.locator('a#todaySamplesCollectedListContainerId').click();
await page.locator('#todaySamplesCollectedListContainer-slick-grid div.ui-state-default.slick-headerrow-column.l2.r2 input[type=text]').type(`${patientName.familyName}`);

await openelis.enterFreeTextResults();
await page.locator('a#todaySamplesCollectedListContainerId').click();
await page.locator('#todaySamplesCollectedListContainer-slick-grid div.ui-state-default.slick-headerrow-column.l2.r2 input[type=text]').type(`${patientName.familyName}`);
await openelis.validateLabResults();
await page.locator('#todaySamplesCollectedListContainer-slick-grid div.ui-state-default.slick-headerrow-column.l2.r2 input[type=text]').type(`${patientName.familyName}`);
const status = await page.locator('#todaySamplesCollectedListContainer-slick-grid div.slick-viewport div div:nth-child(1) div.slick-cell.l8.r8.cell-title');
await expect(status).toHaveText('Yes');

// verify
await bahmni.navigateToPatientDashboard();
await expect(page.locator('#Lab-Results').getByText('Urobilinogen')).toBeVisible();
await expect(page.locator('#Lab-Results span.value')).toHaveText('Abnormal level');
});

test.afterEach(async ({ page }) => {
await bahmni.voidPatient();
await page.close();
});
1 change: 1 addition & 0 deletions e2e/tests/diagnosis.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ test('Create and revise a diagnosis.', async ({ page }) => {
await bahmni.registerPatient();

// replay
await bahmni.navigateToPatientDashboard();
await bahmni.navigateToDiagnosis();
await page.locator('#name-0').fill('Candidiasis (B37.9)');
await page.getByText('Candidiasis (B37.9)').click();
Expand Down
Loading
Loading