Skip to content

Commit

Permalink
facility update
Browse files Browse the repository at this point in the history
  • Loading branch information
nihal467 committed Dec 4, 2023
1 parent 9fea2d8 commit 57796b4
Showing 1 changed file with 31 additions and 14 deletions.
45 changes: 31 additions & 14 deletions cypress/e2e/facility_spec/facility_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ describe("Facility Creation", () => {
const doctorCapacity = "5";
const totalDoctor = "10";
const facilityName = "cypress facility";
const facilityName2 = "Dummy Request Approving Center";
const facilityAddress = "cypress address";
const facilityUpdateAddress = "cypress updated address";
const facilityNumber = "9898469865";
const facilityErrorMessage = [
"Required",
Expand Down Expand Up @@ -61,6 +63,35 @@ describe("Facility Creation", () => {
cy.awaitUrl("/facility");
});

it("Update the existing facility", () => {
// update a existing dummy data facility
manageUserPage.typeFacilitySearch(facilityName2);
facilityPage.verifyFacilityBadgeContent(facilityName2);
manageUserPage.assertFacilityInCard(facilityName2);
facilityHome.verifyURLContains(facilityName2);
facilityPage.visitAlreadyCreatedFacility();
facilityPage.clickManageFacilityDropdown();
facilityPage.clickUpdateFacilityOption();
facilityPage.clickUpdateFacilityType("Govt Hospital");
facilityPage.fillAddress(facilityUpdateAddress);
facilityPage.fillOxygenCapacity(oxygenCapacity);
facilityPage.fillExpectedOxygenRequirement(oxygenExpected);
facilityPage.selectLocation("Kochi, Kerala");
facilityPage.submitForm();
cy.url().should("not.include", "/update");
// verify the updated data
facilityPage.getFacilityOxygenInfo().scrollIntoView();
facilityPage
.getFacilityOxygenInfo()
.contains(oxygenCapacity)
.should("be.visible");
facilityPage.getAddressDetailsView().scrollIntoView();
facilityPage
.getAddressDetailsView()
.contains(facilityUpdateAddress)
.should("be.visible");
});

it("Create a new facility with multiple bed and doctor capacity", () => {
// create facility with multiple capacity and verify form error message for facility form
facilityPage.visitCreateFacilityPage();
Expand Down Expand Up @@ -209,20 +240,6 @@ describe("Facility Creation", () => {
.should("be.visible");
});

it("Update the existing facility", () => {
facilityPage.visitUpdateFacilityPage(facilityUrl1);
facilityPage.clickManageFacilityDropdown();
facilityPage.clickUpdateFacilityOption();
facilityPage.clickUpdateFacilityType("Request Approving Center");
facilityPage.fillFacilityName("cypress facility updated");
facilityPage.fillAddress("Cypress Facility Updated Address");
facilityPage.fillOxygenCapacity("100");
facilityPage.fillExpectedOxygenRequirement("80");
facilityPage.selectLocation("Kochi, Kerala");
facilityPage.submitForm();
cy.url().should("not.include", "/update");
});

it("Configure the existing facility", () => {
facilityPage.visitUpdateFacilityPage(facilityUrl1);
facilityPage.clickManageFacilityDropdown();
Expand Down

0 comments on commit 57796b4

Please sign in to comment.