-
Notifications
You must be signed in to change notification settings - Fork 433
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New Cypress test for the patient discussion notes (#8554)
* doctor notes cypress test without tab switching * doctor notes cypress test without tab switching * Adds utility fn. to extract keys of obj. in type-safe manner. * i18n for patient notes thread titles and add id for tabs * discussion note tab switching functionality test * made success notification as variables * corrected the test description --------- Co-authored-by: rithviknishad <[email protected]>
- Loading branch information
1 parent
5287f35
commit b54bcc5
Showing
12 changed files
with
128 additions
and
108 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import LoginPage from "../../pageobject/Login/LoginPage"; | ||
import { PatientPage } from "../../pageobject/Patient/PatientCreation"; | ||
import { PatientDoctorNotes } from "../../pageobject/Patient/PatientDoctorNotes"; | ||
|
||
describe("Patient Discussion notes in the consultation page", () => { | ||
const loginPage = new LoginPage(); | ||
const patientPage = new PatientPage(); | ||
const patientDoctorNotes = new PatientDoctorNotes(); | ||
const patientName = "Dummy Patient 4"; | ||
const patientNurseNote = "Test nurse Notes"; | ||
const patientNurseReplyNote = "Test nurse reply Notes"; | ||
const discussionNotesSubscribeWarning = | ||
"Please subscribe to notifications to get live updates on discussion notes."; | ||
const discussionNotesSuccessMessage = "Note added successfully"; | ||
|
||
before(() => { | ||
loginPage.loginAsDisctrictAdmin(); | ||
cy.saveLocalStorage(); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.restoreLocalStorage(); | ||
cy.clearLocalStorage(/filters--.+/); | ||
cy.awaitUrl("/patients"); | ||
}); | ||
|
||
it("Create a nurse note for a patient and verify both ID received the messages", () => { | ||
// Create a doctor notes a with a district admin | ||
patientPage.visitPatient(patientName); | ||
patientDoctorNotes.visitDiscussionNotesPage(); | ||
cy.verifyNotification(discussionNotesSubscribeWarning); | ||
cy.closeNotification(); | ||
// switch the switch to nurse note, as the bydefault is doctornotes | ||
patientDoctorNotes.selectNurseDiscussion(); | ||
patientDoctorNotes.addDiscussionNotes(patientNurseNote); | ||
patientDoctorNotes.postDiscussionNotes(); | ||
cy.verifyNotification(discussionNotesSuccessMessage); | ||
cy.closeNotification(); | ||
// verify the auto-switching of tab to nurse notes if the user is a nurse | ||
cy.get("p").contains("Sign Out").click(); | ||
loginPage.loginManuallyAsNurse(); | ||
loginPage.ensureLoggedIn(); | ||
cy.visit("/patients"); | ||
patientPage.visitPatient(patientName); | ||
patientDoctorNotes.visitDiscussionNotesPage(); | ||
// verify the message is received from admin | ||
cy.verifyNotification(discussionNotesSubscribeWarning); | ||
cy.closeNotification(); | ||
patientDoctorNotes.verifyDiscussionMessage(patientNurseNote); | ||
// Post a reply comment to the message | ||
patientDoctorNotes.addDiscussionNotes(patientNurseReplyNote); | ||
patientDoctorNotes.postDiscussionNotes(); | ||
cy.verifyNotification(discussionNotesSuccessMessage); | ||
cy.closeNotification(); | ||
patientDoctorNotes.verifyDiscussionMessage(patientNurseReplyNote); | ||
}); | ||
|
||
afterEach(() => { | ||
cy.saveLocalStorage(); | ||
}); | ||
}); |
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
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,29 @@ | ||
export class PatientDoctorNotes { | ||
visitDiscussionNotesPage() { | ||
cy.get("#patient_discussion_notes").scrollIntoView(); | ||
cy.get("#patient_discussion_notes").click(); | ||
} | ||
|
||
addDiscussionNotes(notes: string) { | ||
cy.wait(2000); | ||
cy.get("#discussion_notes_textarea").scrollIntoView(); | ||
cy.get("#discussion_notes_textarea").click().type(notes); | ||
} | ||
|
||
selectNurseDiscussion() { | ||
cy.get("#patient-note-tab-Nurses").scrollIntoView(); | ||
cy.get("#patient-note-tab-Nurses").click(); | ||
} | ||
|
||
verifyDiscussionMessage(text: string) { | ||
cy.get("#patient-notes-list").contains(text); | ||
} | ||
|
||
postDiscussionNotes() { | ||
cy.intercept("POST", "**/api/v1/patient/*/notes").as("postDiscussionNotes"); | ||
cy.get("#add_doctor_note_button").click(); | ||
cy.wait("@postDiscussionNotes") | ||
.its("response.statusCode") | ||
.should("eq", 201); | ||
} | ||
} |
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