UhiTesting
Manual Test Plan: UHI ↔ Clinical Appointment Sync
Setup
- Ensure Rails, Sidekiq, and frontend are running
- Raj Kumar has schedules at City Hospital Branch (role
01900006-...-002, facility01900002-...-002) - Log in as Simmi (ABHA:
johndoe@sbx)
Test 1: Book → Clinical Appointment Created
| Step | Action | Expected |
|---|---|---|
| 1.1 | Search "raj" on UHI search page | 3 provider entries (Branch, Main, MedCare) |
| 1.2 | Click "View Slots" on City Hospital Branch | Slot grid shows available times |
| 1.3 | Select any future slot | Proceeds to booking page |
| 1.4 | Accept all terms and confirm | PIN displayed, state CONFIRMED |
| 1.5 | Check uhi.bookings | state = 'CONFIRMED', clinical_appointment_id set |
| 1.6 | Check clinical.appointments | status = 'booked', same practitioner/facility as slot |
| 1.7 | Check clinical.patients | Patient user_id linked to Simmi |
| 1.8 | Visit patient appointments page | New appointment visible with correct date/time |
Test 2: Booked Slot Hidden from Search
| Step | Action | Expected |
|---|---|---|
| 2.1 | After Test 1, search same facility on same date | Booked slot NOT in results |
| 2.2 | Search a different facility (City Hospital Main) on same date | Same time slot IS available (different facility) |
Test 3: Cancel ← Clinical Appointment Cancelled
| Step | Action | Expected |
|---|---|---|
| 3.1 | Open the confirmed booking from Test 1 | Booking detail page shows CONFIRMED |
| 3.2 | Click "Cancel Appointment" → confirm | Modal hides, toast shows "Cancellation requested" |
| 3.3 | Wait 5 seconds, refresh the page | Booking shows CANCELLED |
| 3.4 | Check uhi.bookings | state = 'CANCELLED' |
| 3.5 | Check clinical.appointments | status = 'cancelled' (same appointment from Test 1) |
| 3.6 | Search slots for same facility/date | Previously booked slot IS available again |
Test 4: on_confirm Audit
| Step | Action | Expected |
|---|---|---|
| 4.1 | After Test 1, check uhi.requests | Only 1 on_confirm + 1 on_confirm_audit |
| 4.2 | No Sidekiq retries | No OnConfirmJob error or exhausted retries in logs |
Test 5: on_cancel Audit
| Step | Action | Expected |
|---|---|---|
| 5.1 | After Test 3, check uhi.requests | Only 1 on_cancel + 1 on_cancel_audit |
| 5.2 | No Sidekiq retries | No OnCancelJob error in logs |
Test 6: IST Timestamps
| Step | Action | Expected |
|---|---|---|
| 6.1 | Check on_search response | Slot timestamps are IST format without Z (e.g., T09:00:00) |
| 6.2 | Check on_init response | Context timestamp in IST |
| 6.3 | Check on_confirm response | Authorization valid_from/valid_to in IST |
| 6.4 | Check patient appointments page | Time displays as IST (not UTC) |
Test 7: Location Block
| Step | Action | Expected |
|---|---|---|
| 7.1 | Check on_init response | order.location block present with facility details |
| 7.2 | Check on_confirm response | order.location block present |
| 7.3 | Check on_cancel response | order.location block present |
Test 8: Duplicate Slot Prevention
| Step | Action | Expected |
|---|---|---|
| 8.1 | On slot selection, click date A → B → A | Only one set of slots per date, no duplicates |
| 8.2 | On a date with 0 slots | "No slots on this date" shown inline, date tabs remain visible |
| 8.3 | On a date with 0 slots | Polling stops immediately (not 30s timeout) |
Test 9: Reverse Sync — CMS Status → UHI
| Step | Action | Expected |
|---|---|---|
| 9.1 | Open CMS app, find the clinical appointment from Test 1 | Appointment shows status "Booked" |
| 9.2 | Change status to "Arrived" (or "In Progress") in CMS | after_update fires notify_eua! |
| 9.3 | Check uhi.requests | New on_update request sent to gateway |
| 9.4 | Check UHI appointment detail page | Status reflects the CMS change |
| 9.5 | Change status to "Completed" in CMS | notify_eua! sends COMPLETED state |
| 9.6 | Change status to "No Show" in CMS | notify_eua! sends NO_SHOW state |
| 9.7 | Change status to "Cancelled" in CMS | notify_eua! sends CANCELLED state |