Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new cypress test for shifting request #8914

Open
Tracked by #7058
nihal467 opened this issue Oct 24, 2024 · 7 comments · May be fixed by #9035
Open
Tracked by #7058

Add a new cypress test for shifting request #8914

nihal467 opened this issue Oct 24, 2024 · 7 comments · May be fixed by #9035
Assignees

Comments

@nihal467
Copy link
Member

nihal467 commented Oct 24, 2024

Description

Add a new cypress test for new shifting requests for a patient

General Note

Follow the Page Object Model (POM) approach. : reference
Refer to commands.ts in the Cypress folder to understand existing reusable components.
Use proper function names for easier code review.
Since there's nothing related to shifting requests is currently present, create a new file named ShiftingRequest.cy.ts under the shifting_spec folder.

Steps to Assign a Shifting Request

  1. Go to the patient tab
  2. click on any live patient card
  3. On the patient consultation page, click on manage patients
  4. from the dropdown, select shift patient
  5. submit the shifting form and verify the card is present in the shifting board

Make sure to verify the below things

Ensure the normal workflow is functional.
Edit the request form and verify the modification are reflected properly

@nihal467 nihal467 changed the title Shift patient request Add a new cypress test for shifting request and completion workflow Oct 24, 2024
@nihal467 nihal467 changed the title Add a new cypress test for shifting request and completion workflow Add a new cypress test for shifting request Oct 24, 2024
@Ayush1404
Copy link

@nihal467 Can I work on this? Please assign it me.

@Ayush1404
Copy link

Hey @nihal467,

I have started working on the issue, and I have written the test as below (I am attaching an image of the code I have written so far, which performs the following):

1: Creating a New Shift Request

  1. Visit the patients tab.
  2. Intercept the shift request API call.
  3. Select the patient named "Dummy Patient 16".
  4. Click the "Manage Patient" button.
  5. Select the "Shift Patient" option.
  6. Enter the contact person's name as "new".
  7. Enter the contact person's phone number as "9465666768".
  8. Enter the shift reason as "emmergency".
  9. Submit the shift request form.
  10. Wait for the shift request API call to complete and verify the status code is 201.

2:

Verifying Shift Request Creation

  1. Visit the shift board page.
  2. Verify that "Dummy Patient 16" exists on the board.

I have also attached a video of this test performing successfully.


I know this isn’t perfect, but it is a starting point. Without knowing exactly what you expect, I wouldn't know what to modify. Could you let me know if there are any improvements or changes you'd like me to make?

One thing to mention is that I have hardcoded "Dummy Patient 16". Should I replace that by creating a new patient dynamically for the test, or is it fine to reference an existing one? Your thoughts on this would help guide the next steps.

Image

Screencast.from.25-10-24.02.59.58.PM.IST.webm

@nihal467
Copy link
Member Author

@Ayush1404

  1. verify and creating should be one single test
  2. Patient selection, manage patient, all have reusable function already use them,
  3. edit the existing request and verify the reflection in the details form
  4. input all the fields in the shifting form

@Ayush1404
Copy link

Hey @nihal467 , i understand the corrections that you suggested , sorry for the inconvinience . Here are the screenshots of the modified test file and some functions that i have added . It seems pretty modular now , still let me know if anything can be improved

Image
Image
Image

i am confused about the third point that you added
3. edit the existing request and verify the reflection in the details form
Which edit option are you takling about here . Are you refering to the update option in the shifting request ? If so it can be accessed in 2 ways

  1. visit '/patiens' -> click on the patient card -> manage patient -> Track Shifting -> update
  2. visit '/shifting/board' -> scroll and click on the shift request card -> update

which way should i write test for ? Thank you for your quick attention !

@JavidSumra
Copy link
Contributor

Hey @Ayush1404 are you working on this issue?

@Ayush1404
Copy link

@JavidSumra yes, i am working on the issue infact work is almost done , i am waiting for reply for which way of editing the shifting request is to be co sidered for the test

@nihal467
Copy link
Member Author

nihal467 commented Nov 6, 2024

@Ayush1404

  • use the second way " visit '/shifting/board' -> scroll and click on the shift request card -> update "
  • do raise a PR for review purpose

@Ayush1404 Ayush1404 linked a pull request Nov 7, 2024 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants