MediCare Hospital

Practice tasks

A booking journey has more state than a shopping journey: the doctor, the date and the slot all have to survive from one page to the next. That is what makes it worth automating.

1. Find a doctor

  1. Search for cardio and assert every card shows Cardiology.
  2. Pick a speciality from the dropdown and assert the count text matches the number of cards.
  3. Tick two branches and assert only those branches appear.
  4. Drag the fee slider to 600 and assert no card shows a higher fee.
  5. Choose 15 years and above and assert every card meets it.
  6. Clear the filters and assert all 14 doctors are back.
  7. Sort by fee ascending and assert the order; sort by rating and assert the first card is the highest.

2. Slots

  1. Open a doctor and assert the profile matches the card you clicked.
  2. Assert seven date buttons are shown and the first one is selected.
  3. Assert Book this slot is disabled before a slot is picked.
  4. Click a booked (disabled) slot and assert nothing is selected.
  5. Pick a free slot, assert the confirmation text, then change the date and assert the selection resets.
  6. Assert the morning and evening groups contain the right times.

3. Booking form

  1. Submit the empty form and assert every required field is listed.
  2. Enter an age of 0 and of 130 and assert both are rejected.
  3. Enter a 9-digit mobile number and assert the message.
  4. Tick I will use health insurance and assert the insurer fields appear and become required.
  5. Enter a 4-character reason and assert the minimum-length message.
  6. Leave the consent box unticked and assert the appointment is not booked.
  7. Book a valid appointment and assert the ID matches MC-XXXXXX.

4. Appointments and reports

  1. Assert the new appointment appears under My appointments as Upcoming.
  2. Cancel it and assert the status changes and the cancel button disappears.
  3. Filter by Cancelled and assert only that one is shown.
  4. On Lab reports, search for a report ID and assert exactly one row.
  5. Filter by type and by status together and assert the row count text.
  6. Sort by date and assert the order; click again and assert it reverses.
  7. Click Download on a ready report and assert the file is saved; assert the button is disabled while a report is in progress.

Where the data lives

Appointments and the slot you picked are kept in localStorage under mc_appointments and mc_booking. Reset the app between runs with:

// Selenium
((JavascriptExecutor) driver).executeScript("window.localStorage.clear()");

// Playwright
await page.evaluate(() => localStorage.clear());