Skip to content

Commit

Permalink
Merge branch 'develop' into AssetsDatePicker
Browse files Browse the repository at this point in the history
  • Loading branch information
suprabathk authored Sep 9, 2023
2 parents 41ba0df + fb4e7be commit d9e46c8
Show file tree
Hide file tree
Showing 40 changed files with 1,205 additions and 314 deletions.
68 changes: 66 additions & 2 deletions cypress/e2e/assets_spec/assets_manage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/// <reference types="cypress" />
import { afterEach, before, beforeEach, cy, describe, it } from "local-cypress";
import { AssetPage } from "../../pageobject/Asset/AssetCreation";
import { v4 as uuidv4 } from "uuid";
import LoginPage from "../../pageobject/Login/LoginPage";
Expand Down Expand Up @@ -84,7 +85,9 @@ describe("Asset", () => {
"Test note for asset creation!"
);

assetPage.interceptAssetCreation();
assetPage.clickCreateAsset();
assetPage.verifyAssetCreation();
assetPage.verifySuccessNotification("Asset created successfully");

assetSearchPage.typeSearchKeyword("New Test Asset 2");
Expand All @@ -104,19 +107,80 @@ describe("Asset", () => {
"Manufacturer's Name Edited",
"Customer Support's Name Edited",
"Vendor's Name Edited",
"Test note for asset creation edited!"
"Test note for asset creation edited!",
"25122021"
);

assetPage.clickUpdateAsset();

assetPage.verifySuccessNotification("Asset updated successfully");
});

it("Configure an asset", () => {
assetPage.openCreatedAsset();
assetPage.spyAssetConfigureApi();
assetPage.configureAsset(
"Host name",
"192.168.1.64",
"remote_user",
"2jCkrCRSeahzKEU",
"d5694af2-21e2-4a39-9bad-2fb98d9818bd"
);
assetPage.clickConfigureAsset();
assetPage.verifyAssetConfiguration(200);
});

it("Add an vital monitor asset and configure it", () => {
assetPage.createAsset();
assetPage.selectFacility("Dummy Facility 1");
assetPage.selectLocation("Camera Loc");
assetPage.selectAssetType("Internal");
assetPage.selectAssetClass("HL7 Vitals Monitor");

const qr_id_1 = uuidv4();

assetPage.enterAssetDetails(
"New Test Asset Vital",
"Test Description",
"Working",
qr_id_1,
"Manufacturer's Name",
"2025-12-25",
"Customer Support's Name",
phone_number,
"[email protected]",
"Vendor's Name",
serialNumber,
"25122021",
"Test note for asset creation!"
);
assetPage.interceptAssetCreation();
assetPage.clickCreateAsset();
assetPage.verifyAssetCreation();

assetSearchPage.typeSearchKeyword("New Test Asset Vital");
assetSearchPage.pressEnter();

assetPage.openCreatedAsset();
assetPage.configureVitalAsset("Host name", "192.168.1.64");
assetPage.clickConfigureVital();
});

it("Delete an Asset", () => {
assetPage.openCreatedAsset();
assetPage.interceptDeleteAssetApi();
assetPage.deleteAsset();
assetPage.verifyDeleteStatus();
});

it("Import new asset", () => {
assetPage.selectImportOption();
assetPage.selectImportFacility("Dummy Facility 1");
assetPage.importAssetFile();
assetPage.selectImportLocation("Camera Locations");
assetPage.clickImportAsset();

assetPage.verifySuccessNotification("Asset deleted successfully");
assetPage.verifySuccessNotification("Assets imported successfully");
});

afterEach(() => {
Expand Down
41 changes: 40 additions & 1 deletion cypress/e2e/facility_spec/facility.cy.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
// FacilityCreation
import { cy, describe, before, beforeEach, it, afterEach } from "local-cypress";
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import LoginPage from "../../pageobject/Login/LoginPage";

describe("Facility Creation", () => {
let facilityUrl: string;
const facilityPage = new FacilityPage();
const loginPage = new LoginPage();
const phone_number = "9999999999";

before(() => {
cy.loginByApi("devdistrictadmin", "Coronasafe@123");
loginPage.loginAsDisctrictAdmin();
cy.saveLocalStorage();
});

Expand Down Expand Up @@ -51,6 +55,7 @@ describe("Facility Creation", () => {
facilityPage.visitUpdateFacilityPage(facilityUrl);
facilityPage.clickManageFacilityDropdown();
facilityPage.clickUpdateFacilityOption();
facilityPage.clickUpdateFacilityType();
facilityPage.fillFacilityName("cypress facility updated");
facilityPage.fillAddress("Cypress Facility Updated Address");
facilityPage.fillOxygenCapacity("100");
Expand All @@ -61,6 +66,40 @@ describe("Facility Creation", () => {
cy.url().should("not.include", "/update");
});

it("Configure the existing facility", () => {
facilityPage.visitUpdateFacilityPage(facilityUrl);
facilityPage.clickManageFacilityDropdown();
facilityPage.clickConfigureFacilityOption();
facilityPage.fillMiddleWareAddress("dev_middleware.coronasafe.live");
facilityPage.clickupdateMiddleWare();
facilityPage.verifySuccessNotification("Facility updated successfully");
});

it("Create a resource request", () => {
facilityPage.visitUpdateFacilityPage(facilityUrl);
facilityPage.clickManageFacilityDropdown();
facilityPage.clickResourceRequestOption();
facilityPage.fillResourceRequestDetails(
"Test User",
phone_number,
"cypress",
"Test title",
"10",
"Test description"
);
facilityPage.clickSubmitRequestButton();
facilityPage.verifySuccessNotification(
"Resource request created successfully"
);
});

it("Delete a facility", () => {
facilityPage.visitUpdateFacilityPage(facilityUrl);
facilityPage.clickManageFacilityDropdown();
facilityPage.clickDeleteFacilityOption();
facilityPage.confirmDeleteFacility();
});

afterEach(() => {
cy.saveLocalStorage();
});
Expand Down
28 changes: 13 additions & 15 deletions cypress/e2e/facility_spec/inventory.cy.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
import { cy, describe, before, beforeEach, it, afterEach } from "local-cypress";
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import LoginPage from "../../pageobject/Login/LoginPage";

describe("Inventory Management Section", () => {
const facilityPage = new FacilityPage();
const loginPage = new LoginPage();

before(() => {
cy.loginByApi("devdistrictadmin", "Coronasafe@123");
loginPage.loginAsDisctrictAdmin();
cy.saveLocalStorage();
});

beforeEach(() => {
cy.restoreLocalStorage();
cy.awaitUrl("/");
cy.viewport(1280, 720);
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("#manage-facility-dropdown button").should("be.visible");
cy.get("[id='manage-facility-dropdown']").scrollIntoView().click();
cy.get("[id=inventory-management]").click();
});

it("Adds Inventory", () => {
cy.contains("Manage Inventory").click();
cy.get("div#id").click();
cy.get("div#id ul li").contains("Liquid Oxygen").click();
cy.get("div#isIncoming").click();
cy.get("div#isIncoming ul li").contains("Add Stock").click();
cy.get("[name='quantity']").type("120");
cy.get("button").contains("Add/Update Inventory").click();
cy.verifyNotification("Inventory created successfully");
facilityPage.visitAlreadyCreatedFacility();
facilityPage.clickManageFacilityDropdown();
facilityPage.clickInventoryManagementOption();
facilityPage.clickManageInventory();
facilityPage.fillInventoryDetails("Liquid Oxygen", "Add Stock", "120");
facilityPage.clickAddInventory();
facilityPage.verifySuccessNotification("Inventory created successfully");
});

afterEach(() => {
Expand Down
Loading

0 comments on commit d9e46c8

Please sign in to comment.