Skip to content

Commit

Permalink
Merge branch 'pressure-pop-up' of github.com:sghosh28/care_fe into pr…
Browse files Browse the repository at this point in the history
…essure-pop-up
  • Loading branch information
sghosh28 committed Aug 29, 2023
2 parents 19eae95 + ed9976b commit d2827e5
Show file tree
Hide file tree
Showing 409 changed files with 28,498 additions and 36,334 deletions.
40 changes: 40 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node
{
"name": "care_fe",
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-18-bullseye",
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
"moby": true,
"installDockerBuildx": true,
"version": "latest",
"dockerDashComposeVersion": "v2"
}
},
"customizations": {
"vscode": {
"settings": {},
"extensions": [
"esbenp.prettier-vscode",
"bradlc.vscode-tailwindcss",
"yoavbls.pretty-ts-errors",
"chenglou92.rescript-vscode"
]
}
},
"hostRequirements": {
"cpus": 4
},
"waitFor": "onCreateCommand",
"postCreateCommand": "npm install",
"postAttachCommand": {
"server": "npm run dev"
},
"portsAttributes": {
"4000": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [4000]
}
11 changes: 9 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"plugin:prettier/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:i18next/recommended"
"plugin:i18next/recommended",
"plugin:tailwindcss/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
Expand Down Expand Up @@ -53,8 +54,14 @@
"exclude": [".*"]
}
}
]
],
"tailwindcss/no-custom-classname": "off",
"tailwindcss/migration-from-tailwind-2": "error",
"tailwindcss/classnames-order": "error",
"tailwindcss/enforces-shorthand": "error",
"tailwindcss/no-contradicting-classname": "error"
},

"ignorePatterns": [
"dist",
"public",
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/cypress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:

jobs:
cypress-run:
permissions: write-all
if: github.repository == 'coronasafe/care_fe'
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -51,13 +52,27 @@ jobs:
start: "npx vite preview --host"
wait-on: "http://localhost:4000"
wait-on-timeout: 300
browser: electron
browser: chrome
record: true
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: --max_old_space_size=4096

- name: Remove cypress passed label on failure 🏷️
uses: actions-ecosystem/action-remove-labels@v1
if: failure()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: cypress passed

- name: Add cypress passed label on success 🏷️
uses: actions-ecosystem/action-add-labels@v1
if: success()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: cypress passed

- name: Remove cypress failed label on success 🏷️
uses: actions-ecosystem/action-remove-labels@v1
if: success()
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('yarn.lock', '.yarnrc.yml', 'Dockerfile') }}
key: ${{ runner.os }}-buildx-${{ hashFiles('package-lock.json', 'Dockerfile') }}
restore-keys: |
${{ runner.os }}-buildx-
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('yarn.lock', '.yarnrc.yml', 'Dockerfile') }}
key: ${{ runner.os }}-buildx-${{ hashFiles('package-lock.json', 'Dockerfile') }}
restore-keys: |
${{ runner.os }}-buildx-
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('yarn.lock', '.yarnrc.yml', 'Dockerfile') }}
key: ${{ runner.os }}-buildx-${{ hashFiles('package-lock.json', 'Dockerfile') }}
restore-keys: |
${{ runner.os }}-buildx-
Expand Down Expand Up @@ -210,7 +210,7 @@ jobs:
credentials: ${{ secrets.GKE_SA_KEY }}

- name: install kubectl
uses: azure/setup-kubectl@v2.0
uses: azure/setup-kubectl@v3.0
with:
version: "v1.23.6"
id: install
Expand Down Expand Up @@ -252,7 +252,7 @@ jobs:
credentials: ${{ secrets.GKE_SA_KEY }}

- name: install kubectl
uses: azure/setup-kubectl@v2.0
uses: azure/setup-kubectl@v3.0
with:
version: "v1.23.6"
id: install
Expand Down Expand Up @@ -294,7 +294,7 @@ jobs:
credentials: ${{ secrets.GKE_SA_KEY }}

- name: install kubectl
uses: azure/setup-kubectl@v2.0
uses: azure/setup-kubectl@v3.0
with:
version: "v1.23.6"
id: install
Expand Down Expand Up @@ -336,7 +336,7 @@ jobs:
credentials: ${{ secrets.GKE_SA_KEY }}

- name: install kubectl
uses: azure/setup-kubectl@v2.0
uses: azure/setup-kubectl@v3.0
with:
version: "v1.23.6"
id: install
Expand Down Expand Up @@ -378,7 +378,7 @@ jobs:
credentials: ${{ secrets.GKE_SA_KEY }}

- name: install kubectl
uses: azure/setup-kubectl@v2.0
uses: azure/setup-kubectl@v3.0
with:
version: "v1.23.6"
id: install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ossar-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ jobs:

# Upload results to the Security tab
- name: Upload OSSAR results
uses: github/codeql-action/upload-sarif@v1
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: ${{ steps.ossar.outputs.sarifFile }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ storybook-static
.swp
stats.json
public/build-meta.json
.vscode
.vscode/*
!.vscode/launch.json


# Reason React
Expand Down
18 changes: 12 additions & 6 deletions .husky/_/husky.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/bin/sh
#!/usr/bin/env sh
if [ -z "$husky_skip_init" ]; then
debug () {
[ "$HUSKY_DEBUG" = "1" ] && echo "husky (debug) - $1"
if [ "$HUSKY_DEBUG" = "1" ]; then
echo "husky (debug) - $1"
fi
}

readonly hook_name="$(basename "$0")"
readonly hook_name="$(basename -- "$0")"
debug "starting $hook_name..."

if [ "$HUSKY" = "0" ]; then
Expand All @@ -17,14 +19,18 @@ if [ -z "$husky_skip_init" ]; then
. ~/.huskyrc
fi

export readonly husky_skip_init=1
readonly husky_skip_init=1
export husky_skip_init
sh -e "$0" "$@"
exitCode="$?"

if [ $exitCode != 0 ]; then
echo "husky - $hook_name hook exited with code $exitCode (error)"
exit $exitCode
fi

exit 0
if [ $exitCode = 127 ]; then
echo "husky - command not found in PATH=$PATH"
fi

exit $exitCode
fi
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"tabWidth": 2,
"semi": true,
"jsxSingleQuote": false,
"arrowParens": "always"
"arrowParens": "always",
"tailwindFunctions": ["classNames"]
}
23 changes: 23 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Run application",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run-script",
"dev"
],
"skipFiles": [
"<node_internals>/**"
]
}
]
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ Authenticate to staging API with any of the following credentials
password: Coronasafe@123
role: District Admin

- username: staff-dev
- username: staffdev
password: Coronasafe@123
role: Staff

- username: doc-dev
- username: doctordev
password: Coronasafe@123
role: Doctor
```
Expand Down
9 changes: 5 additions & 4 deletions bsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"reason": {
"react-jsx": 3
},
"bsc-flags": ["-bs-super-errors"],
"bsc-flags": [
"-bs-super-errors"
],
"sources": [
{
"dir": "src",
Expand All @@ -20,12 +22,11 @@
"bs-dependencies": [
"@rescript/react",
"@glennsl/bs-json",
"rescript-webapi",
"rescript-material-ui"
"rescript-webapi"
],
"ppx-flags": [],
"refmt": 3,
"gentypeconfig": {
"language": "typescript"
}
}
}
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();
});
});
Loading

0 comments on commit d2827e5

Please sign in to comment.