Skip to content

Commit

Permalink
Merge branch 'develop' into Fixes#7610_Toggle_Emergency_Contact_No._F…
Browse files Browse the repository at this point in the history
…rom_Phone_Number
  • Loading branch information
rithviknishad authored May 6, 2024
2 parents e906e8f + 4568e5f commit 36f2a61
Show file tree
Hide file tree
Showing 18 changed files with 212 additions and 176 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-label: "stale"
stale-pr-label: "stale"
stale-issue-message: "Hi, @gigincg, @nihal467, @khavinshankar, @mathew-alex, @aparnacoronasafe, This issue has been automatically marked as stale because it has not had any recent activity."
stale-issue-message: "Hi, @coronasafe/care-frontend-maintainers, This issue has been automatically marked as stale because it has not had any recent activity."
stale-pr-message: "Hi, This pr has been automatically marked as stale because it has not had any recent activity. It will be automatically closed if no further activity occurs for 7 more days. Thank you for your contributions."
close-pr-message: "Hi, @gigincg, @nihal467, @khavinshankar, @mathew-alex, This pr has been automatically closed because it has not had any recent activity. Thank you for your contributions. Feel free to repopen the pr."
close-pr-message: "Hi, @coronasafe/care-frontend-maintainers, This PR has been automatically closed due to inactivity. Thank you for your contributions. Feel free to re-open the PR."
exempt-issue-labels: "blocked,waiting for related PR,waiting for back end,help wanted,work-in-progress,In Progress,wishlist,EPIC"
exempt-pr-labels: "tested,needs testing,need Review,waiting for related PR,waiting for back end,help wanted,blocked,work-in-progress,In Progress"
days-before-issue-stale: 14
Expand Down
29 changes: 25 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,33 @@ Authenticate to staging API with any of the following credentials

#### 🧪 Run cypress tests

Ensure that the development server is running and then run the cypress tests in either of the ways described below.
To run cypress tests locally, you'll need to setup the backend to run locally and load dummy data required for cypress to the database. See [docs](https://github.com/coronasafe/care#self-hosting).

Once backend is running locally, you'll have to ensure your local front-end is connected to local backend, by setting the `CARE_API` env.

```env
#.env
CARE_API=http://127.0.0.1:9000
```

Once done, start the development server by running

```sh
npm run dev
```

Once development server is running, then run the cypress tests in either of the ways described below.

```sh
npm run cypress:run # To run all tests in headless mode.
```

```sh
npm run cypress:run:gui # To run all tests in headed mode.
```

```sh
$ npm run cypress:run # To run all tests in headless mode.
$ npm run cypress:run:gui # To run all tests in headed mode.
$ npm run cypress:open # To debug and run tests individually.
npm run cypress:open # To debug and run tests individually.
```

- Failed test screenshots are saved in `cypress/screenshots`
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/users_spec/user_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe("Manage User", () => {
cy.awaitUrl("/users");
});

it("linking skills for a users and verify its reflection in profile", () => {
it("linking skills for users and verify its reflection in profile", () => {
// select the district user and select one skill link and verify its profile reflection
userPage.typeInSearchInput(usernameforworkinghour);
userPage.checkUsernameText(usernameforworkinghour);
Expand All @@ -49,7 +49,7 @@ describe("Manage User", () => {
manageUserPage.navigateToProfile();
userCreationPage.verifyElementContainsText(
"username-profile-details",
usernameforworkinghour
usernameforworkinghour,
);
manageUserPage.assertSkillInAlreadyLinkedSkills(linkedskill);
});
Expand Down
2 changes: 1 addition & 1 deletion src/Components/ExternalResult/ResultList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export default function ResultList() {
});
}

if (loading) {
if (loading || !data) {
manageResults = (
<tr className="bg-white">
<td colSpan={5}>
Expand Down
3 changes: 2 additions & 1 deletion src/Components/Facility/ConsultationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import ConfirmDialog from "../Common/ConfirmDialog.js";
import request from "../../Utils/request/request.js";
import routes from "../../Redux/api.js";
import useQuery from "../../Utils/request/useQuery.js";
import { t } from "i18next";

const Loading = lazy(() => import("../Common/Loading"));
const PageTitle = lazy(() => import("../Common/PageTitle"));
Expand Down Expand Up @@ -1477,7 +1478,7 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => {
>
<UserAutocompleteFormField
name={"treating_physician"}
label="Treating Physician"
label={t("treating_doctor")}
placeholder="Attending Doctors Name and Designation"
required
value={
Expand Down
25 changes: 17 additions & 8 deletions src/Components/Facility/DischargeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import CircularProgress from "../Common/components/CircularProgress";
import { FacilitySelect } from "../Common/FacilitySelect";
import { FacilityModel } from "./models";
import dayjs from "../../Utils/dayjs";
import { FieldError } from "../Form/FieldValidators";

interface PreDischargeFormInterface {
new_discharge_reason: number | null;
Expand Down Expand Up @@ -121,15 +122,22 @@ const DischargeModal = ({

if (
preDischargeForm.new_discharge_reason ==
DISCHARGE_REASONS.find((i) => i.text == "Expired")?.id &&
!preDischargeForm.discharge_notes.trim()
DISCHARGE_REASONS.find((i) => i.text == "Expired")?.id
) {
setErrors({
...errors,
discharge_notes: "Please enter the cause of death",
});
setIsSendingDischargeApi(false);
return;
const newErrors: Record<string, FieldError> = {};

if (!preDischargeForm.discharge_notes.trim()) {
newErrors["discharge_notes"] = "Please enter the cause of death";
}
if (!preDischargeForm.death_confirmed_doctor?.trim()) {
newErrors["death_confirmed_doctor"] = "Field is required";
}

if (Object.entries(newErrors).length) {
setErrors({ ...errors, ...newErrors });
setIsSendingDischargeApi(false);
return;
}
}

const dischargeDetails = {
Expand Down Expand Up @@ -310,6 +318,7 @@ const DischargeModal = ({
<TextFormField
name="death_confirmed_by"
label="Confirmed By"
error={errors.death_confirmed_doctor}
value={preDischargeForm.death_confirmed_doctor ?? ""}
onChange={(e) => {
setPreDischargeForm((form) => {
Expand Down
Loading

0 comments on commit 36f2a61

Please sign in to comment.