upskill-event-manager/memory-bank/systemPatterns.md
Ben Reed 04dcc32919 feat(testing): Implement comprehensive trainer journey test suite with Page Object Model
- Created Page Object Model structure for all trainer-facing pages
- Implemented complete test coverage for trainer journey steps 1-8
- Added centralized test data management with test users and events
- Updated run-tests.sh with --trainer-journey option for easy execution
- Enhanced documentation with test setup, usage, and troubleshooting guides
- Created verification scripts to ensure proper test environment setup
- Prepared framework for Phase 2/3 features (email, check-in, certificates)

This implementation provides a solid foundation for testing the complete trainer user journey and can be easily extended as new features are deployed.
2025-05-18 15:42:00 -03:00

2.2 KiB

[2025-04-14 16:16:30] - Test Data Generation Pattern

  • Implemented standardized test data generation via HVAC_Test_Data_Generator class
  • Key features:
    1. Consistent data structure generation
    2. Override support for custom test scenarios
    3. Bulk generation capabilities
    4. Role-specific user creation
  • Benefits:
    • Reduced test setup code
    • Consistent test data across test cases
    • Easier maintenance of test data structures
    • Improved test reliability

System Patterns

[2025-04-14 09:57:09] - Test Environment Pattern

  • Implements a robust test environment setup using HVAC_Test_Environment class

  • Key components:

    1. Transaction Management

      • Uses database transactions for test isolation
      • Automatic rollback after each test
      • Ensures clean state between tests
    2. Plugin Verification

      • Verifies TEC CE plugin activation
      • Checks required plugin dependencies
      • Fails fast if environment is not properly configured
    3. Environment Reset

      • Cleans up test data after each test
      • Resets WordPress roles and capabilities
      • Manages test user lifecycle
    4. Base Test Case

      • Extends WP_UnitTestCase for WordPress integration
      • Provides helper methods for common test operations
      • Handles test environment setup/teardown automatically
  • Benefits:

    • Consistent test environment across all test cases
    • Isolated tests with automatic cleanup
    • Reduced test interference
    • Simplified test case implementation

Command Execution Patterns

[2025-04-13 09:12:09] - Always use absolute paths when executing commands

  • Commands should use full paths starting from root (e.g., /Users/ben/dev/...)
  • This ensures consistency and reliability across different working directories
  • Example: Use /Users/ben/dev/upskill-event-manager/wordpress-dev/tests/e2e/login.spec.ts instead of tests/e2e/login.spec.ts

Test Environment Setup

[Previous test environment setup patterns would be here...] [2025-04-29 19:09:15] - Pattern: When debugging Playwright E2E tests for WordPress plugin features, always verify the actual DOM structure and use debug logs to confirm selector validity before assuming test logic is at fault.