-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
C2C-346: E2e tests for the flows Bahmni and OpenElis
- Loading branch information
Showing
10 changed files
with
307 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,231 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { Bahmni, patientName } from '../utils/functions/bahmni'; | ||
import { OpenELIS } from '../utils/functions/openelis'; | ||
import { BAHMNI_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.goToPatientDashboard(); | ||
}); | ||
|
||
test('Ordering a lab test for a Bahmni patient creates the corresponding OpenElis client with an analysis request.', async ({ page }) => { | ||
// setup | ||
await bahmni.goToLabSamples(); | ||
|
||
// replay | ||
await bahmni.createLabOrder(); | ||
await page.locator('#dashboard-link span.patient-name').click(); | ||
await expect(page.locator('#Lab-Orders').getByText('Malaria')) .toBeVisible(); | ||
|
||
// 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.goToLabSamples(); | ||
await bahmni.createLabOrder(); | ||
await page.locator('#dashboard-link span.patient-name').click(); | ||
await expect(page.locator('#Lab-Orders').getByText('Malaria')) .toBeVisible(); | ||
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.goToLabSamples(); | ||
await bahmni.createLabOrder(); | ||
await page.locator('#dashboard-link span.patient-name').click(); | ||
await expect(page.locator('#Lab-Orders').getByText('Malaria')) .toBeVisible(); | ||
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 page.goto(`${BAHMNI_URL}`); | ||
await bahmni.goToLabSamples(); | ||
await bahmni.reviseLabOrder(); | ||
await page.locator('#dashboard-link span.patient-name').click(); | ||
await expect(page.locator('#Lab-Orders').getByText('Hematocrit')).toBeVisible(); | ||
|
||
// 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.goToLabSamples(); | ||
await bahmni.createLabOrder(); | ||
await page.locator('#dashboard-link span.patient-name').click(); | ||
await expect(page.locator('#Lab-Orders').getByText('Malaria')) .toBeVisible(); | ||
await openelis.open(); | ||
await expect(page).toHaveURL(/.*openelis/); | ||
await page.locator('#menu_labDashboard').click(); | ||
await page.locator('input[type=text]').nth(1).type(`${patientName.familyName}`); | ||
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 page.goto(`${BAHMNI_URL}`); | ||
await bahmni.goToLabSamples(); | ||
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.goToLabSamples(); | ||
await bahmni.createLabOrder(); | ||
await page.locator('#dashboard-link span.patient-name').click(); | ||
await expect(page.locator('#Lab-Orders').getByText('Malaria')) .toBeVisible(); | ||
|
||
// 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 page.goto(`${BAHMNI_URL}`); | ||
await bahmni.goToPatientDashboard(); | ||
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.goToLabSamples(); | ||
await page.getByText('Blood', { exact: true }).click(); | ||
await page.getByText('Lymphocites').click(); | ||
await bahmni.saveOrder(); | ||
await page.locator('#dashboard-link span.patient-name').click(); | ||
await expect(page.locator('#Lab-Orders').getByText('Lymphocytes')) .toBeVisible(); | ||
|
||
// 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 page.goto(`${BAHMNI_URL}`); | ||
await bahmni.goToPatientDashboard(); | ||
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.goToLabSamples(); | ||
await page.getByText('Urine', { exact: true }).click(); | ||
await page.getByText('Urobilinogen').click(); | ||
await bahmni.saveOrder(); | ||
await page.locator('#dashboard-link span.patient-name').click(); | ||
await expect(page.locator('#Lab-Orders').getByText('Urobilinogen')) .toBeVisible(); | ||
|
||
// 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 page.goto(`${BAHMNI_URL}`); | ||
await bahmni.goToPatientDashboard(); | ||
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(); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Page } from '@playwright/test'; | ||
import { OPENELIS_URL } from '../configs/globalSetup'; | ||
import { delay, patientName } from './bahmni'; | ||
|
||
export class OpenELIS { | ||
constructor(readonly page: Page) {} | ||
|
||
async open() { | ||
await this.page.goto(`${OPENELIS_URL}`); | ||
await this.page.locator("input[name='loginName']").fill(`${process.env.OPENELIS_USERNAME}`); | ||
await this.page.locator("input[name='password']").fill(`${process.env.OPENELIS_PASSWORD}`); | ||
await this.page.locator('#submitButton').click(); | ||
} | ||
|
||
async searchClient() { | ||
await this.page.locator('#menu_labDashboard').click(); | ||
await delay(5000); | ||
await this.page.locator('input#refreshButton').click(); | ||
await this.page.locator('input[type=text]').nth(1).type(`${patientName.familyName}`); | ||
} | ||
|
||
async collectSample() { | ||
await this.page.locator('#todaySamplesToCollectListContainer-slick-grid div.slick-viewport div.slick-cell.l6.r6.cell-title a').click(); | ||
await this.page.locator('#orderDisplay tbody input.textButton').click(); | ||
await this.page.locator('#saveButtonId').first().click(); | ||
} | ||
|
||
async enterLabResults() { | ||
await this.page.locator('#result').first().click(); | ||
await this.page.locator('#results_1').selectOption('Negatif'); | ||
await this.page.locator('#saveButtonId').first().click(); | ||
} | ||
|
||
async enterNumericalResults() { | ||
await this.page.locator('#result').first().click(); | ||
await this.page.locator('#results_1').click(); | ||
await this.page.locator('#results_1').fill('13.7'); | ||
await this.page.locator('#cell_1').click(); | ||
await this.page.locator('#saveButtonId').first().click(); | ||
} | ||
|
||
async enterFreeTextResults() { | ||
await this.page.locator('#result').first().click(); | ||
await this.page.locator('#results_1').fill('Abnormal level'); | ||
await this.page.locator('#abnormalId_1').click(); | ||
await this.page.locator('#saveButtonId').first().click(); | ||
} | ||
|
||
async validateLabResults() { | ||
await this.page.locator('a#validate').first().click(); | ||
await this.page.locator('#accepted_0').check(); | ||
await this.page.locator('#saveButtonId').first().click(); | ||
} | ||
} |
Oops, something went wrong.