Skip to content

PatternFly 6 Testing Patterns

This directory contains comprehensive testing guides for PatternFly 6 components in JSDOM test environments (Vitest).

Testing Guides

Common Testing Patterns

Key Principles

  1. Use PatternFly Testing Utilities - Leverage official testing helpers
  2. Mock Portal Rendering - Handle components that render to portals
  3. Test Accessibility - Verify ARIA attributes and keyboard navigation
  4. Handle Async Updates - Use waitFor and proper async testing patterns

Common Issues

  • Portal Components: Modals, dropdowns, and tooltips render to document.body
  • Context Requirements: Some components need parent context providers
  • Async Rendering: PatternFly components may have delayed DOM updates

Testing Stack

  • Vitest: Test runner
  • React Testing Library: Component testing utilities
  • @testing-library/user-event: User interaction simulation
  • @patternfly/react-core: PatternFly 6 components

External Resources