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

Enhanced Resource Page #9768

Open
wants to merge 25 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5d5dbd8
enhanced-resource-page
manmeetnagii Jan 5, 2025
66126a4
enhanced-resource-page
manmeetnagii Jan 5, 2025
59f2f4c
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
manmeetnagii Jan 7, 2025
e9193ad
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
manmeetnagii Jan 7, 2025
85de07b
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
manmeetnagii Jan 8, 2025
336d4d2
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
manmeetnagii Jan 9, 2025
7f8aab4
enhanced-resource-page
manmeetnagii Jan 9, 2025
baa6957
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
manmeetnagii Jan 10, 2025
774d885
removed console logs
manmeetnagii Jan 10, 2025
f83d81e
stored viewMode to localStorage
manmeetnagii Jan 10, 2025
09429b2
switch to useQuery for all api calls
manmeetnagii Jan 10, 2025
5ed698b
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
manmeetnagii Jan 10, 2025
50d2528
changes for mobile screen
manmeetnagii Jan 10, 2025
93a31c5
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
manmeetnagii Jan 11, 2025
103337d
fix list view layout
manmeetnagii Jan 11, 2025
46e610c
Fixed the count of status
manmeetnagii Jan 11, 2025
82514c4
Fixed the count of status
manmeetnagii Jan 11, 2025
56e4036
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
manmeetnagii Jan 11, 2025
bafcb02
Fixed position of resource cards wrt their status
manmeetnagii Jan 11, 2025
eea4ac6
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
manmeetnagii Jan 11, 2025
076f15b
Merge branch 'develop' into enhanced-resource-page
manmeetnagii Jan 12, 2025
e427ed8
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
manmeetnagii Jan 12, 2025
4965b31
Merge branch 'enhanced-resource-page' of https://github.com/manmeetna…
manmeetnagii Jan 12, 2025
cc5e17a
Resolved conflicts
manmeetnagii Jan 12, 2025
8718369
Resolved conflicts
manmeetnagii Jan 12, 2025
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
74 changes: 0 additions & 74 deletions cypress/e2e/patient_spec/patient_creation.cy.ts

This file was deleted.

23 changes: 23 additions & 0 deletions cypress/e2e/patient_spec/patient_search.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { patientSearch } from "../../pageObject/Patients/PatientSearch";

describe("Patient Search", () => {
const TEST_PHONE = "9495031234";
const PATIENT_DETAILS = {
name: "Nihal",
sex: "Male",
phone: TEST_PHONE,
};

beforeEach(() => {
cy.visit("/login");
cy.loginByApi("staff");
});

it("search patient with phone number and verifies details", () => {
patientSearch
.selectFacility("Arike")
.clickSearchPatients()
.searchPatient(TEST_PHONE)
.verifySearchResults(PATIENT_DETAILS);
});
Comment on lines +16 to +22
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

🛠️ Refactor suggestion

Add error handling and test coverage for edge cases

The page object and test suite need improvements:

  • The PatientSearch page object lacks error handling:
    • No validation for "no results found" state
    • No handling of invalid phone number formats
    • No assertions for multiple search results

Add the following test cases:

  • Test invalid phone number format (e.g., non-numeric characters)
  • Test search with non-existent phone number
  • Test search returning multiple patient matches
  • Add appropriate error handling methods in the page object to support these scenarios
🔗 Analysis chain

Add error scenarios and edge cases.

While the happy path is covered, consider adding test cases for:

  • Invalid phone numbers
  • No search results
  • Multiple matching results

Also, verify that the patientSearch page object implements proper error handling:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the PatientSearch page object handles error cases
rg -A 5 "error|invalid|not found" "cypress/pageObject/Patients/PatientSearch.ts"

Length of output: 80


Script:

#!/bin/bash
# Find the correct path for PatientSearch page object
fd -t f "PatientSearch" cypress/

# Examine the implementation of search-related methods
ast-grep --pattern 'class PatientSearch {
  $$$
  searchPatient($_) {
    $$$
  }
  $$$
}'

# Look for any verification or assertion methods
ast-grep --pattern 'class PatientSearch {
  $$$
  verifySearchResults($_) {
    $$$
  }
  $$$
}'

Length of output: 6141

});
6 changes: 1 addition & 5 deletions cypress/fixtures/users.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@
"username": "nihal-nurse",
"password": "Test@123"
},
"doctor": {
"username": "arjun-doctor",
"password": "Test@123"
},
"staff": {
"username": "nihal-staff",
"password": "Test@123"
}
}
}
156 changes: 0 additions & 156 deletions cypress/pageObject/Patients/PatientCreation.ts

This file was deleted.

8 changes: 0 additions & 8 deletions cypress/pageObject/Patients/PatientDashboard.ts

This file was deleted.

41 changes: 41 additions & 0 deletions cypress/pageObject/Patients/PatientSearch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
export class PatientSearch {
// Selectors
private selectors = {
patientsButton: '[data-cy="patients-button"]',
searchInput: "#patient-search",
patientCard: "#patient-search-results",
patientName: '[data-cy="patient-name"]',
patientDetails: "#patient-search-results",
};

// Actions
searchPatient(searchQuery: string) {
cy.get(this.selectors.searchInput).type(searchQuery);

// Wait for results to load
cy.get(this.selectors.patientCard).should("be.visible");
return this;
}

verifySearchResults(patientDetails: {
name: string;
sex: string;
phone: string;
}) {
// Convert object values to an array of strings
const detailsArray = Object.values(patientDetails);
cy.verifyContentPresence(this.selectors.patientDetails, detailsArray);
}

selectFacility(facilityName: string) {
cy.verifyAndClickElement("[data-cy='facility-list']", facilityName);
return this;
}

clickSearchPatients() {
cy.get('[data-sidebar="content"]').contains("Search Patients").click();
return this;
}
}

export const patientSearch = new PatientSearch();
63 changes: 0 additions & 63 deletions cypress/pageObject/Patients/PatientVerify.ts

This file was deleted.

Loading
Loading