Skip to content

Commit

Permalink
Merge pull request #5774 from coronasafe/develop
Browse files Browse the repository at this point in the history
Production Release; June Week 4
  • Loading branch information
mathew-alex committed Jun 23, 2023
2 parents 458563d + 3647374 commit b23ab0b
Show file tree
Hide file tree
Showing 75 changed files with 3,490 additions and 5,353 deletions.
46 changes: 12 additions & 34 deletions cypress/e2e/resource_spec/filter.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,19 @@ describe("Resource filter", () => {
"ASC Modified Date",
"DESC Modified Date",
"ASC Created Date",
].forEach((select) => {
cy.get("[name='ordering']").select(select);
].forEach((option) => {
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((select) => {
cy.get("[name='emergency']").select(select);
["yes", "no"].forEach((option) => {
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();
Expand All @@ -63,42 +65,18 @@ describe("Resource filter", () => {

it("filter by created date", () => {
cy.intercept(/\/api\/v1\/resource/).as("resource_filter");
cy.get("[name='created_date_after']").click();
cy.get(
"[role='button'][aria-label='Move backward to switch to the previous month.']"
).click();
cy.get("td[tabindex='-1']")
.first()
.then(($td) => {
$td[0].click();

cy.get("td[tabindex='-1']")
.eq(14)
.then(($td2) => {
$td2[0].click();
});
});
cy.get("input[name='created_date_start']").click();
cy.get("#date-1").click();
cy.get("#date-1").click();
cy.contains("Apply").click();
cy.wait("@resource_filter");
});

it("filter by modified date", () => {
cy.intercept(/\/api\/v1\/resource/).as("resource_filter");
cy.get("[name='modified_date_after']").click();
cy.get(
"[role='button'][aria-label='Move backward to switch to the previous month.']"
).click();
cy.get("td[tabindex='-1']")
.first()
.then(($td) => {
$td[0].click();

cy.get("td[tabindex='-1']")
.eq(14)
.then(($td2) => {
$td2[0].click();
});
});
cy.get("input[name='modified_date_start']").click();
cy.get("#date-1").click();
cy.get("#date-1").click();
cy.contains("Apply").click();
cy.wait("@resource_filter");
});
Expand Down
118 changes: 103 additions & 15 deletions cypress/e2e/shifting_spec/filter.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,36 @@ describe("Shifting section filter", () => {
it("filter by origin facility", () => {
cy.intercept(/\/api\/v1\/getallfacilities/).as("facilities_filter");
cy.get("[name='orgin_facility']")
.type("Dummy Facility 1")
.wait(100)
.type("Dummy")
.wait("@facilities_filter");
cy.get("[role='option']").first().click();
cy.get("[name='orgin_facility']").wait(100).type("{downarrow}{enter}");
cy.contains("Apply").click();
});

it("filter by assigned facility", () => {
cy.intercept(/\/api\/v1\/getallfacilities/).as("facilities_filter");
cy.get("[name='assigned_facility']")
.type("Dummy Shifting Center")
.wait(100)
.type("Dummy")
.wait("@facilities_filter");
cy.get("[role='option']").first().click();
cy.get("[name='assigned_facility']").wait(100).type("{downarrow}{enter}");
cy.contains("Apply").click();
});

it("filter by assigned to user", () => {
cy.intercept(/\/api\/v1\/users/).as("users_filter");
cy.get("[id='assigned_to']")
cy.get("[id='assigned-to']")
.wait(100)
.type("cypress")
.wait("@users_filter");
cy.get("[id='assigned_to']").wait(100).type("{downarrow}{enter}");
cy.get("[id='assigned-to']").wait(100).type("{downarrow}{enter}");
cy.contains("Apply").click();

// cy.intercept(/\/api\/v1\/users/).as("users_filter");
// cy.get("[name='assigned_to']").type("cypress").wait("@users_filter");
// cy.get("[name='assigned_to']").type("{downarrow}{enter}");
// cy.contains("Apply").click();
});

it("filter by ordering", () => {
Expand All @@ -47,46 +54,115 @@ describe("Shifting section filter", () => {
"DESC Modified Date",
"ASC Created Date",
].forEach((select) => {
cy.get("[name='ordering']").select(select).wait(100);
cy.get("[id='ordering'] > div > button")
.click()
.wait(100)
.get("li")
.contains(select)
.click()
.wait(100);
cy.intercept(/\/api\/v1\/shift/).as("shifting_filter");
cy.contains("Apply").click().wait("@shifting_filter");
cy.contains("Filters").click();
// cy.get("[name='ordering']").select(select).wait(100);
// cy.intercept(/\/api\/v1\/shift/).as("shifting_filter");
// cy.contains("Apply").click().wait("@shifting_filter");
// cy.contains("Filters").click();
});
});

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

it("filter by antenatal", () => {
["yes", "no"].forEach((select) => {
cy.get("[name='is_antenatal']").select(select);
cy.get("[id='is-antenatal'] > div > button")
.click()
.wait(100)
.get("li")
.contains(select)
.click()
.wait(100);
cy.intercept(/\/api\/v1\/shift/).as("shifting_filter");
cy.contains("Apply").click().wait("@shifting_filter");
cy.contains("Filters").click();
// cy.get("[name='is-antenatal']").select(select);
// cy.intercept(/\/api\/v1\/shift/).as("shifting_filter");
// cy.contains("Apply").click().wait("@shifting_filter");
// cy.contains("Filters").click();
});
});

it("filter by upshift case", () => {
["yes", "no"].forEach((select) => {
cy.get("[name='is_up_shift']").select(select);
cy.get("[id='is-up-shift'] > div > button")
.click()
.wait(100)
.get("li")
.contains(select)
.click()
.wait(100);
cy.intercept(/\/api\/v1\/shift/).as("shifting_filter");
cy.contains("Apply").click().wait("@shifting_filter");
cy.contains("Filters").click();
// cy.get("[name='is-up-shift']").select(select);
// cy.intercept(/\/api\/v1\/shift/).as("shifting_filter");
// cy.contains("Apply").click().wait("@shifting_filter");
// cy.contains("Filters").click();
});
});

it("filter by disease status", () => {
["POSITIVE", "SUSPECTED", "NEGATIVE", "RECOVERED"].forEach((select) => {
cy.get("[name='disease_status']").select(select);
cy.get("[id='disease-status'] > div > button")
.click()
.wait(100)
.get("li")
.contains(select)
.click()
.wait(100);
cy.intercept(/\/api\/v1\/shift/).as("shifting_filter");
cy.contains("Apply").click().wait("@shifting_filter");
cy.contains("Filters").click();
// cy.get("[name='disease_status']").select(select);
// cy.intercept(/\/api\/v1\/shift/).as("shifting_filter");
// cy.contains("Apply").click().wait("@shifting_filter");
// cy.contains("Filters").click();
});
});

it("filter by breathlessness level", () => {
["NOT BREATHLESS", "MILD", "MODERATE", "SEVERE"].forEach((select) => {
cy.get("[id='breathlessness-level'] > div > button")
.click()
.wait(100)
.get("li")
.contains(select)
.click()
.wait(100);
cy.intercept(/\/api\/v1\/shift/).as("shifting_filter");
cy.contains("Apply").click().wait("@shifting_filter");
cy.contains("Filters").click();
// cy.get("[name='breathlessness_level']").select(select);
// cy.intercept(/\/api\/v1\/shift/).as("shifting_filter");
// cy.contains("Apply").click().wait("@shifting_filter");
// cy.contains("Filters").click();
});
});

Expand All @@ -103,15 +179,27 @@ describe("Shifting section filter", () => {
});

it("filter by created date", () => {
cy.get("[name='created_date_after']").type("22/05/2020");
cy.get("[name='created_date_before']").type("09/09/2021");
cy.contains("Created Date")
.parent()
.within(() => {
cy.get("input[placeholder='Start date']").click();
cy.contains("1").click();
cy.get("input[placeholder='End date']").click();
cy.contains("21").click();
});
cy.intercept(/\/api\/v1\/shift/).as("shifting_filter");
cy.contains("Apply").click().wait("@shifting_filter");
});

it("filter by modified date", () => {
cy.get("[name='modified_date_after']").type("22/05/2020");
cy.get("[name='modified_date_before']").type("09/09/2021");
cy.contains("Modified Date")
.parent()
.within(() => {
cy.get("input[placeholder='Start date']").click();
cy.contains("1").click();
cy.get("input[placeholder='End date']").click();
cy.contains("21").click();
});
cy.intercept(/\/api\/v1\/shift/).as("shifting_filter");
cy.contains("Apply").click().wait("@shifting_filter");
});
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/users_spec/user_crud.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ describe("User management", () => {
.wait("@getFacilities");
cy.get("li[role='option']").contains("cypress facility").click();
cy.intercept(/\/api\/v1\/users\/\w+\/add_facility\//).as("addFacility");
cy.get("button > span").contains("Add").click();
cy.get("button[id='link-facility']").click();
cy.wait("@addFacility")
// .its("response.statusCode")
// .should("eq", 201)
Expand Down
18 changes: 9 additions & 9 deletions src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -757,28 +757,28 @@ export const CAMERA_STATES = {

export const getCameraPTZ: (precision: number) => CameraPTZ[] = (precision) => [
{
icon: "chevron-up",
icon: "l-angle-up",
label: "Move Up",
action: "up",
loadingLabel: CAMERA_STATES.MOVING.UP,
shortcutKey: ["Control", "Shift", "ArrowUp"],
},
{
icon: "chevron-down",
icon: "l-angle-down",
label: "Move Down",
action: "down",
loadingLabel: CAMERA_STATES.MOVING.DOWN,
shortcutKey: ["Control", "Shift", "ArrowDown"],
},
{
icon: "chevron-left",
icon: "l-angle-left",
label: "Move Left",
action: "left",
loadingLabel: CAMERA_STATES.MOVING.LEFT,
shortcutKey: ["Control", "Shift", "ArrowLeft"],
},
{
icon: "chevron-right",
icon: "l-angle-right",
label: "Move Right",
action: "right",
loadingLabel: CAMERA_STATES.MOVING.RIGHT,
Expand All @@ -792,34 +792,34 @@ export const getCameraPTZ: (precision: number) => CameraPTZ[] = (precision) => [
shortcutKey: ["Shift", "P"],
},
{
icon: "search-plus",
icon: "l-search-plus",
label: "Zoom In",
action: "zoomIn",
loadingLabel: CAMERA_STATES.ZOOMING.IN,
shortcutKey: ["Shift", "I"],
},
{
icon: "search-minus",
icon: "l-search-minus",
label: "Zoom Out",
action: "zoomOut",
loadingLabel: CAMERA_STATES.ZOOMING.OUT,
shortcutKey: ["Shift", "O"],
},
{
icon: "save",
icon: "l-save",
label: "Update Preset",
action: "updatePreset",
loadingLabel: CAMERA_STATES.UPDATING_PRESET,
shortcutKey: ["Shift", "S"],
},
{
icon: "undo",
icon: "l-redo",
label: "Reset",
action: "reset",
shortcutKey: ["Shift", "R"],
},
{
icon: "expand",
icon: "l-expand-arrows-alt",
label: "Full Screen",
action: "fullScreen",
shortcutKey: ["F"],
Expand Down
3 changes: 3 additions & 0 deletions src/Components/Common/DateRangeInputV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type DateRange = {
};

type Props = {
name?: string;
value?: DateRange;
onChange: (value: DateRange) => void;
className?: string;
Expand All @@ -23,6 +24,7 @@ const DateRangeInputV2 = ({ value, onChange, ...props }: Props) => {
<div className="flex gap-2">
<div className="flex-auto">
<DateInputV2
name={props.name + "_start"}
className={props.className}
value={start}
onChange={(start) => {
Expand All @@ -38,6 +40,7 @@ const DateRangeInputV2 = ({ value, onChange, ...props }: Props) => {
</div>
<div className="flex-auto">
<DateInputV2
name={props.name + "_end"}
className={props.className}
value={end}
onChange={(end) => onChange({ start, end })}
Expand Down
Loading

1 comment on commit b23ab0b

@vercel
Copy link

@vercel vercel bot commented on b23ab0b Jun 23, 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-coronasafe.vercel.app
care-storybook-git-master-coronasafe.vercel.app

Please sign in to comment.