Skip to content

Commit

Permalink
Merged with develop barnch and fixed linking of care context
Browse files Browse the repository at this point in the history
  • Loading branch information
shyamprakash123 committed Oct 17, 2023
2 parents c7ff758 + 8ad1353 commit 1cc11f3
Show file tree
Hide file tree
Showing 98 changed files with 2,396 additions and 1,243 deletions.
5 changes: 2 additions & 3 deletions cypress/e2e/assets_spec/asset_homepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe("Asset Tab", () => {
assetFilters.assertAssetTypeText("INTERNAL");
assetFilters.assertAssetClassText("ONVIF");
assetFilters.assertStatusText("ACTIVE");
assetFilters.assertLocationText("Camera Locations");
assetFilters.assertLocationText("Camera Loc");
assetFilters.clickadvancefilter();
assetFilters.clearFilters();
});
Expand All @@ -90,9 +90,8 @@ describe("Asset Tab", () => {
assetPage.selectImportOption();
assetPage.selectImportFacility("Dummy Facility 1");
assetPage.importAssetFile();
assetPage.selectImportLocation("Camera Locations");
assetPage.selectImportLocation("Camera Loc");
assetPage.clickImportAsset();
assetPage.verifySuccessNotification("Assets imported successfully");
});

it("verify imported asset", () => {
Expand Down
33 changes: 33 additions & 0 deletions cypress/e2e/assets_spec/assets_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import { AssetSearchPage } from "../../pageobject/Asset/AssetSearch";
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import { AssetFilters } from "../../pageobject/Asset/AssetFilters";

function addDaysToDate(numberOfDays: number) {
const inputDate = new Date();
inputDate.setDate(inputDate.getDate() + numberOfDays);
return inputDate.toISOString().split("T")[0];
}

describe("Asset", () => {
const assetPage = new AssetPage();
const loginPage = new LoginPage();
Expand All @@ -26,6 +32,33 @@ describe("Asset", () => {
cy.awaitUrl("/assets");
});

it("Verify Asset Warranty Expiry Label", () => {
assetSearchPage.typeSearchKeyword(assetname);
assetSearchPage.pressEnter();
assetSearchPage.verifyBadgeContent(assetname);
assetSearchPage.clickAssetByName(assetname);
assetPage.clickupdatedetailbutton();
assetPage.scrollintoWarrantyDetails();
assetPage.enterWarrantyExpiryDate(addDaysToDate(100)); // greater than 3 months
assetPage.clickassetupdatebutton();
assetPage.verifyWarrantyExpiryLabel("");
assetPage.clickupdatedetailbutton();
assetPage.scrollintoWarrantyDetails();
assetPage.enterWarrantyExpiryDate(addDaysToDate(80)); // less than 3 months
assetPage.clickassetupdatebutton();
assetPage.verifyWarrantyExpiryLabel("3 months");
assetPage.clickupdatedetailbutton();
assetPage.scrollintoWarrantyDetails();
assetPage.enterWarrantyExpiryDate(addDaysToDate(20)); // less than 1 month
assetPage.clickassetupdatebutton();
assetPage.verifyWarrantyExpiryLabel("1 month");
assetPage.clickupdatedetailbutton();
assetPage.scrollintoWarrantyDetails();
assetPage.enterWarrantyExpiryDate(addDaysToDate(100)); // check for greater than 3 months again to verify the label is removed
assetPage.clickassetupdatebutton();
assetPage.verifyWarrantyExpiryLabel("");
});

it("Create & Edit a service history and verify reflection", () => {
assetSearchPage.typeSearchKeyword(assetname);
assetSearchPage.pressEnter();
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 @@ -13,6 +13,7 @@ describe("Location Management Section", () => {
cy.intercept("GET", "**/api/v1/facility/**").as("getFacilities");
cy.get("[id='facility-details']").first().click();
cy.wait("@getFacilities").its("response.statusCode").should("eq", 200);
cy.get("h1.text-3xl.font-bold", { timeout: 10000 }).should("be.visible");
cy.get("#manage-facility-dropdown button").should("be.visible");
cy.get("[id='manage-facility-dropdown']").scrollIntoView().click();
cy.get("[id=location-management]").click();
Expand Down
Binary file modified cypress/fixtures/sampleAsset.xlsx
Binary file not shown.
29 changes: 26 additions & 3 deletions cypress/pageobject/Asset/AssetCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class AssetPage {

configureVitalAsset(hostName: string, localIp: string) {
cy.get("[data-testid=asset-configure-button]").click();
cy.get("#middlewareHostname").type(hostName);
cy.get("#middleware_hostname").type(hostName);
cy.get("#localipAddress").type(localIp);
}

Expand Down Expand Up @@ -285,16 +285,39 @@ export class AssetPage {
cy.get("#notes").scrollIntoView();
}

enterAssetNotes(text) {
enterAssetNotes(text: string) {
cy.get("#notes").click().clear();
cy.get("#notes").click().type(text);
}

enterAssetservicedate(text) {
enterAssetservicedate(text: string) {
cy.get("input[name='last_serviced_on']").click();
cy.get("#date-input").click().type(text);
}

scrollintoWarrantyDetails() {
cy.get("#warranty-details").scrollIntoView();
}

enterWarrantyExpiryDate(text: string) {
cy.get("#WarrantyAMCExpiry").click();
cy.get("#WarrantyAMCExpiry").click().type(text);
}

verifyWarrantyExpiryLabel(duration: string) {
if (duration === "") {
cy.get("#warranty-amc-expired-red").should("not.exist");
cy.get("#warranty-amc-expiring-soon-orange").should("not.exist");
cy.get("#warranty-amc-expiring-soon-yellow").should("not.exist");
} else if (duration === "expired") {
cy.get("#warranty-amc-expired-red").should("be.visible");
} else if (duration === "1 month") {
cy.get("#warranty-amc-expiring-soon-orange").should("be.visible");
} else if (duration === "3 months") {
cy.get("#warranty-amc-expiring-soon-yellow").should("be.visible");
}
}

clickassetupdatebutton() {
cy.get("#submit").click();
}
Expand Down
3 changes: 1 addition & 2 deletions cypress/pageobject/Facility/FacilityCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class FacilityPage {
}

clickManageFacilityDropdown() {
cy.get("h1.text-3xl.font-bold", { timeout: 20000 }).should("be.visible");
cy.get("#manage-facility-dropdown button").scrollIntoView();
cy.get("#manage-facility-dropdown button")
.contains("Manage Facility")
Expand Down Expand Up @@ -198,8 +199,6 @@ class FacilityPage {
cy.intercept("GET", "**/api/v1/facility/**").as("getManagePage");
cy.go("back");
cy.wait("@getManagePage").its("response.statusCode").should("eq", 200);
cy.get("#manage-facility-dropdown").scrollIntoView();
cy.get("#manage-facility-dropdown").should("exist");
}

verifyfacilityviewassetredirection() {
Expand Down
4 changes: 2 additions & 2 deletions cypress/pageobject/Patient/PatientConsultation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ export class PatientConsultationPage {
.click()
.type("1A");
cy.get("#icd11_diagnoses_object [role='option']")
.contains("1A03 Intestinal infections due to Escherichia coli")
.contains("1A00 Cholera")
.scrollIntoView()
.click();
cy.get("label[for='icd11_diagnoses_object']").click();
cy.wait("@getIcdResults").its("response.statusCode").should("eq", 200);

cy.get("#icd11_principal_diagnosis [role='combobox']").click().type("1A");
cy.get("#icd11_principal_diagnosis [role='option']")
.contains("1A03 Intestinal infections due to Escherichia coli")
.contains("1A00 Cholera")
.click();

cy.get("#consultation_notes").click().type(consulationNotes);
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Cypress.Commands.add(

Cypress.Commands.add("verifyNotification", (text) => {
cy.get(".pnotify-container").should("exist").contains(text);
return cy.get(".pnotify-container").click({ force: true });
return cy.get(".pnotify-container").contains(text).click({ force: true });
});

Cypress.on("uncaught:exception", () => {
Expand Down
Loading

0 comments on commit 1cc11f3

Please sign in to comment.