Skip to content

[daily-playwright] Add tests for appointment print page - #16716

Draft
github-actions[bot] wants to merge 1 commit into
developfrom
daily-playwright/2026-08-19-c5c55c92beda5439
Draft

[daily-playwright] Add tests for appointment print page#16716
github-actions[bot] wants to merge 1 commit into
developfrom
daily-playwright/2026-08-19-c5c55c92beda5439

Conversation

@github-actions

Copy link
Copy Markdown

Summary

This PR adds comprehensive Playwright E2E tests for the Appointment Print Page, completing the core appointment feature test coverage.

What was tested

Route: /facility/:facilityId/patient/:patientId/appointments/:appointmentId/print

The appointment print page provides a print-friendly view for healthcare documentation with:

  • Patient information with QR code for tracking
  • Appointment scheduling details (date, time, resource)
  • Token number display
  • Charges table with line items and totals
  • Payment details with invoice information
  • Appointment notes
  • Tags (patient and appointment)
  • Audit footer with creator/updater information

Test cases added (12 tests)

  1. Print preview loads - Verifies print section wrapper and title display
  2. Print controls present - Checks back button and print button visibility
  3. Patient information - Tests patient details display and QR code rendering
  4. Appointment scheduling - Validates date, time, and resource information
  5. Token number - Verifies token display when available
  6. Charges table - Tests table headers, line items, and total calculations
  7. Payment details - Validates payment table with invoice and method info
  8. Appointment notes - Tests notes section display (conditional)
  9. Tags display - Verifies patient and appointment tags rendering
  10. Footer information - Tests creator, updater, and timestamp display
  11. Print button interaction - Validates print button functionality
  12. Back navigation - Tests back button navigation flow
  13. Print layout - Verifies print-optimized width and text sizing

Why this matters

The appointment print page is essential for:

  • 📋 Documentation: Generating physical records for patient files
  • 🏥 Clinical workflows: Providing appointment slips at registration
  • 💰 Billing: Printing receipts with charges and payment details
  • 📱 Patient tracking: QR codes for digital record lookup
  • Audit compliance: Creator/updater information for record keeping

Testing approach

  • Comprehensive coverage: All print sections tested (static and conditional)
  • Role-based selectors: Uses getByRole, getByText for accessibility
  • Conditional handling: Tests adapt to optional content (charges, payments, notes)
  • Print optimization: Verifies layout constraints and styling for print media
  • Navigation flow: Tests back button and print actions
  • Graceful degradation: Skips tests when no appointment data exists

Appointment feature progress

  • List page (appointmentsList.spec.ts) - 7 tests ✅
  • Detail page (appointmentDetail.spec.ts) - 8 tests ✅
  • Print page (appointmentPrint.spec.ts) - 12 tests ✅ (NEW)
  • Booking workflow - Remains TODO
  • Cancellation/rescheduling - Remains TODO

Total appointment tests: 27 tests across 3 pages

How to run these tests

# Build the app first (required for all tests)
npm run build

# Ensure backend is running on port 9000 with fixtures loaded

# Run only the new tests
npx playwright test tests/facility/appointments/appointmentPrint.spec.ts

# Run all appointment tests
npx playwright test tests/facility/appointments/

# Run with UI mode for debugging
npx playwright test tests/facility/appointments/appointmentPrint.spec.ts --ui
Test Quality Checklist
  • ✅ Uses role-based selectors (getByRole, getByText, locator with semantic IDs)
  • ✅ Avoids CSS selectors unless absolutely necessary
  • ✅ Includes proper assertions (toBeVisible, toBeEnabled, not.toContain)
  • ✅ Handles loading states appropriately (waitForLoadState)
  • ✅ Tests both success paths and conditional content
  • ✅ Is independent of other tests (no shared state)
  • ✅ Follows file naming convention: appointmentPrint.spec.ts
  • ✅ Uses authenticated storage state: tests/.auth/user.json
  • ✅ Retrieves fixture IDs via helpers (getFacilityId, getPatientId)
  • ✅ Clear JSDoc comments explaining test purpose
  • ✅ Uses test.step() for logical grouping

Related


AI generated by Daily Playwright Test Improver

AI generated by Daily Playwright Test Improver

- Add 12 comprehensive tests for appointment print page
- Test print preview components (patient info, QR code, charges, payments)
- Verify print controls and navigation
- Test conditional content (notes, tags, token number)
- Validate print-optimized layout and styling

Route tested: /facility/:facilityId/patient/:patientId/appointments/:appointmentId/print

Closes: #16623
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying care-preview with  Cloudflare Pages  Cloudflare Pages

Latest commit: 590f75b
Status: ✅  Deploy successful!
Preview URL: https://4da5ea9f.care-preview-a7w.pages.dev
Branch Preview URL: https://daily-playwright-2026-08-19.care-preview-a7w.pages.dev

View logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants