Repository: ohcnetwork/care_fe
Pull request #11453: Cypress tests for Adding new Location 
Author: login: rajku-dev
Labels: name: needs review
name: Tested
Created: 2025-03-21T11:41:28Z | Merged: 2025-04-05T13:33:18Z

## Proposed Changes

- Fixes #10960 
- [X] Create new Room and House Location
- [X] Create Bulk Beds Location

![image](https://github.com/user-attachments/assets/ac5de449-88f6-4c3d-bb16-3e0b4799dc67)


@ohcnetwork/care-fe-code-reviewers

## Merge Checklist

- [ ] Add specs that demonstrate bug / test a new feature.
- [ ] Update [product documentation](https://docs.ohc.network).
- [ ] 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 in Mobile Devices
- [ ] Completion of QA in Desktop Devices


<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **Tests**
  - Introduced a comprehensive end-to-end test suite to validate patient location workflows—from creating new locations to updating encounter associations.
  - Enhanced test reliability by adding specific data attributes for improved element identification in various components, including location forms, patient info cards, and encounter lists.
  - Expanded user data with a new entry for testing purposes.
  - Updated command selectors for improved interaction with the command menu in tests.
  - Added new data attributes to various components to facilitate end-to-end testing, including buttons and input fields for better targeting in automated tests.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Linked issue #10960: Create a new cypress test to add a new location to a facility
Describe the Test

Create a new cypress test to add a new location in a facility and cover all its happy flow functionality

Rules to be followed

[docs.ohc.network/docs/care/development/guidelines-to-write-cypress](https://docs.ohc.network/docs/care/development/guidelines-to-write-cypress/)

- Since we are connected to the dev backend, create a new user in the platform and update the fixture and use that ID for this test
- Create a new file called patient_locationt.cy.ts and related object file

Things to be Covered

- [ ] Create a new multi-type location (Room, Bed, and House) and verify that the location search functions correctly. (Test-1)
- [ ] Create a new bed location, navigate to the encounter page, open any live encounter, and confirm that you can assign the patient to the new location in the "Manage Location" section. (Test-2)
Linked issue comments: user: login: AdityaP700
created_at: 2025-03-03T08:59:08Z
body: @nihal467 This looks like an interesting E2E issue, but I have a few queries regarding location creation and updates to ensure the test covers necessary scenarios:

- In Test-1, should it create all three location types (Room, Bed, House) within a single test, or would it be better to have separate tests for each type to ensure more granular validation?
- In Test-2, What should happen if the assigned location is already occupied? Should it include error handling scenarios in the test?
Looking for the insights
author_association: CONTRIBUTOR
user: login: nihal467
created_at: 2025-03-03T09:51:14Z
body:  @AdityaP700 

Since there are only three location types, we should keep them in a single test rather than separating them. Splitting them would add unnecessary steps and increase execution time without any additional benefit.
Currently, if a location is already occupied, it does not appear in the dropdown. Since we're connected to the local development backend, this could lead to flaky tests. To avoid this, we should ignore the occupied locations for now.
author_association: MEMBER
user: login: AdityaP700
created_at: 2025-03-03T09:55:00Z
body: Alright i see ,thanks for the clarification . Well i know it's an extensive issue to work on but i would like to have my hands on this issue ,Thus if you consider me assigning me this issue i will surely try and make the things work within a few days . 
author_association: CONTRIBUTOR
user: login: Mahendar0701
created_at: 2025-03-11T14:50:41Z
body: @nihal467 can i take this. ETA within 3 days
author_association: CONTRIBUTOR
user: login: AdityaP700
created_at: 2025-03-11T15:08:09Z
body: @Mahendar0701 well got busy with my exams so wasn't able to work on it : but worked around 30% of this issue .For now I am in verge of competing test 1 soon and within 2 days it will be Solved 
author_association: CONTRIBUTOR
user: login: rajku-dev
created_at: 2025-03-19T12:45:53Z
body: > [@Mahendar0701](https://github.com/Mahendar0701) well got busy with my exams so wasn't able to work on it : but worked around 30% of this issue .For now I am in verge of competing test 1 soon and within 2 days it will be Solved

@AdityaP700 are you still working on this issue. if not then I would like to work on this 
ETA : 2 Days
author_association: CONTRIBUTOR
user: login: AdityaP700
created_at: 2025-03-19T14:27:38Z
body: @rajku-dev Well i would like to step out of this issue as i couldn't figure out 
author_association: CONTRIBUTOR
user: login: Mahendar0701
created_at: 2025-03-19T14:29:12Z
body: @rithviknishad @nihal467 can I take this eta 3 days
author_association: CONTRIBUTOR

Diff:
diff --git a/cypress/e2e/patient_spec/patient_location.cy.ts b/cypress/e2e/patient_spec/patient_location.cy.ts
new file mode 100644
index 00000000000..4c498568756
--- /dev/null
+++ b/cypress/e2e/patient_spec/patient_location.cy.ts
@@ -0,0 +1,120 @@
+import { PatientLocation } from "@/pageObject/Patients/PatientLocation";
+import { LocationData } from "@/pageObject/Patients/PatientLocation";
+import { FacilityCreation } from "@/pageObject/facility/FacilityCreation";
+import { viewPort } from "@/utils/viewPort";
+
+const facilityCreation = new FacilityCreation();
+const patientLocation = new PatientLocation();
+
+describe("Manage locations association to an encounter", () => {
+  beforeEach(() => {
+    cy.viewport(viewPort.desktop1080p.width, viewPort.desktop1080p.height);
+    cy.loginByApi("devdoctor3");
+    cy.visit("/");
+    facilityCreation.selectFacility("GHC Payyanur");
+  });
+
+  // it("Manage a bed association to an encounter", () => {
+  //   patientEncounter
+  //     .navigateToEncounters()
+  //     .clickInProgressEncounterFilter()
+  //     .openFirstEncounterDetails();
+
+  //   // Associate New Location to the first planned encounter
+  //   patientLocation
+  //     .clickAddLocationBadge()
+  //     .selectLocationBuilding("Block C")
+  //     .clickShowAvailableBeds()
+  //     .selectLocationBed("ICU")
+  //     .clickAssignBedButton()
+  //     .clickSaveBedButton()
+  //     .assertLocationAssociationSuccess()
+
+  //     // mark current location as completed
+  //     .clickAssociatedLocationBadge()
+  //     .clickUpdateLocationButton()
+  //     .clickCompleteBedStayButton()
+  //     .clickCompleteBedButton()
+  //     .assertLocationCompletedSuccess();
+  // });
+
+  it("Create a new Location", () => {
+    const formData: Array<LocationData> = [
+      // Room location form data with just required field eg. name
+      {
+        name: "Room 1",
+      },
+
+      // House location form data with all fields
+      {
+        form: "House",
+        name: "House 1",
+        description: "House description",
+        status: "Inactive",
+        opStatus: "Housekeeping",
+      },
+
+      // Bulk beds creation
+      {
+        form: "Bed",
+        name: "ICU",
+        bedsCount: "2 Beds",
+        description: "Location 1 description",
+        status: "Active",
+        opStatus: "Operational",
+      },
+    ];
+
+    // Set up form data for each type of location
+    const roomData = formData[0];
+    const houseData = formData[1];
+    const bedData = formData[2];
+
+    patientLocation
+      .navigateToSettings()
+      .clickLocationTab()
+
+      // Open Existing Location created by a super admin
+      .searchLocation("Block B")
+      .openFirstExistingLocation()
+
+      // Create Room Location with Room data and verify and delete it
+      .clickChildAddLocation()
+      .fillLocationData(roomData)
+      .interceptLocationCreationRequest()
+      .submitLocationForm()
+      .verifyLocationCreationAPICall()
+      .assertLocationCreationSuccess()
+      .searchChildLocation(roomData.name)
+      .interceptLocationDeletionAPICall()
+      .clickFirstDeleteLocationButton()
+      .assertLocationDeletionSuccess()
+      .verifyLocationDeletionAPICall()
+
+      // Create House Location with House data
+      .clickChildAddLocation()
+      .fillLocationData(houseData)
+      .interceptLocationCreationRequest()
+      .submitLocationForm()
+      .verifyLocationCreationAPICall()
+      .assertLocationCreationSuccess()
+      .searchChildLocation(houseData.name)
+      .interceptLocationDeletionAPICall()
+      .clickFirstDeleteLocationButton()
+      .assertLocationDeletionSuccess()
+      .verifyLocationDeletionAPICall()
+
+      // Create Multiple Bed Locations with Beds data
+      .clickChildAddLocation()
+      .fillLocationData(bedData)
+      .interceptLocationCreationRequest()
+      .submitLocationForm()
+      .verifyLocationCreationAPICall()
+      .assertMultipleBedsCreationSuccess(bedData.bedsCount)
+      .searchChildLocation(bedData.name)
+      .interceptLocationDeletionAPICall()
+      .clickFirstDeleteLocationButton()
+      .assertLocationDeletionSuccess()
+      .verifyLocationDeletionAPICall();
+  });
+});
diff --git a/cypress/fixtures/users.json b/cypress/fixtures/users.json
index ec2f39d2641..405a0e325d9 100644
--- a/cypress/fixtures/users.json
+++ b/cypress/fixtures/users.json
@@ -27,6 +27,14 @@
     "username": "development-doc2",
     "password": "Test@123"
   },
+  "devdoctor3": {
+    "username": "devdoctor3",
+    "password": "Test@123"
+  },
+  "devnurse3": {
+    "username": "devnurse3",
+    "password": "Test@123"
+  },
   "devadmin": {
     "username": "development-adm",
     "password": "Test@123"
@@ -39,10 +47,6 @@
     "username": "devnurse2",
     "password": "Test@123"
   },
-  "devnurse3": {
-    "username": "devnurse3",
-    "password": "Test@123"
-  },
   "devnurse4": {
     "username": "devnurse4",
     "password": "Test@123"
diff --git a/cypress/pageObject/Patients/PatientLocation.ts b/cypress/pageObject/Patients/PatientLocation.ts
new file mode 100644
index 00000000000..5d9f7d5357d
--- /dev/null
+++ b/cypress/pageObject/Patients/PatientLocation.ts
@@ -0,0 +1,248 @@
+export interface LocationData {
+  form?: string;
+  name: string;
+  bedsCount?: string;
+  description?: string;
+  status?: "Active" | "Inactive" | "Unknown";
+  opStatus?: string;
+}
+
+export class PatientLocation {
+  private selectors = {
+    locationForm: '[data-cy="location-form-options"]',
+    addChildLocationButton: '[data-cy="add-child-location-button"]',
+    sidebarContent: '[data-sidebar="content"]',
+    locationTab: '[data-cy="settings-locations-tab"]',
+    nameInput: '[data-cy="location-name-input"]',
+    bedCountsSelect: '[data-cy="bed-counts-select"]',
+    locationDescription: '[data-cy="location-description"]',
+    locationStatus: '[data-cy="location-status"]',
+    operationalStatus: '[data-cy="operational-status"]',
+    enableBulkCreation: '[data-cy="enable-bulk-creation-checkbox"]',
+    currentLocationBadge: '[data-cy="current-location-badge"]',
+    addLocationBadge: '[data-cy="add-encounter-location"]',
+    updateLocationButton: '[data-cy="update-encounter-location-button"]',
+    locationList: '[data-cy="location-assign-screen"]',
+    submitLocationAssociation: '[data-cy="location-navigation-buttons"]',
+    saveBedButton: '[data-cy="location-card-wrapper-save-button"]',
+    completeBedStayButton: '[data-cy="complete-bed-stay-button"]',
+    locationCard: '[data-cy="location-card-container"]',
+    locationSearchInput: '[data-cy="location-search-input"]',
+    viewDetailsLocationButton: '[data-cy="view-details-location-button"]',
+    locationChildSearchInput: '[data-cy="location-child-search-input"]',
+    deleteLocationButton: '[data-cy="delete-location-button"]',
+    removeLocationButton: '[data-cy="remove-location-button"]',
+    showAvailableBeds: "#available-only",
+  };
+
+  openFirstExistingLocation() {
+    cy.get(this.selectors.viewDetailsLocationButton).first().click();
+    return this;
+  }
+
+  clickFirstDeleteLocationButton() {
+    cy.get(this.selectors.deleteLocationButton).first().click();
+    cy.verifyAndClickElement(this.selectors.removeLocationButton, "Remove");
+    return this;
+  }
+
+  interceptLocationDeletionAPICall() {
+    cy.intercept("DELETE", `**/api/v1/facility/**`).as("deleteLocation");
+    return this;
+  }
+
+  verifyLocationDeletionAPICall() {
+    cy.wait("@deleteLocation").then((interception) => {
+      expect(interception.response?.statusCode).to.eq(204);
+    });
+    return this;
+  }
+
+  assertLocationDeletionSuccess() {
+    cy.verifyNotification("Location removed successfully");
+    return this;
+  }
+
+  searchLocation(locationName: string) {
+    cy.typeIntoField(this.selectors.locationSearchInput, locationName);
+    return this;
+  }
+
+  searchChildLocation(locationName: string) {
+    cy.typeIntoField(this.selectors.locationChildSearchInput, locationName, {
+      clearBeforeTyping: true,
+    });
+    return this;
+  }
+
+  // Navigation
+  navigateToSettings() {
+    cy.verifyAndClickElement(this.selectors.sidebarContent, "Settings");
+    return this;
+  }
+
+  clickLocationTab() {
+    cy.verifyAndClickElement(this.selectors.locationTab, "Location");
+    return this;
+  }
+
+  clickChildAddLocation() {
+    cy.verifyAndClickElement(
+      this.selectors.addChildLocationButton,
+      "Add Location",
+    );
+    return this;
+  }
+
+  selectLocationForm(locationForm: string) {
+    if (locationForm) {
+      cy.clickAndSelectOption(this.selectors.locationForm, locationForm);
+    }
+    return this;
+  }
+
+  enterLocationName(name: string, clearBeforeTyping: boolean = false) {
+    cy.typeIntoField(this.selectors.nameInput, name, { clearBeforeTyping });
+    return this;
+  }
+
+  enableBulkCreation(enableBulkCreation: boolean) {
+    if (enableBulkCreation) {
+      cy.get(this.selectors.enableBulkCreation).click();
+    }
+    return this;
+  }
+
+  selectBedCounts(bedCounts: string) {
+    if (bedCounts) {
+      cy.clickAndSelectOption(this.selectors.bedCountsSelect, bedCounts);
+    }
+    return this;
+  }
+
+  enterDescription(description: string) {
+    if (description) {
+      cy.typeIntoField(this.selectors.locationDescription, description);
+    }
+    return this;
+  }
+
+  selectLocationStatus(status: string) {
+    if (status) {
+      cy.clickAndSelectOption(this.selectors.locationStatus, status);
+    }
+    return this;
+  }
+
+  selectOperationalStatus(status: string) {
+    if (status) {
+      cy.clickAndSelectOption(this.selectors.operationalStatus, status);
+    }
+    return this;
+  }
+
+  fillLocationData(data: LocationData) {
+    this.selectLocationForm(data.form)
+      .enterLocationName(data.name)
+      .enableBulkCreation(data.form === "Bed")
+      .selectBedCounts(data.bedsCount)
+      .enterDescription(data.description)
+      .selectLocationStatus(data.status)
+      .selectOperationalStatus(data.opStatus);
+    return this;
+  }
+
+  interceptLocationCreationRequest() {
+    cy.intercept("POST", `**/api/v1/facility/**`).as("createLocation");
+    return this;
+  }
+
+  verifyLocationCreationAPICall() {
+    cy.wait("@createLocation").its("response.statusCode").should("eq", 200);
+    return this;
+  }
+
+  submitLocationForm() {
+    cy.clickSubmitButton("Create");
+    return this;
+  }
+
+  assertLocationCreationSuccess() {
+    cy.verifyNotification("Location Created");
+    return this;
+  }
+
+  assertMultipleBedsCreationSuccess(bedCount: string) {
+    cy.verifyNotification(`${bedCount} created successfully`);
+    return this;
+  }
+
+  clickAssociatedLocationBadge() {
+    cy.get(this.selectors.currentLocationBadge).click();
+    return this;
+  }
+
+  clickAddLocationBadge() {
+    cy.verifyAndClickElement(this.selectors.addLocationBadge, "Add Location");
+    return this;
+  }
+
+  clickUpdateLocationButton() {
+    cy.verifyAndClickElement(
+      this.selectors.updateLocationButton,
+      "Update Location",
+    );
+    return this;
+  }
+
+  selectLocationBuilding(locationName: string) {
+    cy.verifyAndClickElement(this.selectors.locationList, locationName);
+    return this;
+  }
+
+  selectLocationBed(locationName: string) {
+    cy.verifyAndClickElement(this.selectors.locationList, locationName);
+    return this;
+  }
+
+  clickShowAvailableBeds() {
+    cy.get(this.selectors.showAvailableBeds).click();
+    return this;
+  }
+
+  clickAssignBedButton() {
+    cy.verifyAndClickElement(
+      this.selectors.submitLocationAssociation,
+      "Assign Bed Now",
+    );
+    return this;
+  }
+
+  assertLocationCompletedSuccess() {
+    cy.verifyNotification("Bed Assigned Successfully");
+    return this;
+  }
+
+  assertLocationAssociationSuccess() {
+    cy.verifyNotification("Bed Assigned Successfully");
+    return this;
+  }
+
+  clickSaveBedButton() {
+    cy.verifyAndClickElement(this.selectors.saveBedButton, "Save");
+    return this;
+  }
+
+  clickCompleteBedButton() {
+    cy.verifyAndClickElement(this.selectors.saveBedButton, "Complete");
+    return this;
+  }
+
+  clickCompleteBedStayButton() {
+    cy.verifyAndClickElement(
+      this.selectors.completeBedStayButton,
+      "Complete Bed Stay",
+    );
+    return this;
+  }
+}
diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts
index bffcb8cd58a..086bcadfb29 100644
--- a/cypress/support/commands.ts
+++ b/cypress/support/commands.ts
@@ -55,7 +55,7 @@ Cypress.Commands.add(
           .type(value)
           .then(() => {
             // Select the filtered option from command menu
-            cy.get("[cmdk-list]")
+            cy.get("[cmdk-group]")
               .find("[cmdk-item]")
               .contains(value)
               .should("be.visible")
diff --git a/src/components/Location/LocationActionButtons.tsx b/src/components/Location/LocationActionButtons.tsx
index 87581a3281d..860648e5d14 100644
--- a/src/components/Location/LocationActionButtons.tsx
+++ b/src/components/Location/LocationActionButtons.tsx
@@ -38,6 +38,7 @@ export function LocationActionButtons({
     onClick: () => void;
     variant: "outline" | "primary" | "link";
     className?: string;
+    "data-cy"?: string;
   };
 
   const buttons: ActionButton[] = [];
@@ -48,6 +49,7 @@ export function LocationActionButtons({
       onClick: onCancel,
       variant: "link",
       className: "underline underline-offset-2",
+      "data-cy": "cancel-bed-plan-button",
     });
   }
 
@@ -56,6 +58,7 @@ export function LocationActionButtons({
     onClick: onMove,
     variant: "outline",
     className: "border-gray-400 shadow-sm",
+    "data-cy": "move-to-another-bed-button",
   });
 
   if (status === "active" && onComplete) {
@@ -64,6 +67,7 @@ export function LocationActionButtons({
       onClick: () => onComplete(location),
       variant: "outline",
       className: "border-gray-400 shadow-sm",
+      "data-cy": "complete-bed-stay-button",
     });
   }
 
@@ -84,6 +88,7 @@ export function LocationActionButtons({
           variant={button.variant}
           onClick={button.onClick}
           className={button.className}
+          data-cy={button["data-cy"]}
         >
           {button.label}
         </Button>
diff --git a/src/components/Location/LocationCardWrapper.tsx b/src/components/Location/LocationCardWrapper.tsx
index 05eb1510683..4ca52b3260a 100644
--- a/src/components/Location/LocationCardWrapper.tsx
+++ b/src/components/Location/LocationCardWrapper.tsx
@@ -166,6 +166,7 @@ export function LocationCardWrapper({
                 {t("cancel")}
               </Button>
               <Button
+                data-cy="location-card-wrapper-save-button"
                 variant="primary"
                 onClick={() => handleConfirmEdit(locationHistory)}
                 disabled={isPending}
diff --git a/src/components/Location/LocationSearch.tsx b/src/components/Location/LocationSearch.tsx
index 6ef43000935..d925ea08852 100644
--- a/src/components/Location/LocationSearch.tsx
+++ b/src/components/Location/LocationSearch.tsx
@@ -54,7 +54,11 @@ export function LocationSearch({
   });
   return (
     <Popover open={open} onOpenChange={setOpen}>
-      <PopoverTrigger asChild disabled={disabled}>
+      <PopoverTrigger
+        asChild
+        disabled={disabled}
+        data-cy="location-search-trigger"
+      >
         <div
           className="w-full h-9 px-3 rounded-md border border-gray-200 text-sm flex items-center justify-between cursor-pointer"
           role="combobox"
diff --git a/src/components/Location/LocationSheet.tsx b/src/components/Location/LocationSheet.tsx
index 41b53f1faad..6877ae0c99a 100644
--- a/src/components/Location/LocationSheet.tsx
+++ b/src/components/Location/LocationSheet.tsx
@@ -609,7 +609,7 @@ export function LocationSheet({
           (!activeLocation && !plannedLocations.length)
         ) {
           return (
-            <div className="space-y-2">
+            <div className="space-y-2" data-cy="location-assign-screen">
               {locationCards}
               <LocationNavigation
                 locations={allLocations}
@@ -637,7 +637,10 @@ export function LocationSheet({
                 onGoBack={goBack}
               />
 
-              <div className="mt-8 flex justify-end gap-2">
+              <div
+                className="mt-8 flex justify-end gap-2"
+                data-cy="location-navigation-buttons"
+              >
                 <Button
                   variant="outline"
                   onClick={() => {
diff --git a/src/components/Patient/PatientInfoCard.tsx b/src/components/Patient/PatientInfoCard.tsx
index 28aa19193e1..6570593920c 100644
--- a/src/components/Patient/PatientInfoCard.tsx
+++ b/src/components/Patient/PatientInfoCard.tsx
@@ -358,6 +358,7 @@ export default function PatientInfoCard(props: PatientInfoCardProps) {
                             className="capitalize gap-1 py-1 px-2 cursor-pointer hover:bg-secondary-100"
                             variant="outline"
                             title={`Current Location: ${props.encounter.current_location.name}`}
+                            data-cy="current-location-badge"
                           >
                             <CareIcon
                               icon="l-location-point"
@@ -408,6 +409,7 @@ export default function PatientInfoCard(props: PatientInfoCardProps) {
                                 <Button
                                   variant="outline"
                                   className="border-gray-400 w-full"
+                                  data-cy="update-encounter-location-button"
                                 >
                                   {t("update_location")}
                                 </Button>
@@ -424,7 +426,10 @@ export default function PatientInfoCard(props: PatientInfoCardProps) {
                         facilityId={props.encounter.facility.id}
                         encounter={encounter}
                         trigger={
-                          <div className="flex items-center gap-1 text-gray-950 py-0.5 cursor-pointer hover:bg-secondary-100">
+                          <div
+                            className="flex items-center gap-1 text-gray-950 py-0.5 cursor-pointer hover:bg-secondary-100"
+                            data-cy="add-encounter-location"
+                          >
                             <CareIcon
                               icon="l-location-point"
                               className="size-4 text-green-600"
diff --git a/src/pages/Encounters/EncounterList.tsx b/src/pages/Encounters/EncounterList.tsx
index f7607a6a406..cf6a10980bb 100644
--- a/src/pages/Encounters/EncounterList.tsx
+++ b/src/pages/Encounters/EncounterList.tsx
@@ -457,6 +457,7 @@ export function EncounterList({
                         {t("all_status")}
                       </TabsTrigger>
                       <TabsTrigger
+                        data-cy="planned-filter"
                         value="planned"
                         className="data-[state=active]:bg-primary/10 data-[state=active]:text-primary"
                         onClick={() =>
diff --git a/src/pages/Facility/settings/layout.tsx b/src/pages/Facility/settings/layout.tsx
index bc077f8a96f..b9a04a67ed1 100644
--- a/src/pages/Facility/settings/layout.tsx
+++ b/src/pages/Facility/settings/layout.tsx
@@ -96,6 +96,7 @@ export function SettingsLayout({ facilityId }: SettingsLayoutProps) {
               <TabsTrigger
                 value={tab.value}
                 className="border-b-2 border-transparent px-2 sm:px-4 py-2 text-gray-600 hover:text-gray-900 data-[state=active]:border-primary-500 data-[state=active]:bg-transparent data-[state=active]:shadow-none rounded-none"
+                data-cy={"settings-" + tab.value + "-tab"}
               >
                 {tab.label}
               </TabsTrigger>
diff --git a/src/pages/Facility/settings/locations/LocationForm.tsx b/src/pages/Facility/settings/locations/LocationForm.tsx
index d0c2307bc3f..95fbc10c77a 100644
--- a/src/pages/Facility/settings/locations/LocationForm.tsx
+++ b/src/pages/Facility/settings/locations/LocationForm.tsx
@@ -295,7 +295,10 @@ export default function LocationForm({
                 disabled={!!locationId}
               >
                 <FormControl>
-                  <SelectTrigger className="w-full">
+                  <SelectTrigger
+                    className="w-full"
+                    data-cy="location-form-options"
+                  >
                     <SelectValue />
                   </SelectTrigger>
                 </FormControl>
@@ -323,6 +326,7 @@ export default function LocationForm({
                   <Checkbox
                     checked={field.value}
                     onCheckedChange={field.onChange}
+                    data-cy="enable-bulk-creation-checkbox"
                   />
                 </FormControl>
                 <div className="space-y-1 leading-none">
@@ -345,7 +349,7 @@ export default function LocationForm({
                 <FormLabel>{t("number_of_beds")}</FormLabel>
                 <Select onValueChange={field.onChange} value={field.value}>
                   <FormControl>
-                    <SelectTrigger>
+                    <SelectTrigger data-cy="bed-counts-select">
                       <SelectValue placeholder={t("select_number_of_beds")} />
                     </SelectTrigger>
                   </FormControl>
@@ -370,7 +374,7 @@ export default function LocationForm({
             <FormItem>
               <FormLabel>{t("name")}</FormLabel>
               <FormControl>
-                <Input {...field} />
+                <Input {...field} data-cy="location-name-input" />
               </FormControl>
               <FormMessage />
             </FormItem>
@@ -484,7 +488,11 @@ export default function LocationForm({
             <FormItem>
               <FormLabel>{t("description")}</FormLabel>
               <FormControl>
-                <Textarea {...field} placeholder="Description" />
+                <Textarea
+                  {...field}
+                  placeholder="Description"
+                  data-cy="location-description"
+                />
               </FormControl>
               <FormMessage />
             </FormItem>
@@ -500,7 +508,7 @@ export default function LocationForm({
                 <FormLabel>{t("status")}</FormLabel>
                 <Select onValueChange={field.onChange} value={field.value}>
                   <FormControl>
-                    <SelectTrigger>
+                    <SelectTrigger data-cy="location-status">
                       <SelectValue />
                     </SelectTrigger>
                   </FormControl>
@@ -525,7 +533,7 @@ export default function LocationForm({
                 <FormLabel>{t("operational_status")}</FormLabel>
                 <Select onValueChange={field.onChange} value={field.value}>
                   <FormControl>
-                    <SelectTrigger>
+                    <SelectTrigger data-cy="operational-status">
                       <SelectValue />
                     </SelectTrigger>
                   </FormControl>
diff --git a/src/pages/Facility/settings/locations/LocationSettings.tsx b/src/pages/Facility/settings/locations/LocationSettings.tsx
index 6fcc9450e9a..e1125047801 100644
--- a/src/pages/Facility/settings/locations/LocationSettings.tsx
+++ b/src/pages/Facility/settings/locations/LocationSettings.tsx
@@ -267,6 +267,7 @@ export default function LocationSettings({
                     <div className="flex flex-col justify-between items-start gap-2 sm:gap-4">
                       <div className="flex flex-col md:flex-row justify-between items-center w-full gap-4">
                         <Input
+                          data-cy="location-search-input"
                           placeholder={t("search_by_name")}
                           defaultValue={searchQuery}
                           onChange={(e) => handleSearchChange(e.target.value)}
@@ -274,6 +275,7 @@ export default function LocationSettings({
                         />
                         <div className="flex flex-col sm:flex-row gap-2 w-full lg:w-auto">
                           <Button
+                            data-cy="add-main-location-button"
                             variant="primary"
                             onClick={handleAddLocation}
                             className="w-full sm:w-auto"
@@ -286,7 +288,10 @@ export default function LocationSettings({
                     </div>
 
                     <div className="space-y-4 overflow-hidden">
-                      <div className="grid grid-cols-1 md:grid-cols-1 lg:grid-cols-2 gap-4">
+                      <div
+                        className="grid grid-cols-1 md:grid-cols-1 lg:grid-cols-2 gap-4"
+                        data-cy="location-card-container"
+                      >
                         {isLoading ? (
                           <CardGridSkeleton count={2} />
                         ) : childLocations?.results?.length ? (
diff --git a/src/pages/Facility/settings/locations/LocationView.tsx b/src/pages/Facility/settings/locations/LocationView.tsx
index ba92bcc04cc..3af209944bf 100644
--- a/src/pages/Facility/settings/locations/LocationView.tsx
+++ b/src/pages/Facility/settings/locations/LocationView.tsx
@@ -231,6 +231,7 @@ export default function LocationView({
             <div className="flex flex-col xl:flex-row justify-between items-start w-full gap-4">
               <div className="w-full xl:w-72">
                 <Input
+                  data-cy="location-child-search-input"
                   placeholder={t("search_by_name")}
                   value={searchQuery}
                   onChange={(e) => {
@@ -246,6 +247,7 @@ export default function LocationView({
                   "mode" in location &&
                   location.mode === "kind" && (
                     <Button
+                      data-cy="add-child-location-button"
                       variant="primary"
                       onClick={handleAddLocation}
                       className="w-full sm:w-auto"
diff --git a/src/pages/Facility/settings/locations/components/LocationCard.tsx b/src/pages/Facility/settings/locations/components/LocationCard.tsx
index 310e99e04f7..3149c50033f 100644
--- a/src/pages/Facility/settings/locations/components/LocationCard.tsx
+++ b/src/pages/Facility/settings/locations/components/LocationCard.tsx
@@ -121,7 +121,7 @@ export function LocationCard({
             {!location.has_children && !location.current_encounter && (
               <AlertDialog>
                 <AlertDialogTrigger asChild>
-                  <Button variant="white">
+                  <Button variant="white" data-cy="delete-location-button">
                     <CareIcon icon="l-trash" />
                   </Button>
                 </AlertDialogTrigger>
@@ -139,6 +139,7 @@ export function LocationCard({
                   <AlertDialogFooter>
                     <AlertDialogCancel>{t("cancel")}</AlertDialogCancel>
                     <AlertDialogAction
+                      data-cy="remove-location-button"
                       onClick={() => removeLocation({})}
                       className={buttonVariants({ variant: "destructive" })}
                     >
@@ -150,6 +151,7 @@ export function LocationCard({
             )}
             <div className="ml-auto">
               <Button
+                data-cy="view-details-location-button"
                 variant="outline"
                 className="flex items-center gap-2"
                 onClick={() => onView?.(location)}


Reviews:
user: login: coderabbitai[bot]
body: **Actionable comments posted: 0**

<details>
<summary>🧹 Nitpick comments (9)</summary><blockquote>

<details>
<summary>cypress/fixtures/users.json (1)</summary><blockquote>

`30-32`: **Password format inconsistency detected**

The new "raj" user entry has a password "test@123" with a lowercase 't', while all other users in the fixture have passwords starting with an uppercase 'T' ("Test@123"). Consider updating for consistency unless this difference is intentional for testing purposes.

```diff
   "raj": {
     "username": "rajkumar",
-    "password": "test@123"
+    "password": "Test@123"
   }
```

</blockquote></details>
<details>
<summary>cypress/e2e/patient_spec/patient_location.cy.ts (4)</summary><blockquote>

`12-12`: **Consider using environment variables or configuration for test user credentials.**

The test is hardcoded to use the "raj" user. For better portability across environments, consider using a configurable user or environment variable.

```diff
-    cy.loginByApi("raj");
+    cy.loginByApi(Cypress.env('TEST_USER') || "raj");
```

---

`18-40`: **Extract test data to fixture files for better maintainability.**

The location test data is currently hardcoded in the test. Moving this to a fixture file would improve maintainability and allow reuse across different tests.

```diff
-    const formData: Array<LocationData> = [
-      {
-        form: "Room",
-        name: "Location 1",
-        description: "Location 1 description",
-        status: "Active",
-      },
-      {
-        form: "House",
-        name: "House 1",
-        description: "House description",
-        status: "Inactive",
-        opStatus: "Housekeeping",
-      },
-      {
-        form: "Bed",
-        name: "ICU",
-        bedsCount: "5 Beds",
-        description: "Location 1 description",
-        status: "Active",
-        opStatus: "Operational",
-      },
-    ];
+    cy.fixture('locationTestData').then((locationData) => {
+      const formData: Array<LocationData> = locationData;
```

---

`86-94`: **Add verification for location status update failure case.**

The test only handles the success path for location status updates. Consider adding handling for failure cases to increase test robustness.

```diff
      .fillEndTime(endTime)
      .interceptLocationUpdationRequest()
      .clickSaveStatusButton()
-     .assertLocationStatusUpdateSuccess()
+     .assertLocationStatusUpdateSuccess()
+     // Additional verification for error cases could be added here
+     // For example:
+     // .handlePossibleErrorStates()
```

---

`96-101`: **Verify UI state after location association.**

The test verifies the API calls and notifications but doesn't explicitly check that the UI was updated to reflect the new location association.

```diff
      .interceptLocationCreationRequest()
      .submitLocationAssociation()
-     .assertLocationAssociationSuccess();
+     .assertLocationAssociationSuccess()
+     .verifyLocationDisplayedInUI("ICU 5");
```

</blockquote></details>
<details>
<summary>cypress/pageObject/Patients/PatientLocation.ts (4)</summary><blockquote>

`104-107`: **API intercept patterns could be more specific.**

The API interception uses a very broad pattern that could potentially catch unintended requests.

```diff
  interceptLocationCreationRequest() {
-    cy.intercept("POST", `**/api/v1/facility/**`).as("createLocation");
+    cy.intercept("POST", `**/api/v1/facility/*/location/**`).as("createLocation");
    return this;
  }
```

---

`186-189`: **API update intercept could be more specific.**

Similar to the creation intercept, the update intercept uses a broad pattern.

```diff
  interceptLocationUpdationRequest() {
-    cy.intercept("PUT", `**/api/v1/facility/**`).as("updateLocation");
+    cy.intercept("PUT", `**/api/v1/facility/*/location/**`).as("updateLocation");
    return this;
  }
```

---

`119-122`: **Add error handling for notification assertions.**

The notification assertion methods don't include any error handling or timeout configurations. Consider adding timeouts and error handling for more robust tests.

```diff
  assertLocationCreationSuccess() {
-    cy.verifyNotification("Location Created");
+    cy.verifyNotification("Location Created", { timeout: 10000 })
+      .catch((error) => {
+        cy.log("Failed to verify notification: " + error.message);
+        throw error;
+      });
    return this;
  }
```


Also applies to: 124-127, 206-210, 212-216

---

`160-163`: **Add verification after location selection.**

After searching and selecting a location, consider adding a verification step to ensure the selection was successful.

```diff
  searchBedLocation(locationName: string) {
    cy.typeAndSelectOption(this.selectors.locationSearchTrigger, locationName);
+    // Verify the selected location is displayed
+    cy.get('[data-cy="selected-location"]').should('contain', locationName);
    return this;
  }
```

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 4cd23fb7bd32eecf516bce26a73b547df3b71803 and 34b2e27d5b5ae1f8901fd4b0610b51ad4e860c6c.

</details>

<details>
<summary>📒 Files selected for processing (10)</summary>

* `cypress/e2e/patient_spec/patient_location.cy.ts` (1 hunks)
* `cypress/fixtures/users.json` (1 hunks)
* `cypress/pageObject/Patients/PatientLocation.ts` (1 hunks)
* `cypress/support/commands.ts` (1 hunks)
* `src/components/Location/LocationSearch.tsx` (1 hunks)
* `src/components/Location/LocationSheet.tsx` (4 hunks)
* `src/components/Patient/PatientInfoCard.tsx` (3 hunks)
* `src/pages/Facility/settings/layout.tsx` (1 hunks)
* `src/pages/Facility/settings/locations/LocationForm.tsx` (7 hunks)
* `src/pages/Facility/settings/locations/LocationList.tsx` (1 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🧠 Learnings (1)</summary>

<details>
<summary>cypress/e2e/patient_spec/patient_location.cy.ts (1)</summary>

```
Learnt from: Jacobjeevan
PR: ohcnetwork/care_fe#9145
File: cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts:93-94
Timestamp: 2025-03-19T13:42:09.579Z
Learning: In `cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts`, bed capacity verification assertions after patient admission are already being performed elsewhere, so adding them here is unnecessary.
```

</details>

</details>

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (1)</summary>

* GitHub Check: cypress-run (1)

</details>

<details>
<summary>🔇 Additional comments (22)</summary><blockquote>

<details>
<summary>src/pages/Facility/settings/locations/LocationList.tsx (1)</summary>

`272-276`: **LGTM: Added data-cy attribute for test automation**

The addition of the `data-cy="add-location-button"` attribute improves testability of the component by providing a stable selector for Cypress tests.

</details>
<details>
<summary>src/components/Location/LocationSearch.tsx (1)</summary>

`57-61`: **LGTM: Added data-cy attribute for test automation**

The addition of the `data-cy="location-search-trigger"` attribute provides a reliable selector for Cypress tests to interact with the location search component.

</details>
<details>
<summary>cypress/support/commands.ts (1)</summary>

`58-58`: <details>
<summary>❓ Verification inconclusive</summary>

**DOM selector update for command menu interaction**

The selector change from `[cmdk-list]` to `[cmdk-group]` indicates a structure change in the command menu component. This update is necessary to ensure the `typeAndSelectOption` custom command works correctly with the current DOM structure.

If this custom command is widely used in existing tests, verify that they continue to work with this updated selector.


---

🏁 Script executed:

```shell
#!/bin/bash
# Check for other occurrences of the old selector to ensure all have been updated
echo "Searching for other instances of [cmdk-list] that might need updating:"
rg "\[cmdk-list\]" --type ts cypress/
```

Length of output: 190

---



</details>

**DOM Selector Update Verified – Please Confirm Test Stability**

- The change from `[cmdk-list]` to `[cmdk-group]` in `cypress/support/commands.ts` (line 58) looks correct.
- A repository-wide search for `[cmdk-list]` in the Cypress files returned no additional occurrences, suggesting that the update is consistently applied.
- Since this custom command is used across various tests, please manually verify that all test scenarios interact correctly with the updated DOM structure.

</details>
<details>
<summary>src/pages/Facility/settings/layout.tsx (1)</summary>

`99-99`: **Good addition of test selector.**

Adding the data-cy attribute to the TabsTrigger component improves testability by providing a clear, predictable selector for E2E tests. The dynamic construction of the attribute value from the tab value creates a consistent pattern.

</details>
<details>
<summary>src/components/Patient/PatientInfoCard.tsx (3)</summary>

`354-354`: **Good addition of test selector for current location badge.**

Adding the data-cy attribute to this Badge component will make it easier to target in Cypress tests when verifying location information.

---

`405-405`: **Good addition of test selector for location update button.**

Adding the data-cy attribute to this Button component improves testability for the location update functionality.

---

`422-425`: **Good addition of test selector for adding encounter location.**

Adding the data-cy attribute to this div element makes it easier to trigger location addition events in automated tests.

</details>
<details>
<summary>src/components/Location/LocationSheet.tsx (4)</summary>

`232-235`: **Good addition of test selector for location status selection.**

Adding the data-cy attribute to the SelectTrigger component will make it easier to target in Cypress tests when verifying or changing location status.

---

`255-255`: **Good addition of test selector for updating location status.**

Adding the data-cy attribute to this Button component improves testability for the status update functionality.

---

`306-306`: **Good addition of test selector for end date input.**

Adding the data-cy attribute to this Input component will make it easier to target and modify end dates in Cypress tests.

---

`437-437`: **Good addition of test selector for location association submission.**

Adding the data-cy attribute to this Button component will make it easier to trigger location association submissions in automated tests.

</details>
<details>
<summary>src/pages/Facility/settings/locations/LocationForm.tsx (7)</summary>

`299-302`: **Good addition of test selector for location form options.**

Adding the data-cy attribute to the SelectTrigger component will make it easier to select location types in Cypress tests.

---

`330-330`: **Good addition of test selector for bulk creation checkbox.**

Adding the data-cy attribute to the Checkbox component improves testability for the bulk bed creation functionality.

---

`353-353`: **Good addition of test selector for bed count selection.**

Adding the data-cy attribute to the SelectTrigger component will make it easier to select bed counts in Cypress tests.

---

`378-378`: **Good addition of test selector for location name input.**

Adding the data-cy attribute to the Input component will make it easier to enter location names in Cypress tests.

---

`492-496`: **Good addition of test selector for location description.**

Adding the data-cy attribute to the Textarea component will make it easier to enter location descriptions in Cypress tests.

---

`512-512`: **Good addition of test selector for location status.**

Adding the data-cy attribute to the SelectTrigger component will make it easier to select location status in Cypress tests.

---

`537-537`: **Good addition of test selector for operational status.**

Adding the data-cy attribute to the SelectTrigger component will make it easier to select operational status in Cypress tests.

</details>
<details>
<summary>cypress/pageObject/Patients/PatientLocation.ts (4)</summary>

`1-8`: **Well-structured interface with appropriate property types.**

The LocationData interface is well-defined with proper typing for location properties.

---

`10-31`: **Good use of data-cy attributes for selectors.**

The selectors are well-organized and consistently use data-cy attributes, which is a good practice for test stability.

---

`93-102`: **The fillLocationData method is well-structured and flexible.**

This method efficiently handles different types of location data with appropriate conditional logic for optional fields.

---

`48-91`: **Well-implemented chainable methods for form interactions.**

The form interaction methods follow the builder pattern correctly, consistently return 'this', and handle conditional cases appropriately.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-22T06:18:59Z
user: login: coderabbitai[bot]
body: **Actionable comments posted: 1**

<details>
<summary>🧹 Nitpick comments (2)</summary><blockquote>

<details>
<summary>cypress/e2e/patient_spec/patient_location.cy.ts (2)</summary><blockquote>

`44-76`: **Well-structured test flow for creating locations.**

The test flow effectively creates three different types of locations (Room, House, and Bulk Beds) with appropriate verifications at each step. The chained method pattern improves readability.


However, consider adding assertions to verify that the created locations appear in the UI list after creation for a more comprehensive test.

---

`94-110`: **Consider adding error recovery mechanisms.**

The test assumes a happy path. Consider adding error handling or recovery strategies if a step fails, especially for the dissociation flow which has multiple steps.


Also, the test would benefit from a cleanup step that ensures all created test data is removed after the test completes, ensuring repeatability.

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 34b2e27d5b5ae1f8901fd4b0610b51ad4e860c6c and fd1e91774ae4a9e3c45522dacfd6902ed5907f9d.

</details>

<details>
<summary>📒 Files selected for processing (3)</summary>

* `cypress/e2e/patient_spec/patient_location.cy.ts` (1 hunks)
* `cypress/pageObject/Patients/PatientLocation.ts` (1 hunks)
* `src/pages/Encounters/EncounterList.tsx` (1 hunks)

</details>

<details>
<summary>✅ Files skipped from review due to trivial changes (1)</summary>

* src/pages/Encounters/EncounterList.tsx

</details>

<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary>

* cypress/pageObject/Patients/PatientLocation.ts

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🧠 Learnings (1)</summary>

<details>
<summary>cypress/e2e/patient_spec/patient_location.cy.ts (1)</summary>

```
Learnt from: Jacobjeevan
PR: ohcnetwork/care_fe#9145
File: cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts:93-94
Timestamp: 2025-03-19T13:42:09.579Z
Learning: In `cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts`, bed capacity verification assertions after patient admission are already being performed elsewhere, so adding them here is unnecessary.
```

</details>

</details>

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (1)</summary>

* GitHub Check: cypress-run (1)

</details>

<details>
<summary>🔇 Additional comments (4)</summary><blockquote>

<details>
<summary>cypress/e2e/patient_spec/patient_location.cy.ts (4)</summary>

`1-7`: **Imports and initialization look good.**

The PageObject pattern is well-implemented with clear separation of concerns between the PatientLocation, LocationData, and FacilityCreation classes.

---

`17-42`: **Well-structured test data for different location types.**

The test data is clearly organized for each location type with appropriate comments. This approach makes the test data maintainable and easy to understand.

---

`1-111`: <details>
<summary>✅ Verification successful</summary>

**Add assertions to verify the impact on bed capacity.**

Based on the retrieved learning from PR #9145, consider whether this test should include assertions to verify bed capacity after patient location changes. If these verifications are already being performed elsewhere, it might be redundant to add them here.

---

🏁 Script executed:

```shell
#!/bin/bash
# Check if bed capacity verifications exist elsewhere
echo "Checking for bed capacity verifications in other tests..."
grep -r "capacity" cypress/e2e/patient_spec/
```

Length of output: 169

---



</details>

**Directive: Avoid redundant bed capacity assertions in patient location tests**

The current implementation already verifies the creation of multiple bed locations via the `assertMultipleBedsCreationSuccess` method. Based on the learning from PR #9145—as bed capacity assertions are performed in the patient admission test (i.e. in `PatientConsultationCreation.cy.ts`)—adding further bed capacity verifications in this test appears unnecessary.

- **Location:** `cypress/e2e/patient_spec/patient_location.cy.ts`
- **Rationale:** The existing multiple beds creation assertion already covers the intended behavior, and duplicating this check could lead to redundant tests.

---

`78-93`: <details>
<summary>❓ Verification inconclusive</summary>

**Verify the availability of "ICU 5" before test execution.**

The test assumes "ICU 5" exists or will be created by the first test. If these tests run independently or in parallel, this might cause failures.

---

🏁 Script executed:

```shell
#!/bin/bash
# Check for dependencies between tests
echo "Checking if beds are dynamically created with 'ICU' prefix..."
grep -r "bedsCount" cypress/pageObject/Patients/PatientLocation.ts
```

Length of output: 266

---



</details>

**Action Required: Ensure "ICU 5" is Available Prior to Test Execution**

The test in `cypress/e2e/patient_spec/patient_location.cy.ts` (lines 78–93) uses a hardcoded `"ICU 5"` when associating a new location. While the related page object (`cypress/pageObject/Patients/PatientLocation.ts`) indicates dynamic handling via `bedsCount`, there's no mechanism ensuring that `"ICU 5"` is actually available before the test runs. If tests are executed independently or in parallel, this dependency could lead to failures.

- **Suggestion:** Add a precondition step (or fixture) that verifies or creates `"ICU 5"` before running this test, ensuring consistency regardless of test execution order.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-23T03:58:09Z
user: login: nihal467
body: - make sure, all the test you created is passing CI/CD before you request a review
state: CHANGES_REQUESTED
author_association: MEMBER
submitted_at: 2025-03-27T17:19:45Z
user: login: rajku-dev
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-31T13:53:13Z
user: login: rajku-dev
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-05T07:19:34Z
user: login: rajku-dev
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-05T07:19:43Z
user: login: rajku-dev
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-05T07:24:35Z
user: login: rajku-dev
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-05T07:30:05Z
user: login: coderabbitai[bot]
body: **Actionable comments posted: 0**

<details>
<summary>🧹 Nitpick comments (5)</summary><blockquote>

<details>
<summary>cypress/pageObject/Patients/PatientLocation.ts (5)</summary><blockquote>

`1-8`: **Interface type improvements**

The interface design is good, but consider refining the types for better type safety:

```diff
export interface LocationData {
  form?: string;
  name: string;
-  bedsCount?: string;
+  bedsCount?: number; // Using number type for better semantic meaning
  description?: string;
  status?: "Active" | "Inactive" | "Unknown";
-  opStatus?: string;
+  opStatus?: string; // Consider using a union type like status for consistency
}
```

---

`155-209`: **Consider adding JSDoc comments for better documentation**

While the method names are descriptive, adding JSDoc comments would improve code documentation and help other developers understand the purpose and usage of each method.

```diff
+ /**
+  * Searches for a bed location by name and selects it from the dropdown
+  * @param locationName - The name of the location to search for
+  * @returns this - For method chaining
+  */
 searchBedLocation(locationName: string) {
   cy.typeAndSelectOption(this.selectors.locationSearchTrigger, locationName);
   return this;
 }
```

---

`82-94`: **Align method parameter types with the interface**

The `selectLocationStatus` method accepts any string, but the `LocationData` interface restricts status to specific values. Consider aligning the parameter type with the interface:

```diff
- selectLocationStatus(status: string) {
+ selectLocationStatus(status: "Active" | "Inactive" | "Unknown" | string) {
   if (status) {
     cy.clickAndSelectOption(this.selectors.locationStatus, status);
   }
   return this;
 }
```

---

`211-231`: **Consider adding error handling for API calls**

The API verification methods check for success status codes but don't handle potential failure scenarios. Consider adding more robust error handling to make tests more resilient:

```diff
 verifyLocationUpdateAPICall() {
-  cy.wait("@updateLocation").its("response.statusCode").should("eq", 200);
+  cy.wait("@updateLocation", { timeout: 10000 }).then(interception => {
+    if (interception.response.statusCode !== 200) {
+      cy.log(`API call failed with status: ${interception.response.statusCode}`);
+      cy.log(`Response body: ${JSON.stringify(interception.response.body)}`);
+    }
+    expect(interception.response.statusCode).to.eq(200);
+  });
   return this;
 }
```

---

`10-232`: **Overall class structure and organization**

Consider organizing the methods into logical groups with comments to improve readability:

```typescript
export class PatientLocation {
  private selectors = { /* ... */ };

  // Navigation methods
  navigateToSettings() { /* ... */ }
  clickLocationTab() { /* ... */ }
  // ...

  // Form interaction methods
  selectLocationForm(locationForm: string) { /* ... */ }
  enterLocationName(name: string) { /* ... */ }
  // ...

  // API interception methods
  interceptLocationCreationRequest() { /* ... */ }
  verifyLocationCreationAPICall() { /* ... */ }
  // ...

  // Assertion methods
  assertLocationCreationSuccess() { /* ... */ }
  assertMultipleBedsCreationSuccess(bedCount: string) { /* ... */ }
  // ...
}
```

Also, consider extracting magic strings to constants for better maintainability:

```typescript
private static readonly NOTIFICATIONS = {
  LOCATION_CREATED: "Location Created",
  LOCATION_UPDATED: "Location association updated successfully",
  LOCATION_ASSOCIATED: "Location association created successfully"
};
```

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between fc322419839606e100c00d25faffdc133c603856 and 8354a8d223c984bd692f5e7a15177e82d4557d7d.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `cypress/pageObject/Patients/PatientLocation.ts` (1 hunks)

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (1)</summary>

* GitHub Check: cypress-run (1)

</details>

<details>
<summary>🔇 Additional comments (6)</summary><blockquote>

<details>
<summary>cypress/pageObject/Patients/PatientLocation.ts (6)</summary>

`11-31`: **Good use of data-cy selectors**

Using data-cy attributes for selectors is a good practice for maintainability. The selectors are well-organized in a private object, making them easy to update if the UI changes.

---

`33-47`: **Consistent use of custom commands**

Good implementation of the navigation methods using `verifyAndClickElement` as suggested in the previous review. The fluent interface pattern with `return this` allows for better readability through method chaining.

---

`49-105`: **Form interaction methods follow good practices**

The form interaction methods are well-implemented with:
- Optional parameters and conditional logic
- Reuse of custom commands
- Consistent return of `this` for method chaining
- Proper encapsulation of UI interactions

The `fillLocationData` method effectively orchestrates multiple form interactions, demonstrating good use of the builder pattern.

---

`107-125`: **API interception pattern is well-implemented**

Good use of Cypress's intercept functionality to monitor API calls. The methods properly alias the requests and verify the response status codes.

---

`132-153`: **Potential duplicate method identified**

As noted in previous review comments, the `openFirstEncounterDetails` method may duplicate existing functionality. Consider reusing an existing method if available instead of creating a new one.

---

`96-105`: **Well-structured method for filling location data**

The `fillLocationData` method effectively composes multiple form interactions in a clean, chainable way. This approach reduces duplication and encapsulates the form-filling logic nicely.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-05T07:36:24Z
user: login: coderabbitai[bot]
body: **Actionable comments posted: 0**

<details>
<summary>🧹 Nitpick comments (1)</summary><blockquote>

<details>
<summary>cypress/e2e/patient_spec/patient_location.cy.ts (1)</summary><blockquote>

`40-118`: **Consider splitting location creation tests for better isolation.**

While the current approach works, consider splitting this into three separate test cases (one for each location type) for better test isolation and more focused failures:

```javascript
it("Create a Room location", () => {
  const roomData = {
    name: "Room 1",
  };
  
  patientLocation
    .navigateToSettings()
    .clickLocationTab()
    // Room creation steps...
});

it("Create a House location", () => {
  const houseData = {
    form: "House",
    name: "House 1",
    description: "House description",
    status: "Inactive",
    opStatus: "Housekeeping",
  };
  
  patientLocation
    .navigateToSettings()
    .clickLocationTab()
    // House creation steps...
});

it("Create multiple Bed locations", () => {
  const bedData = {
    form: "Bed",
    name: "ICU",
    bedsCount: "2 Beds",
    description: "Location 1 description",
    status: "Active",
    opStatus: "Operational",
  };
  
  patientLocation
    .navigateToSettings()
    .clickLocationTab()
    // Bed creation steps...
});
```

This approach makes it clearer which test is failing and allows for more targeted test runs.

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 8354a8d223c984bd692f5e7a15177e82d4557d7d and fdceb29a3d1364fb62d1cc257fcf9cd956b32c6d.

</details>

<details>
<summary>📒 Files selected for processing (9)</summary>

* `cypress/e2e/patient_spec/patient_location.cy.ts` (1 hunks)
* `cypress/fixtures/users.json` (1 hunks)
* `cypress/pageObject/Patients/PatientLocation.ts` (1 hunks)
* `src/components/Location/LocationActionButtons.tsx` (5 hunks)
* `src/components/Location/LocationCardWrapper.tsx` (1 hunks)
* `src/components/Location/LocationSheet.tsx` (2 hunks)
* `src/pages/Facility/settings/locations/LocationSettings.tsx` (2 hunks)
* `src/pages/Facility/settings/locations/LocationView.tsx` (2 hunks)
* `src/pages/Facility/settings/locations/components/LocationCard.tsx` (3 hunks)

</details>

<details>
<summary>✅ Files skipped from review due to trivial changes (4)</summary>

* src/pages/Facility/settings/locations/LocationSettings.tsx
* src/components/Location/LocationCardWrapper.tsx
* src/components/Location/LocationSheet.tsx
* src/pages/Facility/settings/locations/components/LocationCard.tsx

</details>

<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (2)</summary>

* cypress/fixtures/users.json
* cypress/pageObject/Patients/PatientLocation.ts

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🧠 Learnings (1)</summary>

<details>
<summary>cypress/e2e/patient_spec/patient_location.cy.ts (1)</summary>

```
Learnt from: Jacobjeevan
PR: ohcnetwork/care_fe#9145
File: cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts:93-94
Timestamp: 2025-04-02T18:04:40.623Z
Learning: In `cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts`, bed capacity verification assertions after patient admission are already being performed elsewhere, so adding them here is unnecessary.
```

</details>

</details>

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (3)</summary>

* GitHub Check: Test
* GitHub Check: OSSAR-Scan
* GitHub Check: cypress-run (1)

</details>

<details>
<summary>🔇 Additional comments (13)</summary><blockquote>

<details>
<summary>src/pages/Facility/settings/locations/LocationView.tsx (2)</summary>

`233-242`: **Good addition of data-cy attribute for test selection.**

Adding the data-cy attribute to the search input makes this component easily targetable in the new Cypress tests, improving testability without affecting functionality.

---

`249-258`: **Good addition of data-cy attribute for test selection.**

Adding the data-cy attribute to the "Add Location" button makes this component easily targetable in the new Cypress tests, improving testability without affecting functionality.

</details>
<details>
<summary>src/components/Location/LocationActionButtons.tsx (5)</summary>

`36-42`: **Good addition of data-cy property to type definition.**

Adding the optional data-cy property to the ActionButton type definition is the correct approach for allowing test attributes on these components.

---

`46-54`: **Good addition of data-cy attribute for testing the cancel plan button.**

The data-cy attribute allows for precise targeting of this button in Cypress tests, improving testability.

---

`56-62`: **Good addition of data-cy attribute for testing the move bed button.**

The data-cy attribute allows for precise targeting of this button in Cypress tests, improving testability.

---

`64-72`: **Good addition of data-cy attribute for testing the complete bed stay button.**

The data-cy attribute allows for precise targeting of this button in Cypress tests, improving testability.

---

`85-95`: **Good implementation of passing data-cy to Button component.**

The Button component correctly receives the data-cy attribute from the button object, completing the implementation for test targeting.

</details>
<details>
<summary>cypress/e2e/patient_spec/patient_location.cy.ts (6)</summary>

`10-15`: **Use a fixture for user authentication instead of hardcoding.**

I see you've changed the user from "raj" to "devdoctor3" as requested in previous comments, but it's still hardcoded. To make tests more robust and maintainable, load user credentials from a fixture:

```diff
beforeEach(() => {
  cy.viewport(viewPort.desktop1080p.width, viewPort.desktop1080p.height);
-  cy.loginByApi("devdoctor3");
+  cy.fixture('users').then((users) => {
+    cy.loginByApi(users.devdoctor3);
+  });
  cy.visit("/");
  facilityCreation.selectFacility("GHC Payyanur");
});
```

This approach centralizes user data management and makes tests more flexible when credentials change.

---

`17-38`: **Well-structured test for bed association and dissociation.**

This test case effectively uses the Page Object Model pattern with a fluent API style, making the test readable and maintainable. The sequence of operations clearly tests the full lifecycle of bed association with an encounter.

---

`40-65`: **Good use of test data objects for different location types.**

The structured approach to defining test data for different location types (Room, House, Beds) makes the test maintainable and easy to understand. The comments help clarify the purpose of each data object.

---

`77-92`: **Well-implemented flow for Room location creation and verification.**

This section correctly tests the complete lifecycle of creating, verifying, and deleting a Room location, including API intercepts to verify backend interactions.

---

`93-105`: **Well-implemented flow for House location creation and verification.**

This section correctly tests the complete lifecycle of creating, verifying, and deleting a House location, including API intercepts to verify backend interactions.

---

`106-118`: **Well-implemented flow for Multiple Beds creation and verification.**

This section correctly tests the complete lifecycle of creating, verifying, and deleting multiple Bed locations, including API intercepts to verify backend interactions.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-05T11:42:40Z
user: login: coderabbitai[bot]
body: **Actionable comments posted: 1**

<details>
<summary>🧹 Nitpick comments (3)</summary><blockquote>

<details>
<summary>cypress/e2e/patient_spec/patient_location.cy.ts (3)</summary><blockquote>

`19-41`: **Test relies on existing encounter data which may not be present**

The test assumes there will always be an in-progress encounter available. If there are no in-progress encounters, this test will fail.

Consider creating a test encounter first or adding a check to skip the test if no suitable encounters are found:

```diff
it("Manage a bed association to an encounter", () => {
  patientEncounter
    .navigateToEncounters()
    .clickInProgressEncounterFilter();
+   
+   // Check if encounters exist before proceeding
+   cy.get('[data-cy="encounter-list-item"]').then($encounters => {
+     if ($encounters.length === 0) {
+       cy.log('No in-progress encounters found. Skipping test.');
+       return;
+     }
+     
      patientEncounter.openFirstEncounterDetails();
      
      // Rest of the test...
+   });
});
```

---

`43-68`: **Test data could be moved to fixtures for better maintainability**

Test data is currently hardcoded in the test file. Moving it to fixtures would improve maintainability and reusability.

Consider creating a fixture file for location test data:

```diff
+ // Create a new file: cypress/fixtures/location_data.json with the following content:
+ // [
+ //   {
+ //     "name": "Room 1"
+ //   },
+ //   {
+ //     "form": "House",
+ //     "name": "House 1",
+ //     "description": "House description",
+ //     "status": "Inactive",
+ //     "opStatus": "Housekeeping"
+ //   },
+ //   {
+ //     "form": "Bed",
+ //     "name": "ICU",
+ //     "bedsCount": "2 Beds",
+ //     "description": "Location 1 description",
+ //     "status": "Active",
+ //     "opStatus": "Operational"
+ //   }
+ // ]

it("Create a new Location", () => {
-   const formData: Array<LocationData> = [
-     // Room location form data with just required field eg. name
-     {
-       name: "Room 1",
-     },
-
-     // House location form data with all fields
-     {
-       form: "House",
-       name: "House 1",
-       description: "House description",
-       status: "Inactive",
-       opStatus: "Housekeeping",
-     },
-
-     // Bulk beds creation
-     {
-       form: "Bed",
-       name: "ICU",
-       bedsCount: "2 Beds",
-       description: "Location 1 description",
-       status: "Active",
-       opStatus: "Operational",
-     },
-   ];
+   let formData: Array<LocationData>;
+   cy.fixture('location_data').then((data) => {
+     formData = data;
+     
      // Set up form data for each type of location
      const roomData = formData[0];
      const houseData = formData[1];
      const bedData = formData[2];
      
      // Rest of the test...
+   });
});
```

---

`80-82`: **Add error handling for searching existing location**

The test assumes "Block B" location exists. If it doesn't, the test will fail without a clear error message.

```diff
- .searchLocation("Block B")
- .openFirstExistingLocation()
+ .searchLocation("Block B")
+ .then(() => {
+   cy.get('[data-cy="location-card-container"]').then($locations => {
+     if ($locations.length === 0) {
+       cy.log('Location "Block B" not found. Creating it first...');
+       // Logic to create the parent location if needed
+     } else {
+       patientLocation.openFirstExistingLocation();
+     }
+   });
+ })
```

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between fdceb29a3d1364fb62d1cc257fcf9cd956b32c6d and ecb4c6ab582147ccf089044e0d26c579175e5362.

</details>

<details>
<summary>📒 Files selected for processing (2)</summary>

* `cypress/e2e/patient_spec/patient_location.cy.ts` (1 hunks)
* `cypress/pageObject/Patients/PatientLocation.ts` (1 hunks)

</details>

<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary>

* cypress/pageObject/Patients/PatientLocation.ts

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🧠 Learnings (1)</summary>

<details>
<summary>cypress/e2e/patient_spec/patient_location.cy.ts (1)</summary>

```
Learnt from: Jacobjeevan
PR: ohcnetwork/care_fe#9145
File: cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts:93-94
Timestamp: 2025-04-02T18:04:40.623Z
Learning: In `cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts`, bed capacity verification assertions after patient admission are already being performed elsewhere, so adding them here is unnecessary.
```

</details>

</details><details>
<summary>🧬 Code Definitions (1)</summary>

<details>
<summary>cypress/e2e/patient_spec/patient_location.cy.ts (1)</summary><blockquote>

<details>
<summary>cypress/pageObject/Patients/PatientLocation.ts (2)</summary>

* `PatientLocation` (10-248)
* `LocationData` (1-8)

</details>

</blockquote></details>

</details>

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (1)</summary>

* GitHub Check: cypress-run (1)

</details>

<details>
<summary>🔇 Additional comments (2)</summary><blockquote>

<details>
<summary>cypress/e2e/patient_spec/patient_location.cy.ts (2)</summary>

`13-14`: **Consider using a fixture for authentication instead of hardcoded username**

Loading the user from a fixture would make the test more maintainable and flexible across different environments.

```diff
- cy.loginByApi("devdoctor3");
+ cy.fixture('users').then((users) => {
+   cy.loginByApi(users.devdoctor3);
+ });
```

---

`1-122`: **LGTM overall - well-structured tests with good use of page objects and builder pattern**

The test file is well-structured using page objects and a clean builder pattern which enhances readability and maintainability. The test scenarios cover important functionality for location management including:

1. Association of a location to an encounter
2. Creation of different types of locations (Room, House, Beds)
3. Proper cleanup by deleting test data

Good job using intercepts to verify API calls and assertions to validate expected behaviors.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-05T12:13:06Z
user: login: nihal467
state: APPROVED
author_association: MEMBER
submitted_at: 2025-04-05T13:31:49Z
user: login: khavinshankar
state: APPROVED
author_association: MEMBER
submitted_at: 2025-04-05T13:32:59Z

Review comments:
diff_hunk: @@ -0,0 +1,111 @@
+import { PatientLocation } from "@/pageObject/Patients/PatientLocation";
+import { LocationData } from "@/pageObject/Patients/PatientLocation";
+import { FacilityCreation } from "@/pageObject/facility/FacilityCreation";
+import { viewPort } from "@/utils/viewPort";
+
+const facilityCreation = new FacilityCreation();
+const patientLocation = new PatientLocation();
+
+describe("Add a new Location and associate to an Encounter", () => {
+  beforeEach(() => {
+    cy.viewport(viewPort.desktop1080p.width, viewPort.desktop1080p.height);
+    cy.loginByApi("raj");
+    cy.visit("/");
+    facilityCreation.selectFacility("MEDICAL FACILITY");
+  });
path: cypress/e2e/patient_spec/patient_location.cy.ts
user: login: coderabbitai[bot]
body: _💡 Verification agent_

<details>
<summary>🧩 Analysis chain</summary>

**Consider using a fixture or dynamic user for authentication.**

Using a hardcoded user "raj" might cause issues if tests run in environments where this user doesn't exist. Consider using a fixture or creating a dynamic test user.

---

🏁 Script executed:

```shell
#!/bin/bash
# Check if "raj" user exists in fixtures
echo "Checking if raj user exists in fixtures..."
grep -r '"raj"' cypress/fixtures/
```

Length of output: 169

---



</details>

**Action Required: Replace hardcoded "raj" with a dynamic fixture value**

The test in `cypress/e2e/patient_spec/patient_location.cy.ts` hardcodes the string `"raj"` in the call `cy.loginByApi("raj")`, which could cause issues in different environments—even though the fixture `cypress/fixtures/users.json` already contains an entry for `"raj"`. To make the test more robust, please load the user dynamically from the fixture. For example:

```js
beforeEach(() => {
  cy.viewport(viewPort.desktop1080p.width, viewPort.desktop1080p.height);
  cy.fixture('users').then((users) => {
    cy.loginByApi(users.raj);
  });
  cy.visit("/");
  facilityCreation.selectFacility("MEDICAL FACILITY");
});
```

This approach will ensure that authentication data is maintained centrally, reducing potential issues when test users change.

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-03-23T03:58:07Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,229 @@
+export interface LocationData {
+  form?: string;
+  name: string;
+  bedsCount?: string;
+  description?: string;
+  status?: "Active" | "Inactive" | "Unknown";
+  opStatus?: string;
+}
+
+export class PatientLocation {
+  private selectors = {
+    locationForm: '[data-cy="location-form-options"]',
+    addLocationButton: '[data-cy="add-location-button"]',
+    sidebarContent: '[data-sidebar="content"]',
+    locationTab: '[data-cy="settings-locations-tab"]',
+    nameInput: '[data-cy="location-name-input"]',
+    bedCountsSelect: '[data-cy="bed-counts-select"]',
+    locationDescription: '[data-cy="location-description"]',
+    locationStatus: '[data-cy="location-status"]',
+    operationalStatus: '[data-cy="operational-status"]',
+    enableBulkCreation: '[data-cy="enable-bulk-creation-checkbox"]',
+    currentLocationBadge: '[data-cy="current-location-badge"]',
+    addLocationBadge: '[data-cy="add-encounter-location"]',
+    updateLocationButton: '[data-cy="update-encounter-location-button"]',
+    associatedLocationStatus: '[data-cy="associated-location-status"]',
+    saveStatusButton: '[data-cy="update-associated-location-status-button"]',
+    locationSearchTrigger: '[data-cy="location-search-trigger"]',
+    submitLocationAssociation:
+      '[data-cy="submit-encounter-location-association"]',
+  };
+
+  // Navigation
+  navigateToSettings() {
+    cy.get('[data-sidebar="content"]').contains("Settings").click();
path: cypress/pageObject/Patients/PatientLocation.ts
user: login: nihal467
body: ```suggestion
    cy.get('[data-sidebar="content"]').contains("Settings").click();
```

use cy,verifyandclick command function
created_at: 2025-03-27T17:14:32Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,229 @@
+export interface LocationData {
+  form?: string;
+  name: string;
+  bedsCount?: string;
+  description?: string;
+  status?: "Active" | "Inactive" | "Unknown";
+  opStatus?: string;
+}
+
+export class PatientLocation {
+  private selectors = {
+    locationForm: '[data-cy="location-form-options"]',
+    addLocationButton: '[data-cy="add-location-button"]',
+    sidebarContent: '[data-sidebar="content"]',
+    locationTab: '[data-cy="settings-locations-tab"]',
+    nameInput: '[data-cy="location-name-input"]',
+    bedCountsSelect: '[data-cy="bed-counts-select"]',
+    locationDescription: '[data-cy="location-description"]',
+    locationStatus: '[data-cy="location-status"]',
+    operationalStatus: '[data-cy="operational-status"]',
+    enableBulkCreation: '[data-cy="enable-bulk-creation-checkbox"]',
+    currentLocationBadge: '[data-cy="current-location-badge"]',
+    addLocationBadge: '[data-cy="add-encounter-location"]',
+    updateLocationButton: '[data-cy="update-encounter-location-button"]',
+    associatedLocationStatus: '[data-cy="associated-location-status"]',
+    saveStatusButton: '[data-cy="update-associated-location-status-button"]',
+    locationSearchTrigger: '[data-cy="location-search-trigger"]',
+    submitLocationAssociation:
+      '[data-cy="submit-encounter-location-association"]',
+  };
+
+  // Navigation
+  navigateToSettings() {
+    cy.get('[data-sidebar="content"]').contains("Settings").click();
+    return this;
+  }
+
+  clickLocationTab() {
+    cy.verifyAndClickElement(this.selectors.locationTab, "Location");
+    return this;
+  }
+
+  clickAddLocation() {
+    cy.verifyAndClickElement(this.selectors.addLocationButton, "Add Location");
+    return this;
+  }
+
+  selectLocationForm(locationForm: string) {
+    if (locationForm) {
+      cy.clickAndSelectOption(this.selectors.locationForm, locationForm);
+    }
+    return this;
+  }
+
+  enterLocationName(name: string, clearBeforeTyping: boolean = false) {
+    cy.typeIntoField(this.selectors.nameInput, name, { clearBeforeTyping });
+    return this;
+  }
+
+  enableBulkCreation(enableBulkCreation: boolean) {
+    if (enableBulkCreation) {
+      cy.get(this.selectors.enableBulkCreation).click();
+    }
+    return this;
+  }
+
+  selectBedCounts(bedCounts: string) {
+    if (bedCounts) {
+      cy.clickAndSelectOption(this.selectors.bedCountsSelect, bedCounts);
+    }
+    return this;
+  }
+
+  enterDescription(description: string) {
+    if (description) {
+      cy.typeIntoField(this.selectors.locationDescription, description);
+    }
+    return this;
+  }
+
+  selectLocationStatus(status: string) {
+    if (status) {
+      cy.clickAndSelectOption(this.selectors.locationStatus, status);
+    }
+    return this;
+  }
+
+  selectOperationalStatus(status: string) {
+    if (status) {
+      cy.clickAndSelectOption(this.selectors.operationalStatus, status);
+    }
+    return this;
+  }
+
+  fillLocationData(data: LocationData) {
+    this.selectLocationForm(data.form)
+      .enterLocationName(data.name)
+      .enableBulkCreation(data.form === "Bed")
+      .selectBedCounts(data.bedsCount)
+      .enterDescription(data.description)
+      .selectLocationStatus(data.status)
+      .selectOperationalStatus(data.opStatus);
+    return this;
+  }
+
+  interceptLocationCreationRequest() {
+    cy.intercept("POST", `**/api/v1/facility/**`).as("createLocation");
+    return this;
+  }
+
+  verifyLocationCreationAPICall() {
+    cy.wait("@createLocation").its("response.statusCode").should("eq", 200);
+    return this;
+  }
+
+  submitLocationForm() {
+    cy.clickSubmitButton("Create");
+    return this;
+  }
+
+  assertLocationCreationSuccess() {
+    cy.verifyNotification("Location Created");
+    return this;
+  }
+
+  assertMultipleBedsCreationSuccess(bedCount: string) {
+    cy.verifyNotification(`${bedCount} created successfully`);
+    return this;
+  }
+
+  navigateToEncounters() {
+    cy.get('[data-sidebar="content"]').contains("Encounters").click();
+    return this;
+  }
+
+  clickPlannedEncounterFilter() {
+    cy.intercept("GET", "**/api/v1/encounter/**").as("getEncounters");
+    cy.verifyAndClickElement('[data-cy="planned-filter"]', "Planned");
+    cy.wait("@getEncounters", { timeout: 10000 }).then((interception) => {
+      expect(interception.request.url).to.include("status=planned");
+      expect(interception.response.statusCode).to.eq(200);
+    });
+    return this;
+  }
+
+  openFirstEncounterDetails() {
path: cypress/pageObject/Patients/PatientLocation.ts
user: login: nihal467
body: ```suggestion
  openFirstEncounterDetails() {
```

use already existing function, don't create duplicate ones
created_at: 2025-03-27T17:15:24Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,229 @@
+export interface LocationData {
+  form?: string;
+  name: string;
+  bedsCount?: string;
+  description?: string;
+  status?: "Active" | "Inactive" | "Unknown";
+  opStatus?: string;
+}
+
+export class PatientLocation {
+  private selectors = {
+    locationForm: '[data-cy="location-form-options"]',
+    addLocationButton: '[data-cy="add-location-button"]',
+    sidebarContent: '[data-sidebar="content"]',
+    locationTab: '[data-cy="settings-locations-tab"]',
+    nameInput: '[data-cy="location-name-input"]',
+    bedCountsSelect: '[data-cy="bed-counts-select"]',
+    locationDescription: '[data-cy="location-description"]',
+    locationStatus: '[data-cy="location-status"]',
+    operationalStatus: '[data-cy="operational-status"]',
+    enableBulkCreation: '[data-cy="enable-bulk-creation-checkbox"]',
+    currentLocationBadge: '[data-cy="current-location-badge"]',
+    addLocationBadge: '[data-cy="add-encounter-location"]',
+    updateLocationButton: '[data-cy="update-encounter-location-button"]',
+    associatedLocationStatus: '[data-cy="associated-location-status"]',
+    saveStatusButton: '[data-cy="update-associated-location-status-button"]',
+    locationSearchTrigger: '[data-cy="location-search-trigger"]',
+    submitLocationAssociation:
+      '[data-cy="submit-encounter-location-association"]',
+  };
+
+  // Navigation
+  navigateToSettings() {
+    cy.get('[data-sidebar="content"]').contains("Settings").click();
+    return this;
+  }
+
+  clickLocationTab() {
+    cy.verifyAndClickElement(this.selectors.locationTab, "Location");
+    return this;
+  }
+
+  clickAddLocation() {
+    cy.verifyAndClickElement(this.selectors.addLocationButton, "Add Location");
+    return this;
+  }
+
+  selectLocationForm(locationForm: string) {
+    if (locationForm) {
+      cy.clickAndSelectOption(this.selectors.locationForm, locationForm);
+    }
+    return this;
+  }
+
+  enterLocationName(name: string, clearBeforeTyping: boolean = false) {
+    cy.typeIntoField(this.selectors.nameInput, name, { clearBeforeTyping });
+    return this;
+  }
+
+  enableBulkCreation(enableBulkCreation: boolean) {
+    if (enableBulkCreation) {
+      cy.get(this.selectors.enableBulkCreation).click();
+    }
+    return this;
+  }
+
+  selectBedCounts(bedCounts: string) {
+    if (bedCounts) {
+      cy.clickAndSelectOption(this.selectors.bedCountsSelect, bedCounts);
+    }
+    return this;
+  }
+
+  enterDescription(description: string) {
+    if (description) {
+      cy.typeIntoField(this.selectors.locationDescription, description);
+    }
+    return this;
+  }
+
+  selectLocationStatus(status: string) {
+    if (status) {
+      cy.clickAndSelectOption(this.selectors.locationStatus, status);
+    }
+    return this;
+  }
+
+  selectOperationalStatus(status: string) {
+    if (status) {
+      cy.clickAndSelectOption(this.selectors.operationalStatus, status);
+    }
+    return this;
+  }
+
+  fillLocationData(data: LocationData) {
+    this.selectLocationForm(data.form)
+      .enterLocationName(data.name)
+      .enableBulkCreation(data.form === "Bed")
+      .selectBedCounts(data.bedsCount)
+      .enterDescription(data.description)
+      .selectLocationStatus(data.status)
+      .selectOperationalStatus(data.opStatus);
+    return this;
+  }
+
+  interceptLocationCreationRequest() {
+    cy.intercept("POST", `**/api/v1/facility/**`).as("createLocation");
+    return this;
+  }
+
+  verifyLocationCreationAPICall() {
+    cy.wait("@createLocation").its("response.statusCode").should("eq", 200);
+    return this;
+  }
+
+  submitLocationForm() {
+    cy.clickSubmitButton("Create");
+    return this;
+  }
+
+  assertLocationCreationSuccess() {
+    cy.verifyNotification("Location Created");
+    return this;
+  }
+
+  assertMultipleBedsCreationSuccess(bedCount: string) {
+    cy.verifyNotification(`${bedCount} created successfully`);
+    return this;
+  }
+
+  navigateToEncounters() {
+    cy.get('[data-sidebar="content"]').contains("Encounters").click();
+    return this;
+  }
+
+  clickPlannedEncounterFilter() {
+    cy.intercept("GET", "**/api/v1/encounter/**").as("getEncounters");
+    cy.verifyAndClickElement('[data-cy="planned-filter"]', "Planned");
+    cy.wait("@getEncounters", { timeout: 10000 }).then((interception) => {
+      expect(interception.request.url).to.include("status=planned");
+      expect(interception.response.statusCode).to.eq(200);
+    });
+    return this;
+  }
+
+  openFirstEncounterDetails() {
+    cy.get('[data-cy="encounter-list-cards"]')
+      .first()
+      .contains("View Details")
+      .click();
+    return this;
+  }
+
+  clickAssociatedLocationBadge() {
+    cy.get(this.selectors.currentLocationBadge).click();
+    return this;
+  }
+
+  clickAddLocationBadge() {
+    cy.get(this.selectors.addLocationBadge).click();
+    return this;
+  }
+
+  clickUpdateLocationButton() {
+    cy.verifyAndClickElement(
+      this.selectors.updateLocationButton,
+      "Update Location",
+    );
+    return this;
+  }
+
+  searchBedLocation(locationName: string) {
+    cy.typeAndSelectOption(this.selectors.locationSearchTrigger, locationName);
+    return this;
+  }
+
+  submitLocationAssociation() {
+    cy.verifyAndClickElement(
+      this.selectors.submitLocationAssociation,
+      "Create Location Association",
+    );
+    return this;
+  }
+
+  setStatusCompleted() {
+    cy.clickAndSelectOption(
+      this.selectors.associatedLocationStatus,
+      "Completed",
+    );
+    return this;
+  }
+
+  fillEndTime(dateTime: string) {
+    cy.get('[data-cy="location-end-date-time"]').clear().type(dateTime);
path: cypress/pageObject/Patients/PatientLocation.ts
user: login: nihal467
body: ```suggestion
    cy.get('[data-cy="location-end-date-time"]').clear().type(dateTime);
```

cy.typeintofield command function for these kind of usages
created_at: 2025-03-27T17:16:01Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,111 @@
+import { PatientLocation } from "@/pageObject/Patients/PatientLocation";
+import { LocationData } from "@/pageObject/Patients/PatientLocation";
+import { FacilityCreation } from "@/pageObject/facility/FacilityCreation";
+import { viewPort } from "@/utils/viewPort";
+
+const facilityCreation = new FacilityCreation();
+const patientLocation = new PatientLocation();
+
+describe("Add a new Location and associate to an Encounter", () => {
+  beforeEach(() => {
+    cy.viewport(viewPort.desktop1080p.width, viewPort.desktop1080p.height);
+    cy.loginByApi("raj");
path: cypress/e2e/patient_spec/patient_location.cy.ts
user: login: nihal467
body: ```suggestion
    cy.loginByApi("raj");
```

create a new user id , like dev nurse other than names, currently we are connected develop backend, so update the fixture file with new id and use them
created_at: 2025-03-27T17:18:05Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,111 @@
+import { PatientLocation } from "@/pageObject/Patients/PatientLocation";
+import { LocationData } from "@/pageObject/Patients/PatientLocation";
+import { FacilityCreation } from "@/pageObject/facility/FacilityCreation";
+import { viewPort } from "@/utils/viewPort";
+
+const facilityCreation = new FacilityCreation();
+const patientLocation = new PatientLocation();
+
+describe("Add a new Location and associate to an Encounter", () => {
+  beforeEach(() => {
+    cy.viewport(viewPort.desktop1080p.width, viewPort.desktop1080p.height);
+    cy.loginByApi("raj");
+    cy.visit("/");
+    facilityCreation.selectFacility("MEDICAL FACILITY");
path: cypress/e2e/patient_spec/patient_location.cy.ts
user: login: nihal467
body: ```suggestion
    facilityCreation.selectFacility("MEDICAL FACILITY");
```

choose GHC payyanur
created_at: 2025-03-27T17:18:20Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,229 @@
+export interface LocationData {
+  form?: string;
+  name: string;
+  bedsCount?: string;
+  description?: string;
+  status?: "Active" | "Inactive" | "Unknown";
+  opStatus?: string;
+}
+
+export class PatientLocation {
+  private selectors = {
+    locationForm: '[data-cy="location-form-options"]',
+    addLocationButton: '[data-cy="add-location-button"]',
+    sidebarContent: '[data-sidebar="content"]',
+    locationTab: '[data-cy="settings-locations-tab"]',
+    nameInput: '[data-cy="location-name-input"]',
+    bedCountsSelect: '[data-cy="bed-counts-select"]',
+    locationDescription: '[data-cy="location-description"]',
+    locationStatus: '[data-cy="location-status"]',
+    operationalStatus: '[data-cy="operational-status"]',
+    enableBulkCreation: '[data-cy="enable-bulk-creation-checkbox"]',
+    currentLocationBadge: '[data-cy="current-location-badge"]',
+    addLocationBadge: '[data-cy="add-encounter-location"]',
+    updateLocationButton: '[data-cy="update-encounter-location-button"]',
+    associatedLocationStatus: '[data-cy="associated-location-status"]',
+    saveStatusButton: '[data-cy="update-associated-location-status-button"]',
+    locationSearchTrigger: '[data-cy="location-search-trigger"]',
+    submitLocationAssociation:
+      '[data-cy="submit-encounter-location-association"]',
+  };
+
+  // Navigation
+  navigateToSettings() {
+    cy.get('[data-sidebar="content"]').contains("Settings").click();
path: cypress/pageObject/Patients/PatientLocation.ts
user: login: rajku-dev
body: it was reused from existing PatientCreation POM code.
will make the changes
created_at: 2025-03-31T13:53:13Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,111 @@
+import { PatientLocation } from "@/pageObject/Patients/PatientLocation";
+import { LocationData } from "@/pageObject/Patients/PatientLocation";
+import { FacilityCreation } from "@/pageObject/facility/FacilityCreation";
+import { viewPort } from "@/utils/viewPort";
+
+const facilityCreation = new FacilityCreation();
+const patientLocation = new PatientLocation();
+
+describe("Add a new Location and associate to an Encounter", () => {
+  beforeEach(() => {
+    cy.viewport(viewPort.desktop1080p.width, viewPort.desktop1080p.height);
+    cy.loginByApi("raj");
+    cy.visit("/");
+    facilityCreation.selectFacility("MEDICAL FACILITY");
path: cypress/e2e/patient_spec/patient_location.cy.ts
user: login: rajku-dev
body: made the change
created_at: 2025-04-05T07:19:34Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,111 @@
+import { PatientLocation } from "@/pageObject/Patients/PatientLocation";
+import { LocationData } from "@/pageObject/Patients/PatientLocation";
+import { FacilityCreation } from "@/pageObject/facility/FacilityCreation";
+import { viewPort } from "@/utils/viewPort";
+
+const facilityCreation = new FacilityCreation();
+const patientLocation = new PatientLocation();
+
+describe("Add a new Location and associate to an Encounter", () => {
+  beforeEach(() => {
+    cy.viewport(viewPort.desktop1080p.width, viewPort.desktop1080p.height);
+    cy.loginByApi("raj");
path: cypress/e2e/patient_spec/patient_location.cy.ts
user: login: rajku-dev
body: done
created_at: 2025-04-05T07:19:43Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,229 @@
+export interface LocationData {
+  form?: string;
+  name: string;
+  bedsCount?: string;
+  description?: string;
+  status?: "Active" | "Inactive" | "Unknown";
+  opStatus?: string;
+}
+
+export class PatientLocation {
+  private selectors = {
+    locationForm: '[data-cy="location-form-options"]',
+    addLocationButton: '[data-cy="add-location-button"]',
+    sidebarContent: '[data-sidebar="content"]',
+    locationTab: '[data-cy="settings-locations-tab"]',
+    nameInput: '[data-cy="location-name-input"]',
+    bedCountsSelect: '[data-cy="bed-counts-select"]',
+    locationDescription: '[data-cy="location-description"]',
+    locationStatus: '[data-cy="location-status"]',
+    operationalStatus: '[data-cy="operational-status"]',
+    enableBulkCreation: '[data-cy="enable-bulk-creation-checkbox"]',
+    currentLocationBadge: '[data-cy="current-location-badge"]',
+    addLocationBadge: '[data-cy="add-encounter-location"]',
+    updateLocationButton: '[data-cy="update-encounter-location-button"]',
+    associatedLocationStatus: '[data-cy="associated-location-status"]',
+    saveStatusButton: '[data-cy="update-associated-location-status-button"]',
+    locationSearchTrigger: '[data-cy="location-search-trigger"]',
+    submitLocationAssociation:
+      '[data-cy="submit-encounter-location-association"]',
+  };
+
+  // Navigation
+  navigateToSettings() {
+    cy.get('[data-sidebar="content"]').contains("Settings").click();
path: cypress/pageObject/Patients/PatientLocation.ts
user: login: rajku-dev
body: made the change
created_at: 2025-04-05T07:24:35Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,229 @@
+export interface LocationData {
+  form?: string;
+  name: string;
+  bedsCount?: string;
+  description?: string;
+  status?: "Active" | "Inactive" | "Unknown";
+  opStatus?: string;
+}
+
+export class PatientLocation {
+  private selectors = {
+    locationForm: '[data-cy="location-form-options"]',
+    addLocationButton: '[data-cy="add-location-button"]',
+    sidebarContent: '[data-sidebar="content"]',
+    locationTab: '[data-cy="settings-locations-tab"]',
+    nameInput: '[data-cy="location-name-input"]',
+    bedCountsSelect: '[data-cy="bed-counts-select"]',
+    locationDescription: '[data-cy="location-description"]',
+    locationStatus: '[data-cy="location-status"]',
+    operationalStatus: '[data-cy="operational-status"]',
+    enableBulkCreation: '[data-cy="enable-bulk-creation-checkbox"]',
+    currentLocationBadge: '[data-cy="current-location-badge"]',
+    addLocationBadge: '[data-cy="add-encounter-location"]',
+    updateLocationButton: '[data-cy="update-encounter-location-button"]',
+    associatedLocationStatus: '[data-cy="associated-location-status"]',
+    saveStatusButton: '[data-cy="update-associated-location-status-button"]',
+    locationSearchTrigger: '[data-cy="location-search-trigger"]',
+    submitLocationAssociation:
+      '[data-cy="submit-encounter-location-association"]',
+  };
+
+  // Navigation
+  navigateToSettings() {
+    cy.get('[data-sidebar="content"]').contains("Settings").click();
+    return this;
+  }
+
+  clickLocationTab() {
+    cy.verifyAndClickElement(this.selectors.locationTab, "Location");
+    return this;
+  }
+
+  clickAddLocation() {
+    cy.verifyAndClickElement(this.selectors.addLocationButton, "Add Location");
+    return this;
+  }
+
+  selectLocationForm(locationForm: string) {
+    if (locationForm) {
+      cy.clickAndSelectOption(this.selectors.locationForm, locationForm);
+    }
+    return this;
+  }
+
+  enterLocationName(name: string, clearBeforeTyping: boolean = false) {
+    cy.typeIntoField(this.selectors.nameInput, name, { clearBeforeTyping });
+    return this;
+  }
+
+  enableBulkCreation(enableBulkCreation: boolean) {
+    if (enableBulkCreation) {
+      cy.get(this.selectors.enableBulkCreation).click();
+    }
+    return this;
+  }
+
+  selectBedCounts(bedCounts: string) {
+    if (bedCounts) {
+      cy.clickAndSelectOption(this.selectors.bedCountsSelect, bedCounts);
+    }
+    return this;
+  }
+
+  enterDescription(description: string) {
+    if (description) {
+      cy.typeIntoField(this.selectors.locationDescription, description);
+    }
+    return this;
+  }
+
+  selectLocationStatus(status: string) {
+    if (status) {
+      cy.clickAndSelectOption(this.selectors.locationStatus, status);
+    }
+    return this;
+  }
+
+  selectOperationalStatus(status: string) {
+    if (status) {
+      cy.clickAndSelectOption(this.selectors.operationalStatus, status);
+    }
+    return this;
+  }
+
+  fillLocationData(data: LocationData) {
+    this.selectLocationForm(data.form)
+      .enterLocationName(data.name)
+      .enableBulkCreation(data.form === "Bed")
+      .selectBedCounts(data.bedsCount)
+      .enterDescription(data.description)
+      .selectLocationStatus(data.status)
+      .selectOperationalStatus(data.opStatus);
+    return this;
+  }
+
+  interceptLocationCreationRequest() {
+    cy.intercept("POST", `**/api/v1/facility/**`).as("createLocation");
+    return this;
+  }
+
+  verifyLocationCreationAPICall() {
+    cy.wait("@createLocation").its("response.statusCode").should("eq", 200);
+    return this;
+  }
+
+  submitLocationForm() {
+    cy.clickSubmitButton("Create");
+    return this;
+  }
+
+  assertLocationCreationSuccess() {
+    cy.verifyNotification("Location Created");
+    return this;
+  }
+
+  assertMultipleBedsCreationSuccess(bedCount: string) {
+    cy.verifyNotification(`${bedCount} created successfully`);
+    return this;
+  }
+
+  navigateToEncounters() {
+    cy.get('[data-sidebar="content"]').contains("Encounters").click();
+    return this;
+  }
+
+  clickPlannedEncounterFilter() {
+    cy.intercept("GET", "**/api/v1/encounter/**").as("getEncounters");
+    cy.verifyAndClickElement('[data-cy="planned-filter"]', "Planned");
+    cy.wait("@getEncounters", { timeout: 10000 }).then((interception) => {
+      expect(interception.request.url).to.include("status=planned");
+      expect(interception.response.statusCode).to.eq(200);
+    });
+    return this;
+  }
+
+  openFirstEncounterDetails() {
+    cy.get('[data-cy="encounter-list-cards"]')
+      .first()
+      .contains("View Details")
+      .click();
+    return this;
+  }
+
+  clickAssociatedLocationBadge() {
+    cy.get(this.selectors.currentLocationBadge).click();
+    return this;
+  }
+
+  clickAddLocationBadge() {
+    cy.get(this.selectors.addLocationBadge).click();
+    return this;
+  }
+
+  clickUpdateLocationButton() {
+    cy.verifyAndClickElement(
+      this.selectors.updateLocationButton,
+      "Update Location",
+    );
+    return this;
+  }
+
+  searchBedLocation(locationName: string) {
+    cy.typeAndSelectOption(this.selectors.locationSearchTrigger, locationName);
+    return this;
+  }
+
+  submitLocationAssociation() {
+    cy.verifyAndClickElement(
+      this.selectors.submitLocationAssociation,
+      "Create Location Association",
+    );
+    return this;
+  }
+
+  setStatusCompleted() {
+    cy.clickAndSelectOption(
+      this.selectors.associatedLocationStatus,
+      "Completed",
+    );
+    return this;
+  }
+
+  fillEndTime(dateTime: string) {
+    cy.get('[data-cy="location-end-date-time"]').clear().type(dateTime);
path: cypress/pageObject/Patients/PatientLocation.ts
user: login: rajku-dev
body: done
created_at: 2025-04-05T07:30:05Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,122 @@
+import { PatientEncounter } from "@/pageObject/Patients/PatientEncounter";
+import { PatientLocation } from "@/pageObject/Patients/PatientLocation";
+import { LocationData } from "@/pageObject/Patients/PatientLocation";
+import { FacilityCreation } from "@/pageObject/facility/FacilityCreation";
+import { viewPort } from "@/utils/viewPort";
+
+const facilityCreation = new FacilityCreation();
+const patientLocation = new PatientLocation();
+const patientEncounter = new PatientEncounter();
+
+describe("Manage locations association to an encounter", () => {
+  beforeEach(() => {
+    cy.viewport(viewPort.desktop1080p.width, viewPort.desktop1080p.height);
+    cy.loginByApi("devdoctor3");
+    cy.visit("/");
+    facilityCreation.selectFacility("GHC Payyanur");
+  });
+
+  it("Manage a bed association to an encounter", () => {
+    patientEncounter
+      .navigateToEncounters()
+      .clickInProgressEncounterFilter()
+      .openFirstEncounterDetails();
+
+    // Associate New Location to the first planned encounter
+    patientLocation
+      .clickAddLocationBadge()
+      .selectLocationBuilding("Block C")
+      .clickShowAvailableBeds()
+      .selectLocationBed("ICU")
+      .clickAssignBedButton()
path: cypress/e2e/patient_spec/patient_location.cy.ts
user: login: coderabbitai[bot]
body: _💡 Verification agent_

<details>
<summary>🧩 Analysis chain</summary>

**Test relies on specific location data which may not exist in all environments**

The test assumes that "Block C" building and "ICU" bed exist in the system. This assumption may not hold true across all environments.

Consider creating these locations as part of test setup or checking their existence first:

```diff
+ // Add a function to the PatientLocation class to check if a location exists
+ // and create it if it doesn't
+ checkAndCreateLocationIfNeeded(buildingName: string, bedName: string) {
+   // Implementation details
+   return this;
+ }

patientLocation
  .clickAddLocationBadge()
+  .checkAndCreateLocationIfNeeded("Block C", "ICU")
  .selectLocationBuilding("Block C")
  .clickShowAvailableBeds()
  .selectLocationBed("ICU")
```

---

🏁 Script executed:

```shell
#!/bin/bash
# Check if the required locations exist in the system
echo "Checking for Block C and ICU locations in the codebase..."

echo "Searching for references to Block C..."
rg -i "Block C" --type ts

echo "Searching for references to ICU..."
rg -i "ICU" --type ts
```

Length of output: 1134

---



</details>

**Action Required: Ensure Existence of "Block C" and "ICU" in Test Setup**

The test currently assumes that the "Block C" building and the "ICU" bed exist. The search results confirm that these values are only hard-coded in the test (with ICU also appearing in a constants file), meaning this assumption might break in environments where the necessary setup isn’t in place. To improve test resilience, consider updating the test setup so that it either creates these locations (if they don’t already exist) or verifies their existence before proceeding.

Suggested changes:
- Add a helper function (e.g., `checkAndCreateLocationIfNeeded`) in the PatientLocation class to encapsulate this logic.
- Update the test to call this function prior to selecting the building and bed, as illustrated by the diff snippet below:

```diff
patientLocation
  .clickAddLocationBadge()
+  .checkAndCreateLocationIfNeeded("Block C", "ICU")
  .selectLocationBuilding("Block C")
  .clickShowAvailableBeds()
  .selectLocationBed("ICU")
  .clickAssignBedButton()
```



> Committable suggestion skipped: line range outside the PR's diff.

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-05T12:13:05Z
author_association: CONTRIBUTOR
diff_hunk: @@ -38,6 +38,7 @@ export function LocationActionButtons({
     onClick: () => void;
     variant: "outline" | "primary" | "link";
     className?: string;
+    "data-cy"?: string;
path: src/components/Location/LocationActionButtons.tsx
user: login: khavinshankar
body: just a suggestion, lets keep these things generic
created_at: 2025-04-05T13:32:26Z
author_association: MEMBER

PR comments:
user: login: coderabbitai[bot]
created_at: 2025-03-21T11:41:36Z
body: <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- walkthrough_start -->

## Walkthrough
This pull request introduces a comprehensive Cypress test suite for managing patient locations. It adds tests for creating multiple types of locations and for dissociating then associating a location in an encounter. Additionally, the PR implements a new page object for patient location interactions, adds a new user fixture entry, updates selectors in custom commands, and enhances various UI components and forms with `data-cy` attributes to improve testability.

## Changes

| Files                                                                                           | Change Summary                                                                                         |
|-------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------|
| `cypress/e2e/patient_spec/patient_location.cy.ts`, `cypress/pageObject/Patients/PatientLocation.ts` | Added a new Cypress test suite for patient location management and a corresponding page object with methods for creating, dissociating, and associating locations. |
| `cypress/fixtures/users.json`                                                                  | Added a new user entry ("devdoctor3" with username "devdoctor3" and password "Test@123").            |
| `cypress/support/commands.ts`                                                                   | Updated the selector in the `typeAndSelectOption` command from `[cmdk-list]` to `[cmdk-group]`.      |
| `src/components/Location/LocationSearch.tsx`, `src/components/Patient/PatientInfoCard.tsx`, `src/pages/Facility/settings/layout.tsx`, `src/pages/Facility/settings/locations/LocationForm.tsx`, `src/pages/Encounters/EncounterList.tsx` | Added `data-cy` attributes to various components to facilitate targeted element selection in tests.   |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant Test as Cypress Test
    participant PL as PatientLocation Page Object
    participant API as Facility API

    Test->>PL: navigateToSettings()
    PL->>Test: Display Settings Page
    Test->>PL: fillLocationData(Room/Hous/Bed)
    PL->>API: interceptLocationCreationRequest() [POST]
    API-->>PL: Return Success
    PL->>Test: assertLocationCreationSuccess()
```

```mermaid
sequenceDiagram
    participant Test as Cypress Test
    participant PL as PatientLocation Page Object
    participant API as Facility API

    Test->>PL: Retrieve current date & modify end time
    Test->>PL: Dissociate existing location
    PL->>API: interceptDissociationRequest() [PUT]
    API-->>PL: Return Dissociation Success
    Test->>PL: Associate new location for encounter
    PL->>API: interceptAssociationRequest() [POST]
    API-->>PL: Return Association Success
    PL->>Test: assertLocationAssociationSuccess()
```

## Assessment against linked issues

| Objective                                                                                       | Addressed | Explanation                    |
|-------------------------------------------------------------------------------------------------|-----------|--------------------------------|
| Multi-type location creation and search functionality (#10960)                                 | ✅        |                                |
| Bed location assignment in encounters via dissociation and association (#10960)                  | ✅        |                                |
| New user creation in platform with updated fixture for testing (#10960)                         | ✅        |                                |

## Suggested labels
`changes required`

## Suggested reviewers
- rithviknishad
- Jacobjeevan

## Poem
> Oh, what a hop with tests so bright,  
> My code garden blooms with each new sight.  
> Locations sprout, from room to bed and house,  
> Data attributes tick like a nimble mouse.  
> I leap with joy, a code-loving bunny in flight,  
> Celebrating clean tests from dawn till night!

<!-- walkthrough_end -->


---

<details>
<summary>📜 Recent review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between ecb4c6ab582147ccf089044e0d26c579175e5362 and 25e6a401b61414df5e4a6048b841f7049c0a1f16.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `cypress/e2e/patient_spec/patient_location.cy.ts` (1 hunks)

</details>

<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary>

* cypress/e2e/patient_spec/patient_location.cy.ts

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (1)</summary>

* GitHub Check: cypress-run (1)

</details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpADK2VmgqyjcEj2wAbb5AokAI7Y0riQ4rjedJAARADCsrzSyDSIuMgAZvh8AIK0tPAYRJDkAO6QADL4DNTw+FiY9ACiGEzYGDS5iIjV8LX1MZClaMgMAdTRcuGwntiIlJAABlRCANbYYEoSi+gY9KjwSh3wGfCT8rgzJU4CCwCMdwAsAKwAzBowV7zwzC7y3NgKNx8PN+BlpqhbCgUvh0PkAt1oYgQpAzHcAAwATgAbOjIFMftwomxjkVIPMpFQ/BkSNRAdJ/CRvBN6ARIN5qv0sL8MGhSCSwqV1AgsJdPGhuET4DVxPUPh4eBR8MD5vQGLBMKRkIUGN5sEppp4xrTZVh8OC0CUSOUbPgWLt6AAJfBzTxVGV1DAAGkN6DU3nUF1hxomkAAQj5VuG6Mh3VyfY1IBl2mJPWgA7gg5ACt1eqHEyMegw+jR0OzOaahsKywGpJAyG0OpQPjksD8+Z4lMx6mkqOIyWLGBqigyDq09Up9qKrrYNO4rmwKKQh6JVgG0vw8AHyMgKco/LgRqsUhqwuRomzbgpmESSDR6LcsgFfVCalgr4vSLQfTqJ4Vimg+T/uS3CiCc0pcjC2YkN2GC9qGg4CNgxSnAAHvwfCpGEg5lEmJr0j62DcLQtRkrwijYGI2bVE47DxvWcGAsBlzUJAACqACS4QkKhYSoL8hSHoU0SFCgT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2QKjOQsYhUh4QWHSmlUfJIArwR4AIG5ScoPotAZ4AIGeBoASAdwDICpExDogvVtAe1eiGxAYg3VdwQCI8BIAqRcQDAbEBrhRQ2qMgtAO4CQExB3APoH0R4B6szWYg/8DAF4M8E5ScoSIDARNdiF9XcoXVvqj6BkExD0B41EAW1bSA+jYhsQaATEBkAYC0AVIveAQL6oYDPA7gtAWNQIBUiqB0QnKJ4AIFeCcoVISgW4M8CtX6qbVXKNtZiA9WzqXVJAD6D3hUg1qW1H0Z4BkFeAqB0QAgDtbGvRAMBq1Q6j6HiHrVQAvVnKX1SOtvWvBMQPq54JiExCPAmoKkNACpAYCnrU1262gP2o+icpL1batANiEXUyrQNtATlHmtoBrr21JAbEAOoYDtqPoAGhgIWuxBvr/1Ga14CmoEDIbY1KkWDTatUCxqMg6IV4GmvRCiAf1zwR4DmpdU95aNJAUjaIBUgfQ0AzwD6Ghp2TTrKNDa/tZiFeCvBT1GQfDfkCsTuqVIrwDNS8BxCHrHgQa9NR9GnUPAVIOyO4KJqgAdrp1nKR4HcHfVvrcQ2IT1eiEvU2aENh6k/ImoYB3BJNMaujSpGeAwb71kARTSxv/UIbe8mGlSPaqHWYhOUGQZ4FurQB3AB16ayNUWvzXOrnVBmpMKBq41Pq0ArwJNa8GxCPAMgAgbEEWruBNROUAmjtTWs7WYhPNU6xDdiDrV6qZVogAQD+tbVuru1TwD6E1Fo0+r0QlMEgOiAQ2xqBNwGyLW8EK0pbStaGtAOpruAFangTwWgBFpICZrcQjwUdcFq9W3rWNgG6LRkDuBea9VS6sTVNHUBGq6YJqwpNaDoACow0+gIAA== -->

<!-- internal state end -->
<!-- tips_start -->

---



<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=ohcnetwork/care_fe&utm_content=11453):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Generate unit testing code for this file.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai generate unit testing code for this file.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and generate unit testing code.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai plan` to trigger planning for file edits and PR creation.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->
author_association: CONTRIBUTOR
user: login: netlify[bot]
created_at: 2025-03-21T11:42:11Z
body: ### <span aria-hidden="true">✅</span> Deploy Preview for *care-ohc* ready!


|  Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | 26f64763951e38e5c2e2e8c53555e20892c8e73e |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/sites/care-ohc/deploys/67f12f817ae5570008894aae |
|<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-11453.preview.ohc.network](https://deploy-preview-11453.preview.ohc.network) |
|<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br />![QR Code](https://app.netlify.com/qr-code/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL2RlcGxveS1wcmV2aWV3LTExNDUzLnByZXZpZXcub2hjLm5ldHdvcmsifQ.0i6XAJ0E4n6ZjwbE4OIbusAa9Lqcrq85Y_gVvyTaacc)<br /><br />_Use your smartphone camera to open QR code link._</details> |
---
<!-- [care-ohc Preview](https://deploy-preview-11453.preview.ohc.network) -->
_To edit notification comments on pull requests, go to your [Netlify site configuration](https://app.netlify.com/sites/care-ohc/configuration/notifications#deploy-webhooks)._
author_association: NONE
user: login: rajku-dev
created_at: 2025-03-22T06:12:53Z
body: @nihal467 the test are passing in local with the local user as suggested with turnaround time of 44 seconds.
Please review.
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-03-24T12:27:18Z
body: Conflicts have been detected against the base branch. Please merge the base branch into your branch.
cc: @rajku-dev
> _See: https://docs.ohc.network/docs/contributing#how-to-resolve-merge-conflicts_
author_association: NONE
user: login: github-actions[bot]
created_at: 2025-03-24T14:37:32Z
body: Conflicts have been detected against the base branch. Please merge the base branch into your branch.
cc: @rajku-dev
> _See: https://docs.ohc.network/docs/contributing#how-to-resolve-merge-conflicts_
author_association: NONE
user: login: rajku-dev
created_at: 2025-03-31T13:56:33Z
body: > * make sure, all the test you created is passing CI/CD before you request a review

If it passes all tests locally then why it don't pass CI/CD?
![image](https://github.com/user-attachments/assets/035f9590-5c4f-426b-a481-626c5a25ee13)

I'm not able to reproduce this locally @nihal467 
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-04-03T10:43:31Z
body: Conflicts have been detected against the base branch. Please merge the base branch into your branch.
cc: @rajku-dev
> _See: https://docs.ohc.network/docs/contributing#how-to-resolve-merge-conflicts_
author_association: NONE
user: login: nihal467
created_at: 2025-04-05T07:26:32Z
body: @rajku-dev bro, i am taking over the PR, don't push anymore commit
author_association: MEMBER
user: login: rajku-dev
created_at: 2025-04-05T07:30:35Z
body: > @rajku-dev bro, i am taking over the PR, don't push anymore commit

sorry @nihal467 , won't push commits on this one anymore.
i did push only one-liners though!
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-04-05T13:33:37Z
body: @nihal467 @rajku-dev Your efforts have helped advance digital healthcare and TeleICU systems. :rocket: Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! :raised_hands:
author_association: NONE