Skip to content

Commit

Permalink
Merge branch 'develop' into vitals-gain
Browse files Browse the repository at this point in the history
  • Loading branch information
nihal467 authored Jun 27, 2023
2 parents f398433 + a7fdef2 commit 9f30ce4
Show file tree
Hide file tree
Showing 76 changed files with 1,948 additions and 2,910 deletions.
61 changes: 61 additions & 0 deletions cypress/e2e/assets_spec/asset_tab.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/// <reference types="cypress" />

import { cy, describe, before, beforeEach, it, afterEach } from "local-cypress";
import { AssetSearchPage } from "../../pageobject/Asset/AssetSearch";
import { AssetQRScanPage } from "../../pageobject/Asset/AssetQRScan";
import { AssetPagination } from "../../pageobject/Asset/AssetPagination";
import { AssetFilters } from "../../pageobject/Asset/AssetFilters";

describe("Asset Tab", () => {
const assetSearchPage = new AssetSearchPage();
const assetQRScanPage = new AssetQRScanPage();
const assetPagination = new AssetPagination();
const assetFilters = new AssetFilters();

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

beforeEach(() => {
cy.restoreLocalStorage();
cy.awaitUrl("/assets");
});

// search for a element

it("Search Asset Name", () => {
const initialUrl = cy.url();
assetSearchPage.typeSearchKeyword("dummy camera 30");
assetSearchPage.pressEnter();
assetSearchPage.verifyUrlChanged(initialUrl);
});

// scan a asset qr code

it("Scan Asset QR", () => {
assetQRScanPage.scanAssetQR();
});

// filter the asset and verify the badges are there

it("Filter Asset", () => {
assetFilters.filterAssets(
"Dummy Facility 1",
"INTERNAL",
"ACTIVE",
"ONVIF Camera"
);
});

// Verify the pagination in the page

it("Next/Previous Page", () => {
assetPagination.navigateToNextPage();
assetPagination.navigateToPreviousPage();
});

afterEach(() => {
cy.saveLocalStorage();
});
});
100 changes: 0 additions & 100 deletions cypress/e2e/assets_spec/assets.cy.ts

This file was deleted.

57 changes: 57 additions & 0 deletions cypress/e2e/assets_spec/assets_manage.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/// <reference types="cypress" />
import { AssetPage } from "../../pageobject/Asset/AssetCreation";
import { v4 as uuidv4 } from "uuid";

describe("Asset", () => {
const assetPage = new AssetPage();
const phone_number = "9999999999";
const serialNumber = Math.floor(Math.random() * 10 ** 10).toString();

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

beforeEach(() => {
cy.restoreLocalStorage();
cy.awaitUrl("/assets");
});

//Create an asset

it("Create an Asset", () => {
assetPage.createAsset();
assetPage.selectFacility("Dummy Facility 1");
assetPage.selectLocation("Camera Loc");
assetPage.selectAssetType("Internal");
assetPage.selectAssetClass("ONVIF Camera");

const qr_id = uuidv4();

assetPage.enterAssetDetails(
"New Test Asset",
"Test Description",
"Working",
qr_id,
"Manufacturer's Name",
"2025-12-25",
"Customer Support's Name",
phone_number,
"email@support.com",
"Vendor's Name",
serialNumber,
"2021-12-25",
"Test note for asset creation!"
);

assetPage.clickCreateAsset();

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

// Edit an exisit asset

afterEach(() => {
cy.saveLocalStorage();
});
});
61 changes: 0 additions & 61 deletions cypress/e2e/assets_spec/filter.cy.ts

This file was deleted.

10 changes: 5 additions & 5 deletions cypress/e2e/external_results_spec/external_result.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ describe("Edit Profile Testing", () => {
cy.wait("@external_result").then((interception) => {
expect(interception.response.statusCode).to.equal(200);
});
cy.url().should("include", "%2B91+73874+34255");
cy.url().should("include", "%2B917387434255");
});

it("import", () => {
cy.intercept("POST", "/api/v1/external_result/bulk_upsert").as("import");
cy.get("div").contains("Import/Export").click({ force: true });
cy.get("div").contains("Import Results").click({ force: true });
cy.get("div").contains("Import/Export").click();
cy.get("div").contains("Import Results").click();
cy.get("[id=result-upload]")
.selectFile("cypress/fixtures/external-result_sample.csv")
.selectFile("cypress/fixtures/externalresultsample.csv")
.wait(100);
cy.get("button").contains("Save").click({ force: true });
cy.get("button").contains("Save").click();
cy.wait("@import").then((interception) => {
expect(interception.response.statusCode).to.equal(202);
});
Expand Down
61 changes: 21 additions & 40 deletions cypress/e2e/external_results_spec/filter.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,50 +12,31 @@ describe("External Results Filters", () => {
cy.contains("Filters").click();
});

it("filter by lsg", () => {
cy.get("[placeholder='Select Local Body']")
.type("ernakulam")
.type("{downarrow}{enter}");
it("Advance Filter", () => {
cy.get("#local_bodies").click();
cy.get("[role='option']").should("be.visible");
cy.contains("[role='option']", "Aluva").click();
cy.get("#local_bodies").click();
cy.get("#wards").click();
cy.get("[role='option']").should("be.visible");
cy.contains("[role='option']", "12").click();
cy.contains("Apply").click();
cy.contains("LSG:");
});

it("filter by ward", () => {
cy.get("[placeholder='Select wards']")
.type("ernakulam")
.type("{downarrow}{enter}");
it("filter by date", () => {
cy.get("input[name='created_date_start']").click();
cy.get("[id^='headlessui-popover-panel-'] .care-l-angle-left-b").click();
cy.get("div[id='date-1']").click();
cy.get("div[id='date-8']").click();
cy.get("input[name='result_date_start']").click();
cy.get("[id^='headlessui-popover-panel-'] .care-l-angle-left-b").click();
cy.get("div[id='date-1']").click();
cy.get("div[id='date-8']").click();
cy.get("input[name='sample_collection_date_start']").click();
cy.get("[id^='headlessui-popover-panel-'] .care-l-angle-left-b").click();
cy.get("div[id='date-1']").click();
cy.get("div[id='date-8']").click();
cy.contains("Apply").click();
cy.contains("Ward:");
});

it("filter by created date", () => {
cy.get("[name='created_date_after']").type("2020-12-06");
cy.get("[name='created_date_before']").type("2020-12-31");
cy.contains("Apply").click();
cy.contains("Created after: 2020-12-06");
cy.contains("Created before: 2020-12-31");
});

it("filter by result date", () => {
cy.get("[name='result_date_after']").type("2021-03-02");
cy.get("[name='result_date_before']").type("2021-04-02");
cy.contains("Apply").click();
cy.contains("Result after: 2021-03-02");
cy.contains("Result before: 2021-04-02");
});

it("filter by sample collection date", () => {
cy.get("[name='sample_collection_date_after']").type("2021-01-04");
cy.get("[name='sample_collection_date_before']").type("2021-03-03");
cy.contains("Apply").click();
cy.contains("Sample created after: 2021-01-04");
cy.contains("Sample created before: 2021-03-03");
});

it("filter by srf id", () => {
cy.get("[name='srf_id']").type("432");
cy.contains("Apply").click();
cy.contains("SRF ID: 432");
});

afterEach(() => {
Expand Down
Loading

0 comments on commit 9f30ce4

Please sign in to comment.