Skip to content

[daily-playwright] Add tests for Appointment Detail page - #16709

Draft
github-actions[bot] wants to merge 1 commit into
developfrom
daily-playwright/2026-08-18-44db9a8f660da2c6
Draft

[daily-playwright] Add tests for Appointment Detail page#16709
github-actions[bot] wants to merge 1 commit into
developfrom
daily-playwright/2026-08-18-44db9a8f660da2c6

Conversation

@github-actions

Copy link
Copy Markdown

Summary

Adds comprehensive Playwright E2E tests for the Appointment Detail page (/facility/:facilityId/patient/:patientId/appointments/:appointmentId).

What Was Tested

This PR adds 8 test cases covering the full appointment detail page functionality:

  1. Page Load & Key Elements - Verifies page title, back button, patient info, and status badge
  2. Status Badge Display - Tests appointment status visibility and styling
  3. Patient Info Card - Tests hover card interaction and profile link visibility
  4. Actions Menu - Tests actions dropdown (reschedule, cancel, mark fulfilled, etc.)
  5. Back Navigation - Tests back button returns to previous page
  6. Success Message - Tests success alert display when showSuccess=true param
  7. Scheduling Details - Tests date, time, and resource information display
  8. Tags Display - Tests tag badges and tag management functionality

Why This Matters

The appointment detail page is critical for:

  • Viewing appointment details and patient information
  • Managing appointment status (check-in, cancel, reschedule, mark fulfilled/no-show)
  • Viewing scheduling information and practitioner details
  • Managing appointment tags
  • Redirecting after appointment creation with success message

Despite having 14 source files in the appointments feature, the detail page had zero test coverage before this PR.

Test Quality

Follows all best practices:

  • Role-based selectors (getByRole, getByText, semantic attributes)
  • Web-first assertions (toBeVisible, not.toContain)
  • Graceful handling of missing data with test.skip()
  • Independent test cases with proper setup
  • Clear JSDoc comments explaining each test purpose
  • Uses authenticated storage state and helper functions

How to Run Locally

# Prerequisites
npm run build                                           # Build app (required)
# Ensure backend is running on port 9000 with fixtures loaded

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

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

# Interactive UI mode for debugging
npx playwright test tests/facility/appointments/appointmentDetail.spec.ts --ui

Coverage Progress

Appointments Feature:

  • ✅ List page (7 tests) - PR #[previous PR number]
  • Detail page (8 tests) - This PR
  • ⏭️ Print page (next)
  • ⏭️ Booking workflow (after print)

Overall Stats:

  • Total test files: 95 (was 94)
  • Appointments coverage: ~14% (2 test files for 14 source files)

Tracking Issue

Part of incremental coverage improvement tracked in #16623

Test File Details

File: tests/facility/appointments/appointmentDetail.spec.ts
Lines of Code: ~326 lines
Test Framework: Playwright with TypeScript
Auth State: tests/.auth/user.json (admin user)

Key Dependencies:

  • getFacilityId() from tests/support/facilityId
  • getPatientId() from tests/support/patientId
  • faker for data generation (not used in this file but imported for consistency)

Graceful Degradation:
All tests use test.skip(!appointmentId, "No appointment available for testing") to gracefully skip when no appointments exist in the system, making the tests robust for different environment states.


Automated PR by Daily Playwright Test Improver

This PR was created as a draft for review. It represents one small, focused improvement to test coverage that can be reviewed in 5-10 minutes.

AI generated by Daily Playwright Test Improver

- Add 8 test cases for appointment detail page
- Test page load, status display, patient info card
- Test actions menu, navigation, success alerts
- Test scheduling details and tags display
- Uses role-based selectors and web-first assertions
- Gracefully handles missing appointment data
@@ -0,0 +1,326 @@
import { faker } from "@faker-js/faker";
@@ -0,0 +1,326 @@
import { faker } from "@faker-js/faker";
import { expect, test } from "@playwright/test";
import { format } from "date-fns";
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying care-preview with  Cloudflare Pages  Cloudflare Pages

Latest commit: 213c8a8
Status: ✅  Deploy successful!
Preview URL: https://d1c63115.care-preview-a7w.pages.dev
Branch Preview URL: https://daily-playwright-2026-08-18.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