Skip to content

Commit

Permalink
pom conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
nihal467 committed Jan 16, 2024
1 parent e9a3efa commit 36e6191
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 55 deletions.
93 changes: 38 additions & 55 deletions cypress/e2e/facility_spec/facility_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,77 +34,60 @@ describe("Facility Manage Functions", () => {

it("Configure Facility Middleware", () => {
facilityPage.clickManageFacilityDropdown();
cy.get("#configure-facility").should("be.visible");
cy.get("#configure-facility").click();
cy.get("#middleware_address").should("be.visible");
facilityManage.clickFacilityConfigureButton();
facilityManage.verifyMiddlewareAddressVisible();
// verify mandatory field error message
cy.get("button#submit").contains("Update").click();
cy.get(".error-text")
.contains("Middleware Address is required")
.should("be.visible");
facilityManage.clickButtonWithText("Update");
facilityManage.checkErrorMessageVisibility(
"Middleware Address is required"
);
// add middleware and verify the notification
cy.get("#middleware_address")
.click()
.clear()
.click()
.type("dev-middlreware.coronasafe.live");
cy.get("button#submit").contains("Update").click();
cy.get(".pnotify-text")
.should("be.visible")
.and("contain", "Facility updated successfully");
facilityManage.typeMiddlewareAddress("dev-middlreware.coronasafe.live");
facilityManage.clickButtonWithText("Update");
facilityManage.verifySuccessMessageVisibilityAndContent(
"Facility updated successfully"
);
// update the existing middleware
facilityPage.clickManageFacilityDropdown();
cy.get("#configure-facility").should("be.visible");
cy.get("#configure-facility").click();
cy.get("#middleware_address").should("be.visible");
cy.get("#middleware_address")
.click()
.clear()
.click()
.type("updated.coronasafe.live");
cy.get("button#submit").contains("Update").click();
cy.get(".pnotify-text")
.should("be.visible")
.and("contain", "Facility updated successfully");
facilityManage.clickFacilityConfigureButton();
facilityManage.verifyMiddlewareAddressVisible();
facilityManage.typeMiddlewareAddress("updated.coronasafe.live");
facilityManage.clickButtonWithText("Update");
facilityManage.verifySuccessMessageVisibilityAndContent(
"Facility updated successfully"
);
// verify the updated middleware
facilityPage.clickManageFacilityDropdown();
cy.get("#configure-facility").should("be.visible");
cy.get("#configure-facility").click();
cy.get("#middleware_address").should(
"have.value",
"updated.coronasafe.live"
);
facilityManage.clickFacilityConfigureButton();
facilityManage.verifyMiddlewareAddressValue("updated.coronasafe.live");
});

it("Configure Facility Health ID", () => {
facilityPage.clickManageFacilityDropdown();
cy.get("#configure-facility").should("be.visible");
cy.get("#configure-facility").click();
facilityManage.clickFacilityConfigureButton();
// verify mandatory field error message
cy.get("button#submit").contains("Link Health Facility").click();
cy.get(".error-text")
.contains("Health Facility Id is required")
.should("be.visible");
facilityManage.clickButtonWithText("Link Health Facility");
facilityManage.checkErrorMessageVisibility(
"Health Facility Id is required"
);
// add facility health ID and verify notification
cy.get("#hf_id").click().clear().click().type(hrf_id_1);
cy.get("button#submit").contains("Link Health Facility").click();
cy.get(".pnotify-text")
.should("be.visible")
.and("contain", "Health Facility config updated successfully");
facilityManage.typeHrfId(hrf_id_1);
facilityManage.clickButtonWithText("Link Health Facility");
facilityManage.verifySuccessMessageVisibilityAndContent(
"Health Facility config updated successfully"
);
// update the existing middleware
facilityPage.clickManageFacilityDropdown();
cy.get("#configure-facility").should("be.visible");
cy.get("#configure-facility").click();
cy.get("#hf_id").click().clear().click().type(hrf_id_2);
cy.get("button#submit").contains("Link Health Facility").click();
cy.get(".pnotify-text")
.should("be.visible")
.and("contain", "Health Facility config updated successfully");
facilityManage.clickFacilityConfigureButton();
facilityManage.typeHrfId(hrf_id_2);
facilityManage.clickButtonWithText("Link Health Facility");
facilityManage.verifySuccessMessageVisibilityAndContent(
"Health Facility config updated successfully"
);
// verify its reflection
facilityPage.clickManageFacilityDropdown();
cy.get("#configure-facility").should("be.visible");
cy.get("#configure-facility").click();
cy.get("#hf_id").should("have.value", hrf_id_2);
facilityManage.clickFacilityConfigureButton();
facilityManage.verifyHrfIdValue(hrf_id_2);
});

afterEach(() => {
Expand Down
37 changes: 37 additions & 0 deletions cypress/pageobject/Facility/FacilityManage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,42 @@ class FacilityManage {
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;

0 comments on commit 36e6191

Please sign in to comment.