-
Notifications
You must be signed in to change notification settings - Fork 542
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ohcnetwork:develop' into issue/#10071/selection-slot
- Loading branch information
Showing
69 changed files
with
2,222 additions
and
1,315 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
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,31 @@ | ||
import { PatientEncounter } from "pageObject/Patients/PatientEncounter"; | ||
import { FacilityCreation } from "pageObject/facility/FacilityCreation"; | ||
|
||
const facilityCreation = new FacilityCreation(); | ||
const patientEncounter = new PatientEncounter(); | ||
|
||
describe("Patient Encounter Questionnaire", () => { | ||
beforeEach(() => { | ||
// Login and set up any necessary test state | ||
cy.visit("/login"); | ||
}); | ||
|
||
it("Create a new ABG questionnaire and verify the values", () => { | ||
const abgValues = { | ||
pco2: "120", | ||
po2: "80", | ||
}; | ||
cy.loginByApi("devnurse"); | ||
facilityCreation.selectFacility("GHC Trikaripur"); | ||
|
||
// Chain the methods instead of multiple separate calls | ||
patientEncounter | ||
.navigateToEncounters() | ||
.openFirstEncounterDetails() | ||
.clickUpdateEncounter() | ||
.addQuestionnaire("Arterial Blood Gas") | ||
.fillQuestionnaire(abgValues) | ||
.submitQuestionnaire() | ||
.verifyOverviewValues(Object.values(abgValues)); | ||
}); | ||
}); |
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,72 @@ | ||
export class PatientEncounter { | ||
// Navigation | ||
navigateToEncounters() { | ||
cy.get('[data-sidebar="content"]').contains("Encounters").click(); | ||
return this; | ||
} | ||
|
||
openFirstEncounterDetails() { | ||
cy.get('[data-cy="encounter-list-cards"]') | ||
.first() | ||
.contains("View Details") | ||
.click(); | ||
return this; | ||
} | ||
|
||
clickUpdateEncounter() { | ||
cy.verifyAndClickElement('[data-cy="update-encounter-button"]', "Update"); | ||
cy.verifyAndClickElement( | ||
'[data-cy="update-encounter-option"]', | ||
"Update Encounter", | ||
); | ||
return this; | ||
} | ||
|
||
// Questionnaire actions | ||
addQuestionnaire(questionnaireName: string) { | ||
cy.get('[data-cy="add-questionnaire-button"]').click(); | ||
cy.get('[role="dialog"] input') | ||
.should("be.visible") | ||
.type(questionnaireName); | ||
cy.get('[role="dialog"] button') | ||
.contains(questionnaireName) | ||
.should("be.visible") | ||
.click(); | ||
return this; | ||
} | ||
|
||
fillQuestionnaire(answers: Record<string, string>) { | ||
Object.entries(answers).forEach(([field, value]) => { | ||
// Handle both text inputs and select dropdowns | ||
cy.get(`[data-cy="question-${field}"]`).then(($el) => { | ||
if ($el.is("select")) { | ||
cy.wrap($el).select(value); | ||
} else { | ||
cy.wrap($el).type(value); | ||
} | ||
}); | ||
}); | ||
return this; | ||
} | ||
|
||
submitQuestionnaire() { | ||
this.clickSubmitQuestionnaire(); | ||
this.verifyQuestionnaireSubmission(); | ||
return this; | ||
} | ||
|
||
clickSubmitQuestionnaire() { | ||
cy.clickSubmitButton("Submit"); | ||
return this; | ||
} | ||
|
||
verifyQuestionnaireSubmission() { | ||
cy.verifyNotification("Questionnaire submitted successfully"); | ||
return this; | ||
} | ||
|
||
verifyOverviewValues(expectedValues: string[]) { | ||
cy.verifyContentPresence('[data-cy="encounter-overview"]', expectedValues); | ||
return this; | ||
} | ||
} |
Oops, something went wrong.