Skip to content

Commit

Permalink
Merge pull request #6295 from coronasafe/develop
Browse files Browse the repository at this point in the history
Production Release; Spetember Week 3
  • Loading branch information
mathew-alex authored Sep 15, 2023
2 parents d647189 + 0167315 commit 7044e5d
Show file tree
Hide file tree
Showing 59 changed files with 2,569 additions and 2,037 deletions.
7 changes: 3 additions & 4 deletions .env
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Whitelabelling envs

REACT_APP_TITLE="CARE"
REACT_APP_META_DESCRIPTION="CoronaSafe Network is an open-source public utility designed by a multi-disciplinary team of innovators and volunteers. CoronaSafe Care is a Digital Public Good recognised by United Nations."
REACT_APP_TITLE=CARE
REACT_APP_META_DESCRIPTION=CoronaSafe Network is an open-source public utility designed by a multi-disciplinary team of innovators and volunteers. CoronaSafe Care is a Digital Public Good recognised by United Nations.
REACT_APP_COVER_IMAGE=https://cdn.coronasafe.network/care_logo.svg
REACT_APP_COVER_IMAGE_ALT=https://cdn.coronasafe.network/care_logo.svg
REACT_APP_CONFIG=""
REACT_PUBLIC_URL="https://care.coronasafe.in"
REACT_PUBLIC_URL=https://care.coronasafe.in

# Dev envs
ESLINT_NO_DEV_ERRORS=true
61 changes: 21 additions & 40 deletions .github/workflows/cypress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ jobs:
permissions: write-all
if: github.repository == 'coronasafe/care_fe'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
containers: [1,2,3,4,5,6,7,8]
steps:
- name: Checkout 📥
uses: actions/checkout@v3
Expand All @@ -24,13 +28,22 @@ jobs:
repository: coronasafe/care
path: care

- name: Run docker compose up on care 🐳
run: cd care && touch .env && make docker_config_file=docker-compose.pre-built.yaml up && cd .. && sleep 60s
# Voluntarily kept 60 seconds delay to wait for migrations to complete.
- name: Start care docker containers 🐳
run: |
cd care
make docker_config_file=docker-compose.pre-built.yaml up
while docker compose exec backend bash -c "python manage.py showmigrations 2>/dev/null | cat | grep -q '\[ \]'"; do
>&2 echo "Migrations are not yet applied - sleeping"
sleep 5
done
echo "Migrations are applied"
cd ..
- name: Run Django collectstatic and load dummy data on care 🐍
- name: Load dummy data into care backend 📂
run: |
docker exec care python manage.py load_dummy_data
cd care
docker compose exec backend bash -c "python manage.py load_dummy_data"
cd ..
- name: Check care is up ♻
run: curl -o /dev/null -s -w "%{http_code}\n" http://localhost:9000
Expand All @@ -51,39 +64,14 @@ jobs:
wait-on-timeout: 300
browser: chrome
record: true
parallel: true
env:
CARE_API: http://localhost:9000
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()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: cypress failed

- name: Add cypress failed label on failure 🏷️
uses: actions-ecosystem/action-add-labels@v1
if: failure()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: cypress failed
COMMIT_INFO_MESSAGE: ${{github.event.pull_request.title}}
COMMIT_INFO_SHA: ${{github.event.pull_request.head.sha}}

- name: Upload cypress screenshots on failure 📸
uses: actions/upload-artifact@v3
Expand All @@ -92,10 +80,3 @@ jobs:
name: cypress-screenshots
path: cypress/screenshots

# Test run video was always captured, so this action uses "always()" condition
- name: Upload cypress videos 📹
uses: actions/upload-artifact@v3
if: always()
with:
name: cypress-videos
path: cypress/videos
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public/build-meta.json
# Using NPM
yarn.lock
pnpm-lock.yaml
bun.lockb

# Cypress
cypress/downloads
Expand Down
1 change: 0 additions & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export default defineConfig({
return null;
},
});

return config;
},
baseUrl: "http://localhost:4000",
Expand Down
113 changes: 113 additions & 0 deletions cypress/e2e/assets_spec/asset_homepage.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/// <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";
import { AssetPage } from "../../pageobject/Asset/AssetCreation";
import LoginPage from "../../pageobject/Login/LoginPage";
import { v4 as uuidv4 } from "uuid";

describe("Asset Tab", () => {
const assetSearchPage = new AssetSearchPage();
const assetQRScanPage = new AssetQRScanPage();
const assetPagination = new AssetPagination();
const assetFilters = new AssetFilters();
const assetPage = new AssetPage();
const loginPage = new LoginPage();
const assetName = "Dummy Camera 10";
const qrCode = uuidv4();
const serialNumber = Math.floor(Math.random() * 10 ** 10).toString();

before(() => {
loginPage.loginAsDisctrictAdmin();
cy.saveLocalStorage();
});

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

// search for a element

it("Search Asset Name/QR_ID/Serial_number", () => {
assetSearchPage.typeSearchKeyword(assetName);
assetSearchPage.pressEnter();
assetSearchPage.verifyBadgeContent(assetName);
assetSearchPage.clickAssetByName(assetName);
assetSearchPage.clickUpdateButton();
assetSearchPage.clearAndTypeQRCode(qrCode);
assetSearchPage.clearAndTypeSerialNumber(serialNumber);
assetSearchPage.clickAssetSubmitButton();
assetSearchPage.visitAssetsPage();
assetSearchPage.typeSearchKeyword(qrCode);
assetSearchPage.pressEnter();
assetSearchPage.verifyAssetListContains(assetName);
assetSearchPage.verifyBadgeContent(qrCode);
assetSearchPage.typeSearchKeyword(serialNumber);
assetSearchPage.verifyAssetListContains(assetName);
assetSearchPage.verifyBadgeContent(serialNumber);
});

// 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",
"Camera Loc"
);
assetFilters.clickadvancefilter();
assetFilters.clickslideoverbackbutton(); // to verify the back button doesn't clear applied filters
assetFilters.assertFacilityText("Dummy Facility 1");
assetFilters.assertAssetTypeText("INTERNAL");
assetFilters.assertAssetClassText("ONVIF");
assetFilters.assertStatusText("ACTIVE");
assetFilters.assertLocationText("Camera Locations");
assetFilters.clickadvancefilter();
assetFilters.clearFilters();
});

// Verify the pagination in the page

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

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

it("verify imported asset", () => {
assetSearchPage.typeSearchKeyword("New Test Asset");
assetSearchPage.pressEnter();
assetSearchPage.verifyAssetIsPresent("New Test Asset");
});

it("Export asset", () => {
assetPage.selectassetimportbutton();
assetPage.selectjsonexportbutton();
assetPage.selectcsvexportbutton();
});

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

This file was deleted.

Loading

1 comment on commit 7044e5d

@vercel
Copy link

@vercel vercel bot commented on 7044e5d Sep 15, 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-git-master-ohcnetwork.vercel.app
care-storybook-ohcnetwork.vercel.app

Please sign in to comment.