Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/DonXavierdev/care_fe int…
Browse files Browse the repository at this point in the history
…o issues/10387/Cypress-Medicine-Test
  • Loading branch information
DonXavierdev committed Mar 6, 2025
2 parents abf92d1 + 9cfed2f commit d49281f
Show file tree
Hide file tree
Showing 165 changed files with 7,478 additions and 3,059 deletions.
3 changes: 3 additions & 0 deletions .example.env
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,6 @@ REACT_ALLOWED_LOCALES="en,hi,ta,ml,mr,kn"

# ISO 3166-1 Alpha-2 code for the default country code (default: "IN")
REACT_DEFAULT_COUNTRY=

# Maps fallback URL template (default:"https://www.openstreetmap.org/?mlat={lat}&mlon={long}&zoom=15")
REACT_MAPS_FALLBACK_URL_TEMPLATE=
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,22 @@ If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.

---

### 🚨 DO NOT EDIT BELOW THIS LINE 🚨

### Instructions for Requesting Assignment:

To request assignment, please clearly outline your solution and timeline by commenting on the issue using the format below:

**Describe your solution clearly:**
Provide a detailed explanation of your proposed solution, including your approach, key implementation steps, and relevant examples or references. Mention any dependencies, assumptions, or risks you foresee that might affect your timeline or implementation.

**Expected Timeline:**
- End date: [Expected submission date of a completed Pull Request]

**Additional Context:**
Include any other relevant context, links, screenshots, or resources that support your proposed solution.

> 🚨 Your assignment may be unassigned if there is no activity or progress within the stated timeline unless communicated clearly and agreed upon.
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,21 @@ A clear and concise description of any alternative solutions or features you've

**Additional context**
Add any other context or screenshots about the feature request here.

---
### 🚨 DO NOT EDIT BELOW THIS LINE 🚨

### Instructions for Requesting Assignment:

To request assignment, please clearly outline your solution and timeline by commenting on the issue using the format below:

**Describe your solution clearly:**
Provide a detailed explanation of your proposed solution, including your approach, key implementation steps, and relevant examples or references. Mention any dependencies, assumptions, or risks you foresee that might affect your timeline or implementation.

**Expected Timeline:**
- End date: [Expected submission date of a completed Pull Request]

**Additional Context:**
Include any other relevant context, links, screenshots, or resources that support your proposed solution.

> 🚨 Your assignment may be unassigned if there is no activity or progress within the stated timeline unless communicated clearly and agreed upon.
3 changes: 2 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
- [ ] Ensure that UI text is kept in I18n files.
- [ ] Prep screenshot or demo video for changelog entry, and attach it to issue.
- [ ] Request for Peer Reviews
- [ ] Completion of QA
- [ ] Completion of QA in Mobile Devices
- [ ] Completion of QA in Desktop Devices
48 changes: 0 additions & 48 deletions .github/workflows/issue-automation.yml

This file was deleted.

