-
Notifications
You must be signed in to change notification settings - Fork 490
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into fix#6771
- Loading branch information
Showing
38 changed files
with
545 additions
and
110 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
import { cy, describe, before, beforeEach, it, afterEach } from "local-cypress"; | ||
import LoginPage from "../../pageobject/Login/LoginPage"; | ||
import FacilityManage from "../../pageobject/Facility/FacilityManage"; | ||
import FacilityPage from "../../pageobject/Facility/FacilityCreation"; | ||
import { v4 as uuidv4 } from "uuid"; | ||
|
||
describe("Facility Manage Functions", () => { | ||
const loginPage = new LoginPage(); | ||
const facilityManage = new FacilityManage(); | ||
const facilityPage = new FacilityPage(); | ||
const facilityMiddlewareUpdateButton = "Update"; | ||
const facilityMiddleware = "dev-middleware.coronasafe.live"; | ||
const facilityUpdatedMiddleware = "updated.coronasafe.live"; | ||
const facilityMiddlewareSuccessfullNotification = | ||
"Facility updated successfully"; | ||
const facilityHrfidUpdateButton = "Link Health Facility"; | ||
const facilityHrfidSuccessfullNotification = | ||
"Health Facility config updated successfully"; | ||
const facilityHrfId = uuidv4(); | ||
const facilityUpdatedHrfId = uuidv4(); | ||
const doctorCapacity = "5"; | ||
const doctorModifiedCapacity = "7"; | ||
const totalCapacity = "100"; | ||
const currentOccupied = "80"; | ||
const totalUpdatedCapacity = "120"; | ||
const currentUpdatedOccupied = "100"; | ||
|
||
before(() => { | ||
loginPage.loginAsDisctrictAdmin(); | ||
cy.saveLocalStorage(); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.viewport(1280, 720); | ||
cy.restoreLocalStorage(); | ||
cy.clearLocalStorage(/filters--.+/); | ||
cy.awaitUrl("/"); | ||
facilityPage.visitAlreadyCreatedFacility(); | ||
}); | ||
|
||
it("Facility Cover Image button functionality", () => { | ||
// It's only button functionality because we can't access S3 bucket in local | ||
facilityManage.clickCoverImage(); | ||
facilityManage.verifyUploadButtonVisible(); | ||
facilityManage.uploadCoverImage("facilitycoverimage.jpg"); | ||
facilityManage.clickSaveCoverImage(); | ||
}); | ||
|
||
it("Configure Facility Middleware", () => { | ||
facilityPage.clickManageFacilityDropdown(); | ||
facilityManage.clickFacilityConfigureButton(); | ||
facilityManage.verifyMiddlewareAddressVisible(); | ||
// verify mandatory field error message | ||
facilityManage.clickButtonWithText(facilityMiddlewareUpdateButton); | ||
facilityManage.checkErrorMessageVisibility( | ||
"Middleware Address is required" | ||
); | ||
// add middleware and verify the notification | ||
facilityManage.typeMiddlewareAddress(facilityMiddleware); | ||
facilityManage.clickButtonWithText(facilityMiddlewareUpdateButton); | ||
facilityManage.verifySuccessMessageVisibilityAndContent( | ||
facilityMiddlewareSuccessfullNotification | ||
); | ||
// update the existing middleware | ||
facilityPage.clickManageFacilityDropdown(); | ||
facilityManage.clickFacilityConfigureButton(); | ||
facilityManage.verifyMiddlewareAddressVisible(); | ||
facilityManage.typeMiddlewareAddress(facilityUpdatedMiddleware); | ||
facilityManage.clickButtonWithText(facilityMiddlewareUpdateButton); | ||
facilityManage.verifySuccessMessageVisibilityAndContent( | ||
facilityMiddlewareSuccessfullNotification | ||
); | ||
// verify the updated middleware | ||
facilityPage.clickManageFacilityDropdown(); | ||
facilityManage.clickFacilityConfigureButton(); | ||
facilityManage.verifyMiddlewareAddressValue(facilityUpdatedMiddleware); | ||
}); | ||
|
||
it("Configure Facility Health ID", () => { | ||
facilityPage.clickManageFacilityDropdown(); | ||
facilityManage.clickFacilityConfigureButton(); | ||
// verify mandatory field error message | ||
facilityManage.clickButtonWithText(facilityHrfidUpdateButton); | ||
facilityManage.checkErrorMessageVisibility( | ||
"Health Facility Id is required" | ||
); | ||
// add facility health ID and verify notification | ||
facilityManage.typeHrfId(facilityHrfId); | ||
facilityManage.clickButtonWithText(facilityHrfidUpdateButton); | ||
facilityManage.verifySuccessMessageVisibilityAndContent( | ||
facilityHrfidSuccessfullNotification | ||
); | ||
// update the existing middleware | ||
facilityPage.clickManageFacilityDropdown(); | ||
facilityManage.clickFacilityConfigureButton(); | ||
facilityManage.typeHrfId(facilityUpdatedHrfId); | ||
facilityManage.clickButtonWithText(facilityHrfidUpdateButton); | ||
facilityManage.verifySuccessMessageVisibilityAndContent( | ||
facilityHrfidSuccessfullNotification | ||
); | ||
// verify its reflection | ||
facilityPage.clickManageFacilityDropdown(); | ||
facilityManage.clickFacilityConfigureButton(); | ||
facilityManage.verifyHrfIdValue(facilityUpdatedHrfId); | ||
}); | ||
|
||
it("Modify doctor capacity in Facility detail page", () => { | ||
// Add a doctor capacity | ||
facilityManage.clickFacilityAddDoctorTypeButton(); | ||
facilityPage.selectAreaOfSpecialization("General Medicine"); | ||
facilityPage.fillDoctorCount(doctorCapacity); | ||
facilityPage.saveAndExitDoctorForm(); | ||
facilityManage.verifySuccessMessageVisibilityAndContent( | ||
"Doctor count added successfully" | ||
); | ||
facilityManage.verifyTotalDoctorCapacity(doctorCapacity); | ||
// edit a existing doctor | ||
facilityManage.clickEditFacilityDoctorCapacity(); | ||
facilityPage.fillDoctorCount(doctorModifiedCapacity); | ||
facilityPage.clickdoctorcapacityaddmore(); | ||
facilityManage.verifySuccessMessageVisibilityAndContent( | ||
"Doctor count updated successfully" | ||
); | ||
facilityManage.verifyTotalDoctorCapacity(doctorModifiedCapacity); | ||
// delete a bed | ||
facilityManage.clickDeleteFacilityDoctorCapacity(); | ||
facilityManage.clickButtonWithText("Delete"); | ||
facilityManage.verifySuccessMessageVisibilityAndContent( | ||
"Doctor specialization type deleted successfully" | ||
); | ||
}); | ||
|
||
it("Modify bed capacity in Facility detail page", () => { | ||
// add multiple new bed capacity | ||
facilityManage.clickFacilityAddBedTypeButton(); | ||
facilityPage.selectBedType("Oxygen beds"); | ||
facilityPage.fillTotalCapacity(totalCapacity); | ||
facilityPage.fillCurrentlyOccupied(currentOccupied); | ||
facilityPage.saveAndExitBedCapacityForm(); | ||
facilityManage.verifySuccessMessageVisibilityAndContent( | ||
"Bed capacity added successfully" | ||
); | ||
facilityManage.verifyFacilityBedCapacity(totalCapacity); | ||
facilityManage.verifyFacilityBedCapacity(currentOccupied); | ||
// edit a existing bed | ||
facilityManage.clickEditFacilityBedCapacity(); | ||
facilityPage.fillTotalCapacity(totalUpdatedCapacity); | ||
facilityPage.fillCurrentlyOccupied(currentUpdatedOccupied); | ||
facilityPage.clickbedcapcityaddmore(); | ||
facilityManage.verifySuccessMessageVisibilityAndContent( | ||
"Bed capacity updated successfully" | ||
); | ||
facilityManage.verifyFacilityBedCapacity(totalUpdatedCapacity); | ||
facilityManage.verifyFacilityBedCapacity(currentUpdatedOccupied); | ||
// delete a bed | ||
facilityManage.clickDeleteFacilityBedCapacity(); | ||
facilityManage.clickButtonWithText("Delete"); | ||
facilityManage.verifySuccessMessageVisibilityAndContent( | ||
"Bed type deleted successfully" | ||
); | ||
}); | ||
|
||
it("Delete a existing facility and verify the error message", () => { | ||
facilityPage.clickManageFacilityDropdown(); | ||
facilityPage.clickDeleteFacilityOption(); | ||
facilityPage.confirmDeleteFacility(); | ||
facilityManage.verifySuccessMessageVisibilityAndContent( | ||
"You do not have permission to perform this action." | ||
); | ||
}); | ||
|
||
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Oops, something went wrong.