forked from ohcnetwork/care_fe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ohcnetwork#7529 from coronasafe/develop
Staging Release for v24.15.0
- Loading branch information
Showing
95 changed files
with
3,819 additions
and
2,916 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 @@ | ||
v20 |
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,106 @@ | ||
import { afterEach, before, beforeEach, cy, describe, it } from "local-cypress"; | ||
import LoginPage from "../../pageobject/Login/LoginPage"; | ||
import { PatientPage } from "../../pageobject/Patient/PatientCreation"; | ||
import { PatientFileUpload } from "../../pageobject/Patient/PatientFileupload"; | ||
|
||
describe("Patient Details", () => { | ||
const loginPage = new LoginPage(); | ||
const patientPage = new PatientPage(); | ||
const patientFileUpload = new PatientFileUpload(); | ||
const cypressAudioName = "cypress audio"; | ||
const cypressFileName = "cypress name"; | ||
const newFileName = "cypress modified name"; | ||
const patientNameOne = "Dummy Patient 3"; | ||
const patientNameTwo = "Dummy Patient 4"; | ||
const patientNameThree = "Dummy Patient 5"; | ||
before(() => { | ||
loginPage.loginAsDisctrictAdmin(); | ||
cy.saveLocalStorage(); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.restoreLocalStorage(); | ||
cy.clearLocalStorage(/filters--.+/); | ||
cy.awaitUrl("/patients"); | ||
}); | ||
|
||
it("Record an Audio and download the file", () => { | ||
// Record an audio | ||
patientPage.visitPatient(patientNameOne); | ||
patientFileUpload.visitPatientDetailsPage(); | ||
patientFileUpload.recordAudio(); | ||
patientFileUpload.typeAudioName(cypressAudioName); | ||
patientFileUpload.clickUploadAudioFile(); | ||
// Verify the audio file is uploaded | ||
cy.verifyNotification("File Uploaded Successfully"); | ||
patientFileUpload.verifyUploadFilePresence(cypressAudioName); | ||
// Verify the download of the audio file | ||
cy.get("button").contains("DOWNLOAD").click(); | ||
cy.verifyNotification("Downloading file..."); | ||
}); | ||
|
||
it("Upload a File and archive it", () => { | ||
// Upload the file | ||
patientPage.visitPatient(patientNameTwo); | ||
patientFileUpload.visitPatientDetailsPage(); | ||
patientFileUpload.uploadFile(); | ||
patientFileUpload.typeFileName(cypressFileName); | ||
patientFileUpload.clickUploadFile(); | ||
// Verify the file is uploaded | ||
cy.verifyNotification("File Uploaded Successfully"); | ||
cy.closeNotification(); | ||
patientFileUpload.verifyUploadFilePresence(cypressFileName); | ||
// Archive the file | ||
patientFileUpload.archiveFile(); | ||
patientFileUpload.clickSaveArchiveFile(); | ||
cy.verifyNotification("File archived successfully"); | ||
patientFileUpload.verifyArchiveFile(cypressFileName); | ||
}); | ||
|
||
it("User-level Based Permission for File Modification", () => { | ||
// Login as Nurse 1 | ||
loginPage.login("dummynurse1", "Coronasafe@123"); | ||
cy.reload(); | ||
// Visit the patient details page | ||
patientPage.visitPatient(patientNameThree); | ||
patientFileUpload.visitPatientDetailsPage(); | ||
// Upload the file | ||
patientFileUpload.uploadFile(); | ||
patientFileUpload.typeFileName(cypressFileName); | ||
patientFileUpload.clickUploadFile(); | ||
// Verify the file is uploaded | ||
cy.verifyNotification("File Uploaded Successfully"); | ||
cy.closeNotification(); | ||
patientFileUpload.verifyUploadFilePresence(cypressFileName); | ||
// Edit the file name | ||
patientFileUpload.verifyFileRenameOption(true); | ||
patientFileUpload.renameFile(newFileName); | ||
patientFileUpload.clickSaveFileName(); | ||
// Verify the file name is changed | ||
cy.verifyNotification("File name changed successfully"); | ||
cy.closeNotification(); | ||
patientFileUpload.verifyUploadFilePresence(newFileName); | ||
// Login as Nurse 2 | ||
loginPage.login("dummynurse2", "Coronasafe@123"); | ||
cy.reload(); | ||
// Verify the file edit option is not available | ||
patientFileUpload.verifyUploadFilePresence(newFileName); | ||
patientFileUpload.verifyFileRenameOption(false); | ||
// Login as District Admin | ||
loginPage.loginAsDisctrictAdmin(); | ||
cy.reload(); | ||
// Verify the file edit option is available | ||
patientFileUpload.verifyUploadFilePresence(newFileName); | ||
patientFileUpload.verifyFileRenameOption(true); | ||
patientFileUpload.renameFile(cypressFileName); | ||
patientFileUpload.clickSaveFileName(); | ||
// Verify the file name is changed | ||
cy.verifyNotification("File name changed successfully"); | ||
cy.closeNotification(); | ||
patientFileUpload.verifyUploadFilePresence(cypressFileName); | ||
}); | ||
|
||
afterEach(() => { | ||
cy.saveLocalStorage(); | ||
}); | ||
}); |
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,90 @@ | ||
import { cy } from "local-cypress"; | ||
|
||
export class PatientFileUpload { | ||
visitPatientDetailsPage() { | ||
cy.get("#patient-details").click(); | ||
cy.get("#upload-patient-files").click(); | ||
} | ||
|
||
typeAudioName(name: string) { | ||
cy.get("#consultation_audio_file").clear(); | ||
cy.get("#consultation_audio_file").click().type(name); | ||
} | ||
|
||
typeFileName(name: string) { | ||
cy.get("#consultation_file").clear(); | ||
cy.get("#consultation_file").click().type(name); | ||
} | ||
|
||
recordAudio() { | ||
cy.get("#record-audio").click(); | ||
cy.wait(5000); | ||
cy.get("#stop-recording").click(); | ||
} | ||
|
||
clickUploadAudioFile() { | ||
cy.intercept("POST", "**/api/v1/files/").as("uploadAudioFile"); | ||
cy.verifyAndClickElement("#upload_audio_file", "Save"); | ||
cy.wait("@uploadAudioFile").its("response.statusCode").should("eq", 201); | ||
} | ||
|
||
verifyUploadFilePresence(fileName: string) { | ||
cy.wait(2000); | ||
cy.get("#file-div").scrollIntoView(); | ||
cy.verifyContentPresence("#file-div", [fileName]); | ||
} | ||
|
||
uploadFile() { | ||
cy.get("#file_upload_patient").selectFile( | ||
"cypress/fixtures/sampleAsset.xlsx", | ||
{ force: true } | ||
); | ||
} | ||
|
||
clickUploadFile() { | ||
cy.intercept("POST", "**/api/v1/files/").as("uploadFile"); | ||
cy.get("#upload_file_button").click(); | ||
cy.wait("@uploadFile").its("response.statusCode").should("eq", 201); | ||
} | ||
|
||
archiveFile() { | ||
cy.get("button").contains("ARCHIVE").click().scrollIntoView(); | ||
cy.get("#editFileName").clear().type("Cypress File Archive"); | ||
} | ||
|
||
clickSaveArchiveFile() { | ||
cy.intercept("PATCH", "**/api/v1/files/**").as("saveArchiveFile"); | ||
cy.submitButton("Proceed"); | ||
cy.wait("@saveArchiveFile").its("response.statusCode").should("eq", 200); | ||
} | ||
|
||
verifyArchiveFile(fileName: string) { | ||
cy.get("#archived-files").click(); | ||
cy.get("button").contains("MORE DETAILS").click().scrollIntoView(); | ||
cy.get("#archive-file-name").should("contain.text", fileName); | ||
cy.get("#archive-file-reason").then(($reason) => { | ||
expect($reason.text().split(":")[1]).to.contain("Cypress File Archive"); | ||
}); | ||
} | ||
|
||
verifyFileRenameOption(status: boolean) { | ||
cy.get("#file-div").then(($fileDiv) => { | ||
if (status) { | ||
expect($fileDiv.text()).to.contain("RENAME"); | ||
} else { | ||
expect($fileDiv.text()).to.not.contain("RENAME"); | ||
} | ||
}); | ||
} | ||
|
||
renameFile(newFileName: string) { | ||
cy.get("button").contains("RENAME").click().scrollIntoView(); | ||
cy.get("#editFileName").clear().type(newFileName); | ||
} | ||
|
||
clickSaveFileName() { | ||
cy.intercept("PATCH", "**/api/v1/files/**").as("saveFileName"); | ||
cy.submitButton("Proceed"); | ||
cy.wait("@saveFileName").its("response.statusCode").should("eq", 200); | ||
} | ||
} |
Oops, something went wrong.