4 changes: 4 additions & 0 deletions care.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ const careConfig = {
defaultEncounterType: (env.REACT_DEFAULT_ENCOUNTER_TYPE ||
"hh") as EncounterClass,

mapFallbackUrlTemplate:
env.REACT_MAPS_FALLBACK_URL_TEMPLATE ||
"https://www.openstreetmap.org/?mlat={lat}&mlon={long}&zoom=15",

gmapsApiKey:
env.REACT_GMAPS_API_KEY || "AIzaSyDsBAc3y7deI5ZO3NtK5GuzKwtUzQNJNUk",

Expand Down
3 changes: 2 additions & 1 deletion cypress/e2e/facility_spec/facility_creation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { FacilityCreation } from "@/pageObject/facility/FacilityCreation";
import { generatePhoneNumber } from "@/utils/commonUtils";
import { generateFacilityData } from "@/utils/facilityData";
import { viewPort } from "@/utils/viewPort";

const LOCATION_HIERARCHY = {
state: "Kerala",
Expand All @@ -14,7 +15,7 @@ describe("Facility Management", () => {
const facilityType = "Primary Health Centre";

beforeEach(() => {
cy.viewport(1920, 1080);
cy.viewport(viewPort.laptopStandard.width, viewPort.laptopStandard.height);
cy.loginByApi("nurse");
cy.visit("/");
});
Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/patient_spec/patient_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import { PatientEncounter } from "@/pageObject/Patients/PatientEncounter";
import { patientVerify } from "@/pageObject/Patients/PatientVerify";
import { FacilityCreation } from "@/pageObject/facility/FacilityCreation";
import { viewPort } from "@/utils/viewPort";

const facilityCreation = new FacilityCreation();
const patientEncounter = new PatientEncounter();
Expand Down Expand Up @@ -101,6 +102,7 @@ describe("Patient Management", () => {
];

beforeEach(() => {
cy.viewport(viewPort.desktop1080p.width, viewPort.desktop2k.height);
cy.loginByApi("doctor");
cy.visit("/");
});
Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/patient_spec/patient_details.cy.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { PatientDetails } from "@/pageObject/Patients/PatientDetails";
import { PatientEncounter } from "@/pageObject/Patients/PatientEncounter";
import { FacilityCreation } from "@/pageObject/facility/FacilityCreation";
import { viewPort } from "@/utils/viewPort";

const facilityCreation = new FacilityCreation();
const patientEncounter = new PatientEncounter();
const patientDetails = new PatientDetails();

describe("Patient Management", () => {
beforeEach(() => {
cy.viewport(viewPort.laptopStandard.width, viewPort.laptopStandard.height);
cy.loginByApi("devdoctor");
cy.visit("/");
});
Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/patient_spec/patient_encounter.cy.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { PatientEncounter } from "@/pageObject/Patients/PatientEncounter";
import { FacilityCreation } from "@/pageObject/facility/FacilityCreation";
import { viewPort } from "@/utils/viewPort";

const facilityCreation = new FacilityCreation();
const patientEncounter = new PatientEncounter();

describe("Patient Encounter Questionnaire", () => {
beforeEach(() => {
cy.viewport(viewPort.desktop1080p.width, viewPort.desktop1080p.height);
cy.loginByApi("devnurse");
cy.visit("/");
});
Expand Down
22 changes: 22 additions & 0 deletions cypress/e2e/users_spec/user_avatar.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { UserAvatar } from "@/pageObject/Users/UserAvatar";

describe("User Profile Avatar Modification", () => {
const userAvatar = new UserAvatar("teststaff4");
beforeEach(() => {
cy.loginByApi("teststaff4");
cy.visit("/");
});
it("should modify an avatar", () => {
userAvatar
.navigateToProfile()
.interceptUploadAvatarRequest()
.clickChangeAvatarButton()
.uploadAvatar()
.clickSaveAvatarButton()
.verifyUploadAvatarApiCall()
.interceptDeleteAvatarRequest()
.clickChangeAvatarButton()
.clickDeleteAvatarButton()
.verifyDeleteAvatarApiCall();
});
});
Binary file added cypress/fixtures/avatar.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions cypress/fixtures/users.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,9 @@
"devdoctor": {
"username": "developdoctor",
"password": "Test@123"
},
"teststaff4": {
"username": "teststaff4",
"password": "Test@123"
}
}
59 changes: 59 additions & 0 deletions cypress/pageObject/Users/UserAvatar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
export class UserAvatar {
username: string;
constructor(username: string) {
this.username = username;
}

navigateToProfile() {
cy.visit(`/users/${this.username}`);
return this;
}

interceptUploadAvatarRequest() {
cy.intercept("POST", `/api/v1/users/${this.username}/profile_picture/`).as(
"uploadAvatar",
);
return this;
}

clickChangeAvatarButton() {
cy.verifyAndClickElement('[data-cy="change-avatar"]', "Change Avatar");
return this;
}

uploadAvatar() {
cy.get('input[title="changeFile"]').selectFile(
"cypress/fixtures/avatar.jpg",
{ force: true },
);
return this;
}

clickSaveAvatarButton() {
cy.verifyAndClickElement('[data-cy="save-cover-image"]', "Save");
return this;
}

verifyUploadAvatarApiCall() {
cy.wait("@uploadAvatar").its("response.statusCode").should("eq", 200);
return this;
}

interceptDeleteAvatarRequest() {
cy.intercept(
"DELETE",
`/api/v1/users/${this.username}/profile_picture/`,
).as("deleteAvatar");
return this;
}

clickDeleteAvatarButton() {
cy.verifyAndClickElement('[data-cy="delete-avatar"]', "Delete");
return this;
}

verifyDeleteAvatarApiCall() {
cy.wait("@deleteAvatar").its("response.statusCode").should("eq", 204);
return this;
}
}
27 changes: 27 additions & 0 deletions cypress/utils/viewPort.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export const viewPort = {
// Most common desktop resolution (Full HD)
desktop1080p: {
width: 1920,
height: 1080,
},
// Common laptop resolution (HD+)
laptopStandard: {
width: 1366,
height: 768,
},
// MacBook Pro 13" and similar laptops
laptopRetina: {
width: 1440,
height: 900,
},
// Common desktop resolution (2K)
desktop2k: {
width: 2560,
height: 1440,
},
// Common laptop resolution (HD)
laptopSmall: {
width: 1280,
height: 720,
},
} as const;
Loading

0 comments on commit d49281f

Please sign in to comment.