Skip to content

Commit

Permalink
Merge branch 'develop' into fix#6771
Browse files Browse the repository at this point in the history
  • Loading branch information
thedevildude authored Jan 31, 2024
2 parents d3c1a9f + 62a1d67 commit 9c32733
Show file tree
Hide file tree
Showing 74 changed files with 3,105 additions and 2,049 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ REACT_PUBLIC_URL=https://care.coronasafe.in

# Dev envs
ESLINT_NO_DEV_ERRORS=true

CARE_CDN_URL="https://egov-s3-facility-10bedicu.s3.amazonaws.com https://egov-s3-patient-data-10bedicu.s3.amazonaws.com http://localhost:4566"
13 changes: 1 addition & 12 deletions .github/workflows/cypress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,7 @@ jobs:
run: |
cd care
make docker_config_file=docker-compose.pre-built.yaml up
while docker compose exec celery-beat bash -c "python manage.py showmigrations 2>/dev/null | cat | grep -q '\[ \]'"; do
>&2 echo "Migrations are not yet applied - sleeping"
sleep 10
done
echo "Migrations are applied"
cd ..
- name: Load dummy data into care backend 📂
run: |
cd care
docker compose exec backend bash -c "python manage.py load_dummy_data"
docker restart care-backend-1
make docker_config_file=docker-compose.pre-built.yaml load-dummy-data
cd ..
- name: Wait for care to be up ♻
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/assets_spec/asset_homepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ describe("Asset Tab", () => {

it("Filter Asset", () => {
assetFilters.filterAssets(
"Dummy Facility 1",
"Dummy Facility 40",
"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.assertFacilityText("Dummy Facility 40");
assetFilters.assertAssetTypeText("INTERNAL");
assetFilters.assertAssetClassText("ONVIF");
assetFilters.assertStatusText("ACTIVE");
Expand All @@ -89,7 +89,7 @@ describe("Asset Tab", () => {
it("Import new asset", () => {
assetPage.selectassetimportbutton();
assetPage.selectImportOption();
assetPage.selectImportFacility("Dummy Facility 1");
assetPage.selectImportFacility("Dummy Facility 40");
assetPage.importAssetFile();
assetPage.selectImportLocation("Camera Loc");
assetPage.clickImportAsset();
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/assets_spec/assets_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe("Asset", () => {

it("Verify asset creation fields throws error if empty", () => {
assetPage.createAsset();
assetPage.selectFacility("Dummy Facility 1");
assetPage.selectFacility("Dummy Facility 40");
assetPage.clickCreateAsset();

assetPage.verifyEmptyAssetNameError();
Expand All @@ -39,7 +39,7 @@ describe("Asset", () => {

it("Create an Asset", () => {
assetPage.createAsset();
assetPage.selectFacility("Dummy Facility 1");
assetPage.selectFacility("Dummy Facility 40");
assetPage.selectLocation("Camera Loc");
assetPage.selectAssetType("Internal");
assetPage.selectAssetClass("ONVIF Camera");
Expand Down Expand Up @@ -139,7 +139,7 @@ describe("Asset", () => {

it("Add an vital monitor asset and configure it", () => {
assetPage.createAsset();
assetPage.selectFacility("Dummy Facility 1");
assetPage.selectFacility("Dummy Facility 40");
assetPage.selectLocation("Camera Loc");
assetPage.selectAssetType("Internal");
assetPage.selectAssetClass("HL7 Vitals Monitor");
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/assets_spec/assets_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe("Asset", () => {
const facilityPage = new FacilityPage();
const assetSearchPage = new AssetSearchPage();
const assetFilters = new AssetFilters();
const fillFacilityName = "Dummy Facility 1";
const fillFacilityName = "Dummy Facility 40";
const assetname = "Dummy Camera";
const locationName = "Dummy Location 1";
const initiallocationName = "Camera Location";
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/facility_spec/facility_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("Facility Creation", () => {
const doctorCapacity = "5";
const totalDoctor = "10";
const facilityName = "cypress facility";
const facilityName2 = "Dummy Facility 1";
const facilityName2 = "Dummy Facility 40";
const facilityAddress = "cypress address";
const facilityUpdateAddress = "cypress updated address";
const facilityNumber = "9898469865";
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/facility_spec/facility_homepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe("Facility Homepage Function", () => {
const capacitiesAlias = "downloadCapacitiesCSV";
const doctorsAlias = "downloadDoctorsCSV";
const triagesAlias = "downloadTriagesCSV";
const facilityName = "Dummy Facility 1";
const facilityName = "Dummy Facility 40";
const facilityLocaion = "Dummy Location";
const stateName = "Kerala";
const district = "Ernakulam";
Expand Down
22 changes: 19 additions & 3 deletions cypress/e2e/facility_spec/locations.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ describe("Location Management Section", () => {
"Please select a bed type",
];
const locationName = "Test-location";
const locationNameTwo = "Test-location-2";
const locationDescription = "Test Description";
const locationType = "WARD";
const locationMiddleware = "dev_middleware.coronasafe.live";
Expand Down Expand Up @@ -57,7 +58,20 @@ describe("Location Management Section", () => {

it("Add a Bed to facility location along with duplication and deleting a bed", () => {
// mandatory field verification in bed creation
facilityLocation.clickManageBedButton();
cy.get("body").then(($body) => {
if ($body.find("#manage-bed-button:visible").length) {
// If the '#manage-bed-button' is visible
facilityLocation.clickManageBedButton();
} else {
// If the '#manage-bed-button' is not visible
facilityLocation.clickAddNewLocationButton();
facilityPage.fillFacilityName(locationName);
facilityLocation.selectLocationType(locationType);
assetPage.clickassetupdatebutton();
facilityLocation.clickNotification();
facilityLocation.clickManageBedButton();
}
});
facilityLocation.clickAddBedButton();
assetPage.clickassetupdatebutton();
userCreationPage.verifyErrorMessages(EXPECTED_BED_ERROR_MESSAGES);
Expand Down Expand Up @@ -97,13 +111,14 @@ describe("Location Management Section", () => {
assetPage.clickassetupdatebutton();
userCreationPage.verifyErrorMessages(EXPECTED_LOCATION_ERROR_MESSAGES);
// create a new location
facilityPage.fillFacilityName(locationName);
facilityPage.fillFacilityName(locationNameTwo);
facilityLocation.fillDescription(locationDescription);
facilityLocation.selectLocationType(locationType);
facilityLocation.fillMiddlewareAddress(locationMiddleware);
assetPage.clickassetupdatebutton();
facilityLocation.clickNotification();
// verify the reflection
facilityLocation.verifyLocationName(locationName);
facilityLocation.verifyLocationName(locationNameTwo);
facilityLocation.verifyLocationType(locationType);
facilityLocation.verifyLocationDescription(locationDescription);
facilityLocation.verifyLocationMiddleware(locationMiddleware);
Expand All @@ -130,6 +145,7 @@ describe("Location Management Section", () => {
facilityLocation.selectBedType(bedType);
facilityLocation.setMultipleBeds(numberOfBeds);
assetPage.clickassetupdatebutton();
facilityLocation.clickNotification();
// verify the bed creation
facilityLocation.verifyBedBadge(bedType);
facilityLocation.verifyBedBadge(bedStatus);
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/patient_spec/patient_crud.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe("Patient Creation with consultation", () => {

it("Create a new patient with no consultation", () => {
patientPage.createPatient();
patientPage.selectFacility("dummy facility");
patientPage.selectFacility("dummy facility 40");
patientPage.patientformvisibility();
patientPage.enterPatientDetails(
phone_number,
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/resource_spec/filter.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe("Resource filter", () => {
cy.intercept(/\/api\/v1\/getallfacilities/).as("facilities_filter");
cy.contains("Filters").click();
cy.get("[name='origin_facility']")
.type("Dummy Facility 1")
.type("Dummy Facility 40")
.wait("@facilities_filter");
cy.get("[role='option']").first().click();
cy.contains("Apply").click();
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/resource_spec/resources.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe("Resource Page", () => {

it("Create a resource request", () => {
cy.visit("/facility");
cy.get("#search").click().type("dummy facility 1");
cy.get("#search").click().type("dummy facility 40");
cy.intercept("GET", "**/api/v1/facility/**").as("loadFacilities");
cy.get("#facility-details").click();
cy.wait("@loadFacilities").its("response.statusCode").should("eq", 200);
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/users_spec/user_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe("User Creation", () => {
const userCreationPage = new UserCreationPage();
const facilityPage = new FacilityPage();
const assetSearchPage = new AssetSearchPage();
const fillFacilityName = "Dummy Facility 1";
const fillFacilityName = "Dummy Facility 40";
const makeid = (length: number) => {
let result = "";
const characters = "abcdefghijklmnopqrstuvwxyz0123456789";
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/users_spec/user_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe("Manage User", () => {
const usernameforworkinghour = "devdistrictadmin";
const usernamerealname = "Dummy Doctor";
const facilitytolinkusername = "Dummy Shifting Center";
const facilitytolinkskill = "Dummy Facility 1";
const facilitytolinkskill = "Dummy Facility 40";
const workinghour = "23";
const linkedskill = "General Medicine";

Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/users_spec/user_profile.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe("Manage User Profile", () => {
const doctorYoE = "10";
const medicalCouncilRegistration = "1234567890";

const facilitySearch = "Dummy Facility 1";
const facilitySearch = "Dummy Facility 40";

before(() => {
loginPage.loginAsDevDoctor();
Expand Down
2 changes: 1 addition & 1 deletion cypress/pageobject/Asset/AssetCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class AssetPage {
cy.get(
"[data-testid=asset-last-serviced-on-input] input[type='text']"
).click();
cy.get("#date-input").click().type(lastServicedOn);
cy.get("#date-input").click().clear().type(lastServicedOn);
cy.get("[data-testid=asset-notes-input] textarea").clear().type(notes);
}

Expand Down
2 changes: 0 additions & 2 deletions cypress/pageobject/Asset/AssetFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ export class AssetFilters {
});
}
clickadvancefilter() {
cy.intercept("GET", "**/api/v1/getallfacilities/**").as("advancefilter");
cy.get("#advanced-filter").click();
cy.wait("@advancefilter").its("response.statusCode").should("eq", 200);
}
clickslideoverbackbutton() {
cy.get("#close-slide-over").click();
Expand Down
2 changes: 1 addition & 1 deletion cypress/pageobject/Facility/FacilityCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class FacilityPage {
}

fillFacilityName(name: string) {
cy.get("#name").clear().type(name);
cy.get("#name").click().clear().click().type(name);
}

fillPincode(pincode: string) {
Expand Down
4 changes: 4 additions & 0 deletions cypress/pageobject/Facility/FacilityLocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ class FacilityLocation {
cy.get("#add-new-bed").click();
}

clickNotification() {
cy.get(".pnotify").click();
}

enterBedName(name: string) {
cy.get("#bed-name").click().clear().click().type(name);
}
Expand Down
2 changes: 0 additions & 2 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,8 @@ Cypress.Commands.add("loginByApi", (username, password) => {
Cypress.Commands.add(
"awaitUrl",
(url: string, disableLoginVerification = false) => {
cy.intercept(/fontawesome/).as("fontawesome");
cy.intercept(/currentuser/).as("currentuser");
cy.visit(url);
cy.wait("@fontawesome");
disableLoginVerification
? cy.wait("@currentuser")
: cy.wait("@currentuser").its("response.statusCode").should("eq", 200);
Expand Down
22 changes: 9 additions & 13 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,12 @@
<meta name="theme-color" content="#0e9f6e" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="apple-touch-icon" href="/images/icons/apple-touch-icon-180x180.png">
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap"
rel="stylesheet"
/>
</head>

<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root">
<style>
<style nonce="7e14cf80">
.App-logo {
height: 10vmin;
pointer-events: none;
Expand All @@ -53,8 +47,14 @@
75% {opacity: 0.5;}
100% {opacity: 0;}
}
.temp-loading {
display: grid;
place-items: center;
height: 100vh;
text-align: center;
}
</style>
<div style="display: grid;place-items: center;height: 100vh; text-align: center;">
<div class="temp-loading">
<img
class="App-logo"
src="https://cdn.coronasafe.network/light-logo.svg"
Expand All @@ -63,11 +63,7 @@
</div>
</div>
<script type="module" src="/src/index.tsx"></script>
<script
src="https://kit.fontawesome.com/d69454c2e7.js"
crossorigin="anonymous"
></script>
<script>
<script nonce="f51b9742">
window.plausible =
window.plausible ||
function () {
Expand Down
9 changes: 9 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,12 @@ status = 200
cache-control = "max-age=0, no-store"
X-Frame-Options = "DENY"
X-Content-Type-Options = "nosniff"
Content-Security-Policy-Report-Only = '''
default-src 'self';
script-src 'self' 'nonce-f51b9742' https://plausible.10bedicu.in;
style-src 'self' 'unsafe-inline';
connect-src 'self' https://plausible.10bedicu.in;
img-src 'self' https://cdn.coronasafe.network https://egov-s3-facility-10bedicu.s3.amazonaws.com https://egov-s3-patient-data-10bedicu.s3.amazonaws.com;
object-src 'self' https://egov-s3-facility-10bedicu.s3.amazonaws.com https://egov-s3-patient-data-10bedicu.s3.amazonaws.com;
report-uri https://csp-logger.ohc.network/
'''
Loading

0 comments on commit 9c32733

Please sign in to comment.