Skip to content

Commit

Permalink
Merge pull request #6849 from coronasafe/develop
Browse files Browse the repository at this point in the history
Production Release | Dec Week 2
  • Loading branch information
gigincg authored Dec 11, 2023
2 parents cfe74b8 + bd1f144 commit 801e8a0
Show file tree
Hide file tree
Showing 94 changed files with 2,160 additions and 2,023 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
1 change: 1 addition & 0 deletions cypress/e2e/facility_spec/facility_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,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
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
3 changes: 3 additions & 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 All @@ -23,6 +24,8 @@ describe("Location Management Section", () => {
cy.contains("Add New Location").click();
cy.get("[name='name']").type("Test Location");
cy.get("textarea[name='description']").type("Test Description");
cy.get("#location-type").click();
cy.get("#location-type-option-ICU").click();
cy.intercept(/\/api\/v1\/facility\/[\w-]+\/asset_location\//).as(
"addLocation"
);
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
4 changes: 4 additions & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,7 @@ Cypress.Commands.add("getAttached", (selector) => {
})
.then(() => cy.wrap($el));
});

Cypress.Commands.add("clearAllFilters", () => {
return cy.get("#clear-all-filters").click();
});
2 changes: 2 additions & 0 deletions cypress/support/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ declare global {
url: string,
disableLoginVerification?: boolean
): Chainable<Subject>;
getAttached(selector: string): Chainable<Subject>;
clearAllFilters(): Chainable<Subject>;
}
}
}
2 changes: 1 addition & 1 deletion cypress/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"baseUrl": "../node_modules",
"target": "es5",
"lib": ["es5", "dom"],
"lib": ["es5", "dom", "es2015", "es2016", "es2017", "es2018", "es2019", "es2020"],
"types": ["cypress"],
"typeRoots": ["./support"],
"resolveJsonModule": true
Expand Down
3 changes: 3 additions & 0 deletions public/External-Results-Template.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
District,srf id,name,age,age in,gender,mobile number,address,ward,local body,local body type,source,Sample Collection Date,result date,test type,lab name,sample type,patient status,Is Repeat,patient category,result
Ernakulam,00/EKM/0000,Bodhi CSN,24,years,m,8888888888,"CSN HQ
Kochi, Kerala ",7,Poothrikka,grama panchayath,Secondary contact aparna,2020-10-14,2020-10-14,Antigen,Karothukuzhi Laboratory,Ag-SD_Biosensor_Standard_Q_COVID-19_Ag_detection_kit,Asymptomatic,NO,Cat 17: All individuals who wish to get themselves tested,Negative
2 changes: 1 addition & 1 deletion public/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"kasp_string": "KASP",
"kasp_full_string": "Karunya Arogya Suraksha Padhathi",
"sample_format_asset_import": "https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=11JaEhNHdyCHth4YQs_44YaRlP77Rrqe81VSEfg1glko&exportFormat=xlsx",
"sample_format_external_result_import": "https://docs.google.com/spreadsheets/d/17VfgryA6OYSYgtQZeXU9mp7kNvLySeEawvnLBO_1nuE/export?format=csv&id=17VfgryA6OYSYgtQZeXU9mp7kNvLySeEawvnLBO_1nuE",
"sample_format_external_result_import": "/External-Results-Template.csv",
"enable_abdm": true
}
57 changes: 57 additions & 0 deletions src/CAREUI/display/NetworkSignal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { classNames } from "../../Utils/utils";
import CareIcon from "../icons/CareIcon";

interface Props {
/**
* Strength of the signal, from 0 to 3
*
* undefined: Error
* 0: No signal
* 1: Weak signal
* 2: Medium signal
* 3: Strong signal
*/
strength?: number;
children?: React.ReactNode;
}

export default function NetworkSignal({ strength, children }: Props) {
return (
<div
className={classNames(
"flex items-center", // Strength colors
strength === 0 && "text-danger-500",
strength === 1 && "text-danger-500",
strength === 2 && "text-warning-500",
strength === 3 && "text-primary-500"
)}
>
<div className="flex items-end gap-0.5 p-2">
{strength === undefined ? (
<CareIcon
icon="l-exclamation-triangle"
className="text-lg text-danger-500"
/>
) : (
Array.from({ length: 3 }, (_, i) => (
<div
key={i}
className={classNames(
"w-1 rounded-sm",

// Heights
i === 0 && "h-[5px]",
i === 1 && "h-[10px]",
i === 2 && "h-[15px]",

// Whether to infill with strength color or not
strength > i ? "bg-current" : "bg-zinc-600"
)}
/>
))
)}
</div>
{children}
</div>
);
}
Loading

1 comment on commit 801e8a0

@vercel
Copy link

@vercel vercel bot commented on 801e8a0 Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

care-storybook – ./

care-storybook-ohcnetwork.vercel.app
care-storybook-git-master-ohcnetwork.vercel.app

Please sign in to comment.