-
Notifications
You must be signed in to change notification settings - Fork 481
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 | Facility Configuration | Facility Module (#7040)
* facility cover image * facility cover image * error fix * facility configuration * pom conversion * constant conversion
- Loading branch information
Showing
8 changed files
with
183 additions
and
10 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,104 @@ | ||
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(); | ||
|
||
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); | ||
}); | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
class FacilityManage { | ||
clickCoverImage() { | ||
cy.get("#facility-coverimage").click({ force: true }); | ||
} | ||
|
||
verifyUploadButtonVisible() { | ||
cy.get("#upload-cover-image").should("be.visible"); | ||
} | ||
|
||
uploadCoverImage(fileName) { | ||
cy.get("#upload-cover-image") | ||
.selectFile(`cypress/fixtures/${fileName}`, { force: true }) | ||
.wait(100); // Adjust the wait time as needed | ||
} | ||
|
||
clickSaveCoverImage() { | ||
cy.get("#save-cover-image").scrollIntoView(); | ||
cy.get("#save-cover-image").click(); | ||
} | ||
|
||
clickFacilityConfigureButton() { | ||
cy.get("#configure-facility").should("be.visible"); | ||
cy.get("#configure-facility").click(); | ||
} | ||
|
||
verifyMiddlewareAddressVisible() { | ||
cy.get("#middleware_address").should("be.visible"); | ||
} | ||
|
||
clickButtonWithText(text) { | ||
cy.get("button#submit").contains(text).click(); | ||
} | ||
|
||
checkErrorMessageVisibility(text) { | ||
cy.get(".error-text").contains(text).should("be.visible"); | ||
} | ||
|
||
typeMiddlewareAddress(address) { | ||
cy.get("#middleware_address").click().clear().click().type(address); | ||
} | ||
|
||
typeHrfId(address) { | ||
cy.get("#hf_id").click().clear().click().type(address); | ||
} | ||
|
||
verifySuccessMessageVisibilityAndContent(text) { | ||
cy.get(".pnotify-text").should("be.visible").and("contain", text); | ||
} | ||
|
||
verifyMiddlewareAddressValue(expectedValue) { | ||
cy.get("#middleware_address").should("have.value", expectedValue); | ||
} | ||
|
||
verifyHrfIdValue(expectedValue) { | ||
cy.get("#hf_id").should("have.value", expectedValue); | ||
} | ||
} | ||
export default FacilityManage; |
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