Skip to content

Add E2E tests for Appointments page - #16682

Draft
github-actions[bot] wants to merge 1 commit into
developfrom
develop-eaeb55300daff61c
Draft

Add E2E tests for Appointments page#16682
github-actions[bot] wants to merge 1 commit into
developfrom
develop-eaeb55300daff61c

Conversation

@github-actions

Copy link
Copy Markdown

Summary

This PR adds comprehensive E2E test coverage for the Appointments page (/facility/:facilityId/appointments), which previously had zero test coverage despite being a critical clinical workflow interface.

What's Changed

New Test File: tests/appointments/appointmentsPage.spec.ts

Test Coverage (7 test cases):

  • ✅ Page loads successfully with correct heading and main elements
  • ✅ View toggle functionality (Board ↔ List views)
  • ✅ Filter UI accessibility and presence
  • ✅ Empty state handling and appointments display
  • ✅ URL state persistence across page reloads
  • ✅ Date filter controls availability
  • ✅ Direct navigation via URL

Why This Matters

The appointments page is used daily by clinical staff to:

  • View upcoming and past appointments
  • Filter by practitioner, date, and status
  • Switch between board (kanban) and list views
  • Access appointment details for patient care

This foundational test coverage ensures the page continues to function correctly as the codebase evolves.

Testing Approach

  • Selectors: Uses role-based selectors (getByRole, getByLabel) per Playwright best practices
  • Resilience: Tests handle multiple UI states (appointments present, empty state, loading)
  • Independence: Each test is self-contained with no shared state
  • Authentication: Uses admin storage state from test fixtures
  • Standards: Follows patterns from tests/PLAYWRIGHT_GUIDE.md

How to Run

# Run the new test file
npx playwright test tests/appointments/appointmentsPage.spec.ts

# Run with UI mode for debugging
npx playwright test tests/appointments/appointmentsPage.spec.ts --ui

# Prerequisites: Backend running on port 9000, app built with `npm run build`

Related Issue

Tracking issue: #16623 - [daily-playwright] Playwright Test Coverage Tracker

Next Steps

This PR establishes the foundation for appointments testing. Future improvements could include:

  1. Appointment booking workflow tests
  2. Appointment details page tests (view, edit, cancel, reschedule)
  3. Queue management and token generation tests

Test Quality Checklist
  • Uses role-based selectors (getByRole, getByLabel, getByText)
  • Avoids CSS selectors unless absolutely necessary
  • Includes proper assertions (not just navigation checks)
  • Handles loading states appropriately
  • Tests both success and error/empty paths
  • Is independent of other tests (no shared state)
  • Follows file naming convention: (feature).spec.ts

Automated PR created by Daily Playwright Test Improver

AI generated by Daily Playwright Test Improver

- Add comprehensive test coverage for appointments listing page
- Test view switching (Board/List), filtering, and navigation
- Validate empty state handling and URL persistence
- Follows Playwright best practices with role-based selectors

Closes #16623 (partial - appointments page coverage)
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying care-preview with  Cloudflare Pages  Cloudflare Pages

Latest commit: 119abcf
Status: ✅  Deploy successful!
Preview URL: https://67a3122f.care-preview-a7w.pages.dev
Branch Preview URL: https://develop-eaeb55300daff61c.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