ohcnetwork / care_fe

Care is a Digital Public Good enabling TeleICU & Decentralised Administration of Healthcare Capacity across States.
https://care.ohc.network
MIT License
252 stars 435 forks source link

Add Cypress Test to Verify Error Message During New Facility Creation based on user restriction #9108

Open nihal467 opened 2 days ago

nihal467 commented 2 days ago

Description

Implement Cypress tests to verify error handling and access restrictions during facility creation:

  1. Ensure the frontend displays an appropriate error if a district admin attempts to create a facility outside their designated district.
  2. Verify that non-admin users, such as dummynurse1 and devdoctor, are restricted from accessing the facility creation page.

General Instruction

Test Workflows

Test 1: District Admin Facility Creation Error

  1. Log in as a district admin from Ernakulam district.
  2. Navigate to care.coronasafe.in/facility/create.
  3. Attempt to create a new facility for the Palakkad district.
  4. After submitting the form, verify that an error message is displayed on the frontend, indicating that the district admin cannot create facilities outside their assigned district.

Test 2: Access Restriction for Non-Admin Users

  1. Log in as a non-admin user, such as dummynurse1.
  2. Attempt to access care.coronasafe.in/facility/create.
  3. Verify that an error is immediately displayed on the frontend, restricting access.
  4. Repeat steps 1–3 with the devdoctor user ID to ensure consistent access control.
Alokih commented 2 days ago

@nihal sir can I work on this issue ?

Jacobjeevan commented 1 day ago

Assigned you the other issue @Alokih 👍 Leaving this for someone else.

Alokih commented 1 day ago

@Jacobjeevan sir if possible can you please assign me to this one as I have already started to work on this