-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/openmrs/openmrs-esm-patient…
…-management into patient-registration
- Loading branch information
Showing
76 changed files
with
2,548 additions
and
1,821 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
e2e/commands/cohortOperations.ts → e2e/commands/cohort-operations.ts
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
File renamed without changes.
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export * from './patientOperations'; | ||
export * from './encounterOperations'; | ||
export * from './visitOperations'; | ||
export * from './providerOperations'; | ||
export * from './cohortOperations'; | ||
export * from './patient-operations'; | ||
export * from './encounter-operations'; | ||
export * from './visit-operations'; | ||
export * from './provider-operations'; | ||
export * from './cohort-operations'; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export * from './homePage'; | ||
export * from './registrationAndEditPage'; | ||
export * from './patientListsPage'; | ||
export * from './home-page'; | ||
export * from './registration-and-edit-page'; | ||
export * from './patient-lists-page'; |
File renamed without changes.
File renamed without changes.
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,63 @@ | ||
import { expect } from '@playwright/test'; | ||
import { Visit } from '@openmrs/esm-framework'; | ||
import { test } from '../core'; | ||
import type { Provider } from '../../packages/esm-appointments-app/src/types/index'; | ||
import type { Encounter } from '../../packages/esm-active-visits-app/src/visits-summary/visit.resource'; | ||
import { | ||
createEncounter, | ||
deleteEncounter, | ||
deletePatient, | ||
endVisit, | ||
generateRandomPatient, | ||
Patient, | ||
startVisit, | ||
getProvider, | ||
} from '../commands'; | ||
import { HomePage } from '../pages'; | ||
|
||
let patient: Patient; | ||
let visit: Visit; | ||
let encounter: Encounter; | ||
let provider: Provider; | ||
const encounterNote = 'This is a test note'; | ||
|
||
test.beforeEach(async ({ api }) => { | ||
patient = await generateRandomPatient(api); | ||
visit = await startVisit(api, patient.uuid); | ||
provider = await getProvider(api); | ||
encounter = await createEncounter(api, patient.uuid, provider.uuid, encounterNote); | ||
}); | ||
|
||
test('View active visits', async ({ page }) => { | ||
const homePage = new HomePage(page); | ||
const openmrsIdentifier = patient.identifiers[0].display.split('=')[1].trim(); | ||
const firstName = patient.person.display.split(' ')[0]; | ||
const lastName = patient.person.display.split(' ')[1]; | ||
|
||
await test.step('When I visit the home page', async () => { | ||
await homePage.goto(); | ||
}); | ||
|
||
await test.step("And I click on a patient's name in the active visits table", async () => { | ||
await homePage.clickOnActiveVisitPatient(patient.uuid); | ||
}); | ||
|
||
await test.step('Then I should see data about the active visit such as the encounters recorded during their visit and their observations and a summary of the diagnoses, notes, and medications recorded', async () => { | ||
// Checks the visit details | ||
await expect(page.getByTestId(`${visit.uuid}:idNumber`)).toContainText(openmrsIdentifier); | ||
await expect(page.getByTestId(`${visit.uuid}:name`)).toContainText(`${firstName} ${lastName}`); | ||
await expect(page.getByTestId(`${visit.uuid}:visitType`)).toContainText(visit.visitType.display); | ||
// Checks for the encounter | ||
await expect(page.getByTestId(`${encounter.uuid}:encounterType`)).toContainText(encounter.encounterType.display); | ||
await expect(page.getByTestId(`${encounter.uuid}:provider`)).toContainText('Super User: Clinician'); | ||
// Checks for the visit note | ||
await homePage.clickOnVisitSummaryTab(); | ||
await expect(page.getByTestId('note')).toContainText(encounterNote); | ||
}); | ||
}); | ||
|
||
test.afterEach(async ({ api }) => { | ||
await endVisit(api, patient.uuid); | ||
await deleteEncounter(api, encounter.uuid); | ||
await deletePatient(api, patient.uuid); | ||
}); |
This file was deleted.
Oops, something went wrong.
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,63 @@ | ||
import dayjs from 'dayjs'; | ||
import { expect } from '@playwright/test'; | ||
import { test } from '../core'; | ||
import { deletePatient, generateRandomPatient, getPatient, Patient } from '../commands'; | ||
import { PatientRegistrationFormValues, RegistrationAndEditPage } from '../pages'; | ||
|
||
let patient: Patient; | ||
test.beforeEach(async ({ api }) => { | ||
patient = await generateRandomPatient(api); | ||
}); | ||
|
||
// TODO: Add email field after fixing O3-1883 (https://issues.openmrs.org/browse/O3-1883) | ||
const formValues: PatientRegistrationFormValues = { | ||
givenName: `Johnny`, | ||
middleName: 'Donny', | ||
familyName: `Ronny`, | ||
sex: 'male', | ||
birthdate: '01/02/2020', | ||
postalCode: '', | ||
address1: 'Bom Jesus Street', | ||
address2: '', | ||
country: 'Brazil', | ||
countyDistrict: 'Antônio dos Santos', | ||
stateProvince: 'Pernambuco', | ||
cityVillage: 'Recife', | ||
phone: '5555551234', | ||
}; | ||
|
||
test('Edit a patient', async ({ page, api }) => { | ||
test.setTimeout(5 * 60 * 1000); | ||
const patientEditPage = new RegistrationAndEditPage(page); | ||
|
||
await test.step("When I visit the registration page to a patient's details", async () => { | ||
await patientEditPage.goto(patient.uuid); | ||
}); | ||
|
||
await test.step('And then I click on fill new values into the registration form and then click the `Submit` button', async () => { | ||
await expect(patientEditPage.givenNameInput()).not.toHaveValue('', { timeout: 2 * 60 * 1000 }); | ||
|
||
await patientEditPage.fillPatientRegistrationForm(formValues); | ||
}); | ||
|
||
await test.step("Then I should be redirected to the patient's chart page and the patient object should have updated information", async () => { | ||
await expect(page).toHaveURL(`${process.env.E2E_BASE_URL}/spa/patient/${patient.uuid}/chart/Patient Summary`); | ||
const updatedPatient = await getPatient(api, patient.uuid); | ||
const { person } = updatedPatient; | ||
const { givenName, middleName, familyName, sex } = formValues; | ||
|
||
await expect(person.display).toBe(`${givenName} ${middleName} ${familyName}`); | ||
await expect(person.gender).toBe(sex[0].toUpperCase()); | ||
await expect(dayjs(person.birthdate).format('DD/MM/YYYY')).toBe(formValues.birthdate); | ||
await expect(person.preferredAddress.address1).toBe(formValues.address1); | ||
await expect(person.preferredAddress.cityVillage).toBe(formValues.cityVillage); | ||
await expect(person.preferredAddress.stateProvince).toBe(formValues.stateProvince); | ||
await expect(person.preferredAddress.country).toBe(formValues.country); | ||
await expect(person.preferredAddress.countyDistrict).toBe(formValues.countyDistrict); | ||
await expect(person.attributes[0].display).toBe(`Telephone Number = ${formValues.phone}`); | ||
}); | ||
}); | ||
|
||
test.afterEach(async ({ api }) => { | ||
await deletePatient(api, patient.uuid); | ||
}); |
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,103 @@ | ||
import { test } from '../core'; | ||
import { PatientListsPage } from '../pages'; | ||
import { expect } from '@playwright/test'; | ||
import { | ||
type Cohort, | ||
type CohortMember, | ||
type Patient, | ||
addPatientToCohort, | ||
deleteCohort, | ||
deletePatient, | ||
generateRandomCohort, | ||
generateRandomPatient, | ||
removePatientFromCohort, | ||
} from '../commands'; | ||
|
||
let createdCohortMember: CohortMember; | ||
let createdCohortUuid: string; | ||
let cohort: Cohort; | ||
let patient: Patient; | ||
|
||
test.beforeEach(async ({ api }) => { | ||
patient = await generateRandomPatient(api); | ||
cohort = await generateRandomCohort(api); | ||
}); | ||
|
||
test('Create and edit a patient list', async ({ page }) => { | ||
const patientListPage = new PatientListsPage(page); | ||
|
||
await test.step('When I visit the patient lists page', async () => { | ||
await patientListPage.goto(); | ||
}); | ||
|
||
// Create a new patient list | ||
const patientListName = `Cohort ${Math.floor(Math.random() * 10000)}`; | ||
const patientListDescription = `Cohort Description ${Math.floor(Math.random() * 10000)}`; | ||
|
||
await test.step('Then I create a new list', async () => { | ||
await patientListPage.addNewPatientList(patientListName, patientListDescription); | ||
}); | ||
|
||
await test.step("And then I navigate to the new list's page", async () => { | ||
await patientListPage.allListsButton().click(); | ||
await patientListPage.searchPatientList(patientListName); | ||
await patientListPage.patientListsTable().getByText(patientListName).click(); | ||
}); | ||
|
||
await test.step('Then I should see the information about the list', async () => { | ||
await expect(page).toHaveURL(new RegExp('^[\\w\\d:\\/.-]+\\/patient-lists\\/[\\w\\d-]+$')); | ||
createdCohortUuid = /patient-lists\/([\w\d-]+)/.exec(page.url())?.[1] ?? null; | ||
|
||
await expect(patientListPage.patientListHeader()).toHaveText(new RegExp(patientListName)); | ||
await expect(patientListPage.patientListHeader()).toHaveText(new RegExp(patientListDescription)); | ||
await expect(patientListPage.patientListHeader()).toHaveText(/0 patients/); | ||
}); | ||
|
||
// Edit the patient list | ||
const editedPatientListName = patientListName + ' edited'; | ||
const editedPatientListDescription = patientListDescription + ' edited'; | ||
|
||
await test.step("When I edit the list's details", async () => { | ||
await patientListPage.editPatientList(editedPatientListName, editedPatientListDescription); | ||
}); | ||
|
||
await test.step('Then I should see the updated information about the list', async () => { | ||
await expect(patientListPage.patientListHeader()).toHaveText(new RegExp(editedPatientListName)); | ||
await expect(patientListPage.patientListHeader()).toHaveText(new RegExp(editedPatientListDescription)); | ||
}); | ||
}); | ||
|
||
test('Manage patients in a list', async ({ api, page }) => { | ||
await test.step("When I visit a specific patient list's page", async () => { | ||
const patientListPage = new PatientListsPage(page); | ||
await patientListPage.goto(cohort.uuid); | ||
}); | ||
|
||
await test.step('Then I should be able to add and remove patients from that list', async () => { | ||
const patientListPage = new PatientListsPage(page); | ||
|
||
// Add a patient to the list | ||
createdCohortMember = await addPatientToCohort(api, cohort.uuid, patient.uuid); | ||
await patientListPage.goto(cohort.uuid); | ||
await expect(patientListPage.patientListHeader()).toHaveText(/1 patients/); | ||
await expect(patientListPage.patientsTable()).toHaveText(new RegExp(patient.person.display)); | ||
|
||
// Remove a patient from the list | ||
await removePatientFromCohort(api, createdCohortMember.uuid); | ||
await patientListPage.goto(cohort.uuid); | ||
await expect(patientListPage.patientListHeader()).toHaveText(/0 patients/); | ||
await expect(patientListPage.patientsTable()).not.toHaveText(new RegExp(patient.person.display)); | ||
createdCohortMember = null; | ||
}); | ||
}); | ||
|
||
test.afterEach(async ({ api }) => { | ||
if (createdCohortMember) { | ||
await removePatientFromCohort(api, createdCohortMember.uuid); | ||
} | ||
if (createdCohortUuid) { | ||
await deleteCohort(api, createdCohortUuid); | ||
} | ||
await deletePatient(api, patient.uuid); | ||
await deleteCohort(api, cohort.uuid); | ||
}); |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.