Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced libphonenumber-js with custom functions #6205

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]
}
2 changes: 1 addition & 1 deletion .github/workflows/cypress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ 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 }}
Expand Down
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
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 cypress/e2e/assets_spec/assets_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe("Asset", () => {
"email@support.com",
"Vendor's Name",
serialNumber,
"2021-12-25",
"25122021",
"Test note for asset creation!"
);

Expand All @@ -80,7 +80,7 @@ describe("Asset", () => {
"email@support.com",
"Vendor's Name",
serialNumber,
"2021-12-25",
"25122021",
"Test note for asset creation!"
);

Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/facility_spec/facility.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe("Facility Creation", () => {
});

beforeEach(() => {
cy.viewport(1280, 720);
cy.restoreLocalStorage();
cy.awaitUrl("/facility");
});
Expand Down
6 changes: 5 additions & 1 deletion cypress/e2e/facility_spec/inventory.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ describe("Inventory Management Section", () => {
beforeEach(() => {
cy.restoreLocalStorage();
cy.awaitUrl("/");
cy.viewport(1280, 720);
cy.intercept("GET", "**/api/v1/facility/**").as("getFacilities");
cy.get("[id='facility-details']").first().click();
cy.get("[id=manage-facility-dropdown]").should("exist").click();
cy.wait("@getFacilities").its("response.statusCode").should("eq", 200);
cy.get("#manage-facility-dropdown button").should("be.visible");
cy.get("[id='manage-facility-dropdown']").scrollIntoView().click();
cy.get("[id=inventory-management]").click();
});

Expand Down
6 changes: 5 additions & 1 deletion cypress/e2e/facility_spec/locations.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ describe("Location Management Section", () => {
});

beforeEach(() => {
cy.viewport(1280, 720);
cy.restoreLocalStorage();
cy.awaitUrl("/");
cy.intercept("GET", "**/api/v1/facility/**").as("getFacilities");
cy.get("[id='facility-details']").first().click();
cy.get("[id=manage-facility-dropdown]").should("exist").click();
cy.wait("@getFacilities").its("response.statusCode").should("eq", 200);
cy.get("#manage-facility-dropdown button").should("be.visible");
cy.get("[id='manage-facility-dropdown']").scrollIntoView().click();
cy.get("[id=location-management]").click();
});

Expand Down
55 changes: 36 additions & 19 deletions cypress/e2e/patient_spec/patient_crud.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { afterEach, before, beforeEach, cy, describe, it } from "local-cypress";
const username = "devdistrictadmin";
const password = "Coronasafe@123";
const phone_number = "9" + Math.floor(100000000 + Math.random() * 900000000);
const emergency_phone_number = "9430123487";
const emergency_phone_number =
"9" + Math.floor(100000000 + Math.random() * 900000000);
const yearOfBirth = "2023";
let patient_url = "";

Expand All @@ -24,8 +25,8 @@ describe("Patient Creation with consultation", () => {
});

it("Create a new patient with no consultation", () => {
cy.get("button").should("contain", "Add Patient Details");
cy.get("#add-patient-div").click();
cy.get("#add-patient-details").should("be.visible");
cy.get("#add-patient-details").click();
cy.get("input[name='facilities']")
.type("cypress facility")
.then(() => {
Expand All @@ -35,8 +36,8 @@ describe("Patient Creation with consultation", () => {
cy.get("button").get("#submit").click();
cy.get("#phone_number-div").type(phone_number);
cy.get("#emergency_phone_number-div").type(emergency_phone_number);
cy.get("[data-testid=date-of-birth] button").click();
cy.get("#date-1").click();
cy.get("#date_of_birth").should("be.visible").click();
cy.get("#date-input").click().type("01082023");
cy.get("[data-testid=name] input").type("Test E2E User");
cy.get("[data-testid=Gender] button")
.click()
Expand Down Expand Up @@ -94,16 +95,21 @@ describe("Patient Creation with consultation", () => {
});

it("Edit the patient details", () => {
cy.intercept("GET", "**/facility/*/patient/**").as("getFacilities");
cy.awaitUrl(patient_url + "/update");
cy.wait("@getFacilities").its("response.statusCode").should("eq", 200);
cy.wait(10000);
cy.get("#address").scrollIntoView();
cy.get("#address").should("be.visible");
cy.get("#address").type("Test Patient Address Edited");
cy.get("[data-testid=name] input").clear();
cy.get("[data-testid=name] input").type("Test E2E User Edited");
cy.get("#phone_number-div").clear();
cy.get("#phone_number-div").type("+91").type(phone_number);
cy.get("#emergency_phone_number-div").clear();
cy.get("#emergency_phone_number-div")
.clear()
.then(() => {
cy.get("#emergency_phone_number__country").select("IN");
});
cy.get("#emergency_phone_number-div").type("9120330220");
cy.get("#address").clear().type("Test Patient Address Edited");
.type("+91")
.type(emergency_phone_number);
cy.get("#present_health").type("Severe Cough");
cy.get("#ongoing_medication").type("Paracetamol");
cy.get("#allergies").type("Dust");
Expand All @@ -117,7 +123,12 @@ describe("Patient Creation with consultation", () => {
cy.get("#policy_id").type("P123");
cy.get("#insurer_id").type("GICOFINDIA");
cy.get("#insurer_name").type("GICOFINDIA");
cy.get("button").get("[data-testid=submit-button]").click();
cy.get("[data-testid=blood-group] button")
.click()
.then(() => {
cy.get("[role='option']").contains("O+").click();
});
cy.get("button[data-testid='submit-button']").click();
cy.url().should("include", "/patient");
cy.url().then((url) => {
cy.log(url);
Expand All @@ -134,12 +145,8 @@ describe("Patient Creation with consultation", () => {
"contain",
"Test E2E User Edited"
);
cy.get("[data-testid=patient-dashboard]").should(
"contain",
"+919120330220"
);
cy.get("[data-testid=patient-dashboard]").should("contain", phone_number);
const patientDetails_values: string[] = [
"Test Patient Address Edited",
"Severe Cough",
"Paracetamol",
"Dust",
Expand All @@ -155,7 +162,12 @@ describe("Patient Creation with consultation", () => {
});

it("Create a New consultation to existing patient", () => {
cy.intercept("GET", "**/api/v1/patient/**").as("getFacilities");
cy.visit(patient_url + "/consultation");
cy.wait("@getFacilities").its("response.statusCode").should("eq", 200);
cy.get("#history_of_present_illness").scrollIntoView;
cy.get("#history_of_present_illness").should("be.visible");
cy.get("#history_of_present_illness").click().type("histroy");
cy.get("#consultation_status")
.click()
.then(() => {
Expand All @@ -167,13 +179,13 @@ describe("Patient Creation with consultation", () => {
cy.get("[role='option']").contains("ASYMPTOMATIC").click();
});
cy.get("#symptoms").click();
cy.get("#history_of_present_illness").click().type("histroy");

cy.get("#examination_details")
.click()
.type("Examination details and Clinical conditions");
cy.get("#weight").click().type("70");
cy.get("#height").click().type("170");
cy.get("#ip_no").type("192.168.1.11");
cy.get("#patient_no").type("IP007");
cy.get(
"#icd11_diagnoses_object input[placeholder='Select'][role='combobox']"
)
Expand All @@ -190,6 +202,11 @@ describe("Patient Creation with consultation", () => {
cy.contains("button", "Add Prescription Medication")
.should("be.visible")
.click();
cy.intercept("GET", "**/api/v1/medibase/**").as("getFacilities");
cy.get(
"div#medicine_object input[placeholder='Select'][role='combobox']"
).click();
cy.wait("@getFacilities").its("response.statusCode").should("eq", 200);
cy.get("div#medicine_object input[placeholder='Select'][role='combobox']")
.click()
.type("dolo{enter}");
Expand Down
12 changes: 5 additions & 7 deletions cypress/e2e/users_spec/user_crud.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,15 @@ describe("User management", () => {
cy.intercept(/\/api\/v1\/facility/).as("facility");
cy.get("[name='facilities']")
.click()
.type("cypress facility")
.type("Dummy Facility 1")
.wait("@facility");
cy.get("li[role='option']").first().click();
cy.get("input[type='checkbox']").click();
cy.get("[name='phone_number']").type(phone_number);
cy.get("[name='alt_phone_number']").type(alt_phone_number);
cy.intercept(/users/).as("check_availability");
cy.get("[id='date_of_birth']").click();
cy.get("div").contains("20").click();
cy.get("[id='year-0']").click();
cy.get("[id='date-1']").click();
cy.get("#date_of_birth").should("be.visible").click();
cy.get("#date-input").click().type("25081999");
cy.get("[name='username']").type(username);
cy.wait("@check_availability").its("response.statusCode").should("eq", 200);
cy.get("[name='password']").type("#@Cypress_test123");
Expand Down Expand Up @@ -95,7 +93,7 @@ describe("User management", () => {
cy.get("button[id='facilities']").click();
cy.wait("@userFacility")
.getAttached("div[id=facility_0] > div > span")
.contains("cypress facility");
.contains("Dummy Facility 1");
});
});

Expand All @@ -104,7 +102,7 @@ describe("User management", () => {
cy.intercept(/\/api\/v1\/facility/).as("getFacilities");
cy.get("[name='facility']")
.click()
.type("cypress facility")
.type("Dummy Facility 1")
.wait("@getFacilities");
cy.get("li[role='option']").first().click();
cy.intercept(/\/api\/v1\/users\/\w+\/add_facility\//).as("addFacility");
Expand Down
7 changes: 4 additions & 3 deletions cypress/pageobject/Asset/AssetCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ export class AssetPage {
cy.get("[data-testid=asset-support-email-input] input").type(supportEmail);
cy.get("[data-testid=asset-vendor-name-input] input").type(vendorName);
cy.get("[data-testid=asset-serial-number-input] input").type(serialNumber);
cy.get("[data-testid=asset-last-serviced-on-input] input").type(
lastServicedOn
);
cy.get(
"[data-testid=asset-last-serviced-on-input] input[type='text']"
).click();
cy.get("#date-input").click().type(lastServicedOn);
cy.get("[data-testid=asset-notes-input] textarea").type(notes);
}

Expand Down
7 changes: 6 additions & 1 deletion cypress/pageobject/Facility/FacilityCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ class FacilityPage {
}

visitUpdateFacilityPage(url: string) {
cy.intercept("GET", "**/api/v1/facility/**").as("getFacilities");
cy.visit(url);
cy.wait("@getFacilities").its("response.statusCode").should("eq", 200);
cy.get("#manage-facility-dropdown button").should("be.visible");
}

fillFacilityName(name: string) {
Expand Down Expand Up @@ -87,7 +90,9 @@ class FacilityPage {
}

clickManageFacilityDropdown() {
cy.get("#manage-facility-dropdown").click();
cy.get("#manage-facility-dropdown button")
.contains("Manage Facility")
.click();
}

clickUpdateFacilityOption() {
Expand Down
Loading