Skip to content

Commit

Permalink
Merge branch 'develop' into changingCreatedAtToMeasuredAt
Browse files Browse the repository at this point in the history
  • Loading branch information
shyamprakash123 authored Dec 9, 2023
2 parents 4d598bf + 896f51b commit 4744da4
Show file tree
Hide file tree
Showing 95 changed files with 2,235 additions and 2,029 deletions.
3 changes: 2 additions & 1 deletion cypress/e2e/assets_spec/asset_homepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ describe("Asset Tab", () => {

beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/assets");
});

Expand Down Expand Up @@ -90,7 +91,7 @@ describe("Asset Tab", () => {
assetPage.selectImportOption();
assetPage.selectImportFacility("Dummy Facility 1");
assetPage.importAssetFile();
assetPage.selectImportLocation("Camera Locations");
assetPage.selectImportLocation("Camera Loc");
assetPage.clickImportAsset();
});

Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/assets_spec/assets_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe("Asset", () => {

beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/assets");
});

Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/assets_spec/assets_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ describe("Asset", () => {

beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/assets");
});

Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/death_report_spec/death_report.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe("Death Report", () => {

beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/");
cy.intercept("**/api/v1/patient/**").as("getPatients");
cy.get("#facility-patients").contains("Patients").click({ force: true });
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/external_results_spec/external_result.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe("Edit Profile Testing", () => {

beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/external_results");
});

Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/external_results_spec/filter.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ describe("External Results Filters", () => {

beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/external_results");
cy.contains("Filters").click();
});
Expand Down
70 changes: 65 additions & 5 deletions cypress/e2e/facility_spec/facility_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ describe("Facility Creation", () => {
const doctorCapacity = "5";
const totalDoctor = "10";
const facilityName = "cypress facility";
const facilityName2 = "Dummy Facility 1";
const facilityAddress = "cypress address";
const facilityUpdateAddress = "cypress updated address";
const facilityNumber = "9898469865";
const triageDate = "02122023";
const initialTriageValue = "60";
const modifiedTriageValue = "50";
const facilityErrorMessage = [
"Required",
"Invalid Pincode",
Expand All @@ -49,6 +54,7 @@ describe("Facility Creation", () => {
"Field is required",
];
const doctorErrorMessage = ["Field is required", "Field is required"];
const triageErrorMessage = ["Field is required"];

before(() => {
loginPage.loginAsDisctrictAdmin();
Expand All @@ -61,6 +67,48 @@ describe("Facility Creation", () => {
cy.awaitUrl("/facility");
});

it("Verify Facility Triage Function", () => {
// mandatory field error throw
manageUserPage.typeFacilitySearch(facilityName2);
facilityPage.verifyFacilityBadgeContent(facilityName2);
manageUserPage.assertFacilityInCard(facilityName2);
facilityHome.verifyURLContains(facilityName2);
facilityPage.visitAlreadyCreatedFacility();
facilityPage.scrollToFacilityTriage();
facilityPage.clickAddFacilityTriage();
manageUserPage.clickSubmit();
userCreationPage.verifyErrorMessages(triageErrorMessage);
// create a entry and verify reflection
facilityPage.fillEntryDate(triageDate);
facilityPage.fillTriageEntryFields(
initialTriageValue,
initialTriageValue,
initialTriageValue,
initialTriageValue,
initialTriageValue
);
manageUserPage.clickSubmit();
// edit the entry and verify reflection
facilityPage.scrollToFacilityTriage();
facilityPage.verifyTriageTableContains(initialTriageValue);
facilityPage.clickEditButton();
facilityPage.fillTriageEntryFields(
modifiedTriageValue,
modifiedTriageValue,
modifiedTriageValue,
modifiedTriageValue,
modifiedTriageValue
);
manageUserPage.clickSubmit();
facilityPage.scrollToFacilityTriage();
facilityPage.verifyTriageTableContains(modifiedTriageValue);
// validate error of filling data on same date already data exist and verify reflection
facilityPage.scrollToFacilityTriage();
facilityPage.clickAddFacilityTriage();
facilityPage.fillEntryDate(triageDate);
facilityPage.clickButtonsMultipleTimes("button#submit");
});

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 @@ -169,6 +217,7 @@ describe("Facility Creation", () => {
.should("be.visible");
// verify the facility homepage
cy.visit("/facility");
cy.clearAllFilters();
manageUserPage.typeFacilitySearch(facilityName);
facilityPage.verifyFacilityBadgeContent(facilityName);
manageUserPage.assertFacilityInCard(facilityName);
Expand Down Expand Up @@ -210,17 +259,28 @@ describe("Facility Creation", () => {
});

it("Update the existing facility", () => {
// update a existing dummy data 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.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("Configure the existing facility", () => {
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/facility_spec/inventory.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ describe("Inventory Management Section", () => {

beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/");
cy.viewport(1280, 720);
});
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/facility_spec/locations.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ describe("Location Management Section", () => {
beforeEach(() => {
cy.viewport(1280, 720);
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/");
cy.intercept("GET", "**/api/v1/facility/**").as("getFacilities");
cy.get("[id='facility-details']").first().click();
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/patient_spec/patient_crud.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ describe("Patient Creation with consultation", () => {

beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/patients");
});

Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/patient_spec/patient_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe("Patient", () => {

beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/patients");
});

Expand Down
14 changes: 9 additions & 5 deletions cypress/e2e/resource_spec/filter.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ describe("Resource filter", () => {

beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/resource");
cy.contains("Filters").click();
});

it("filter by origin facility", () => {
cy.intercept(/\/api\/v1\/getallfacilities/).as("facilities_filter");
cy.contains("Filters").click();
cy.get("[name='origin_facility']")
.type("Dummy Facility 1")
.wait("@facilities_filter");
Expand All @@ -23,6 +24,7 @@ describe("Resource filter", () => {

it("filter by resource approval facility", () => {
cy.intercept(/\/api\/v1\/getallfacilities/).as("facilities_filter");
cy.contains("Filters").click();
cy.get("[name='approving_facility']")
.type("Dummy Shifting Center")
.wait("@facilities_filter");
Expand All @@ -32,6 +34,7 @@ describe("Resource filter", () => {

it("filter by assigned facility", () => {
cy.intercept(/\/api\/v1\/getallfacilities/).as("facilities_filter");
cy.contains("Filters").click();
cy.get("[name='assigned_facility']").type("Dummy Shifting Center");
cy.wait("@facilities_filter");
cy.get("[role='option']").first().click();
Expand All @@ -45,26 +48,27 @@ describe("Resource filter", () => {
"DESC Modified Date",
"ASC Created Date",
].forEach((option) => {
cy.contains("Filters").click();
cy.get("div [id='ordering'] > div > button").click();
cy.get("li").contains(option).click();
cy.intercept(/\/api\/v1\/resource/).as("resource_filter");
cy.contains("Apply").click().wait("@resource_filter");
cy.contains("Filters").click();
});
});

it("filter by emergency case", () => {
["yes", "no"].forEach((option) => {
cy.contains("Filters").click();
cy.get("div [id='emergency'] > div > button").click();
cy.get("li").contains(option).click();
cy.intercept(/\/api\/v1\/resource/).as("resource_filter");
cy.contains("Apply").click().wait("@resource_filter");
cy.contains("Filters").click();
});
});

it("filter by created date", () => {
cy.intercept(/\/api\/v1\/resource/).as("resource_filter");
cy.contains("Filters").click();
cy.get("input[name='created_date_start']").click();
cy.get("#date-1").click();
cy.get("#date-1").click();
Expand All @@ -74,6 +78,7 @@ describe("Resource filter", () => {

it("filter by modified date", () => {
cy.intercept(/\/api\/v1\/resource/).as("resource_filter");
cy.contains("Filters").click();
cy.get("input[name='modified_date_start']").click();
cy.get("#date-1").click();
cy.get("#date-1").click();
Expand All @@ -82,8 +87,7 @@ describe("Resource filter", () => {
});

afterEach(() => {
cy.contains("Filters").click({ force: true });
cy.contains("Clear").click();
cy.clearAllFilters();
cy.saveLocalStorage();
});
});
1 change: 1 addition & 0 deletions cypress/e2e/resource_spec/resources.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ describe("Resource Page", () => {

beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/resource");
});

Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/sample_test_spec/filter.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ describe("Sample Filter", () => {

beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/sample");
cy.contains("Advanced Filters").click();
});
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/sample_test_spec/sample_test.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ describe("Sample List", () => {

beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/sample");
});

Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/shifting_spec/filter.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe("Shifting section filter", () => {

beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/shifting");
shiftingPage.advancedFilterButton().click();
});
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/shifting_spec/shifting.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ describe("Shifting Page", () => {

beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/shifting");
});

Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/users_spec/user_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ describe("User Creation", () => {

beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/users");
});

Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/users_spec/user_homepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe("User Homepage", () => {

beforeEach(() => {
cy.restoreLocalStorage();
cy.clearLocalStorage(/filters--.+/);
cy.awaitUrl("/users");
});

Expand Down
3 changes: 3 additions & 0 deletions cypress/e2e/users_spec/user_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ describe("Manage User", () => {

beforeEach(() => {
cy.restoreLocalStorage();
console.log(localStorage);
cy.clearLocalStorage(/filters--.+/);
console.log(localStorage);
cy.awaitUrl("/users");
});

Expand Down
4 changes: 2 additions & 2 deletions cypress/pageobject/Asset/AssetCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export class AssetPage {
}

selectjsonexportbutton() {
cy.intercept("GET", "**/api/v1/asset/?json=true**").as("getJsonexport");
cy.intercept("GET", "**/api/v1/asset/?**json=true**").as("getJsonexport");
cy.get("#export-json-option").click();
cy.wait("@getJsonexport").then(({ request, response }) => {
expect(response.statusCode).to.eq(200);
Expand All @@ -248,7 +248,7 @@ export class AssetPage {
}

selectcsvexportbutton() {
cy.intercept("GET", "**/api/v1/asset/?csv=true**").as("getCsvexport");
cy.intercept("GET", "**/api/v1/asset/?**csv=true**").as("getCsvexport");
cy.get("#export-csv-option").click();
cy.wait("@getCsvexport").then(({ request, response }) => {
expect(response.statusCode).to.eq(200);
Expand Down
15 changes: 14 additions & 1 deletion cypress/pageobject/Asset/AssetFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,20 @@ export class AssetFilters {
cy.intercept("GET", "**/api/v1/asset/**").as("clearAssets");
cy.get("#clear-filter").click();
cy.wait("@clearAssets").its("response.statusCode").should("eq", 200);
cy.url().should("match", /\/assets$/);
cy.location("pathname").should("match", /\/assets$/);
cy.url().then((url) => {
const queryParams = new URL(url).searchParams;
let allEmpty = true;
const blacklistedKeys = ["page", "limit", "offset"];

queryParams.forEach((value, key) => {
if (value !== "" && !blacklistedKeys.includes(key)) {
allEmpty = false;
}
});

expect(allEmpty).to.be.true;
});
}
clickadvancefilter() {
cy.intercept("GET", "**/api/v1/getallfacilities/**").as("advancefilter");
Expand Down
Loading

0 comments on commit 4744da4

Please sign in to comment.