# MVP Integration Testing Plan

## 1. Introduction

This document outlines the Minimum Viable Product (MVP) integration testing strategy for the HVAC Community Events plugin. The project involves a custom WordPress plugin designed to integrate seamlessly with The Events Calendar (TEC) suite of plugins to provide a specialized community events platform for independent trainers.

## 2. Scope

The scope of this MVP integration testing plan is focused on verifying the core functionality and compatibility of the HVAC Community Events plugin within a production-like staging environment.

**Included in Scope:**

*   Verification of successful deployment of the custom plugin to the staging server.
*   Execution and passing of key Playwright End-to-End (E2E) tests covering critical trainer workflows.
*   Confirmation of compatibility and lack of major conflicts with the required TEC plugins when the HVAC plugin is active.

**Excluded from Scope:**

*   Comprehensive unit testing (covered by separate plans).
*   Detailed performance testing beyond basic functionality.
*   In-depth security vulnerability testing.
*   Testing of features planned for Phase 2 and Phase 3 (e.g., Zoho CRM integration, Certificate generation, Email Attendees).

## 3. Objectives

The primary objectives of the MVP integration testing are to:

*   Ensure the HVAC Community Events plugin functions correctly and as expected when integrated with WordPress and the TEC suite on the staging environment.
*   Validate the critical trainer user journeys through automated E2E tests to confirm a stable user experience for core tasks.
*   Confirm that the HVAC plugin does not introduce significant conflicts or break existing functionality provided by the required TEC plugins.

## 4. Key MVP Integration Test Cases (Playwright E2E)

The following Playwright E2E test cases are considered critical for MVP integration coverage and will be executed on the staging environment:

*   **Trainer Registration:** Verifies the ability for a new user to successfully register as a trainer through the custom registration page (`/trainer-registration/`).
*   **Trainer Login:** Verifies the ability for a registered trainer to log in via the custom community login page (`/community-login/`).
*   **Viewing the Trainer Dashboard:** Confirms that a logged-in trainer can access and view their custom dashboard page (`/hvac-dashboard/`) and see relevant summary information.
*   **Creating an Event:** Validates the process of a trainer creating a new event using the integrated event creation form (leveraging TEC Community Events functionality).
*   **Editing an Event:** Verifies that a trainer can successfully modify details of an existing event.
*   **Viewing Event Summary:** Confirms that a trainer can access and view the detailed summary page for a specific event, including relevant event and transaction information.

These tests utilize the Playwright framework as detailed in `docs/REQUIREMENTS.md` and are executed via the `./bin/run-tests.sh --e2e` script located in the `wordpress-dev/` directory. This script should be executed from the `wordpress-dev/` directory. Test data, such as user personas, is managed using the test environment setup scripts (`./tests/run-tests.sh setup`, `./tests/run-tests.sh teardown`).

## 5. Testing Environment

The target environment for MVP integration testing is the **Staging Server** as described in `wordpress-dev/README.md`.

**Required Environment Components:**

*   WordPress (latest stable version)
*   HVAC Community Events plugin (latest deployed version)
*   The Events Calendar (Free) — `the-events-calendar`
*   Events Calendar Pro — `events-calendar-pro`
*   Event Tickets — `event-tickets`
*   Event Tickets Plus — `event-tickets-plus`
*   The Events Calendar: Community Events — `the-events-calendar-community-events`

The staging environment setup and configuration details, including SSH access and database credentials, are managed via environment variables and scripts located in the `wordpress-dev/bin/` directory, as outlined in `wordpress-dev/README.md` and `wordpress-dev/MIGRATION_GUIDE.md`.

## 6. Testing Tools and Framework

*   **Playwright:** The primary tool for automating browser interactions and executing E2E test cases.
*   **`./tests/run-tests.sh`:** The main script used to trigger the execution of the Playwright test suite targeting the staging environment URL defined in the `.env` file.
*   **Test Environment Management Scripts:** Scripts like `./tests/run-tests.sh setup` and `./tests/run-tests.sh teardown` are used to prepare and clean up necessary test data (e.g., test users) on the staging environment.
*   **Markdown Test Reporting:** The custom reporter generates LLM-friendly reports summarizing test results, as described in `docs/REQUIREMENTS.md`.

### 6.1 Test User Setup

A test user with the 'hvac_trainer' role is required to execute the E2E tests covering trainer workflows. This user can be created on the staging environment using the following script:

```bash
./bin/setup-staging-test-users.sh
```

This script should be executed from the `wordpress-dev/` directory after the HVAC Community Events plugin has been deployed and activated on the staging server. The script creates a user with the username `test_trainer` and password `Test123!`.

### 6.2 Compatibility Verification

Compatibility with the required TEC plugins is primarily verified through the successful execution of the MVP E2E test cases. These tests inherently interact with the functionality provided by The Events Calendar suite (e.g., event forms, dashboard views, event pages).

Successful completion of the E2E test suite without errors indicates that the HVAC plugin is functioning correctly alongside the TEC plugins for the covered MVP workflows. Manual spot-checking on the staging site may be performed to supplement automated tests if specific integration points require additional verification.

It is important to note that backend issues, such as database connection failures, can prevent the application from rendering correctly and lead to E2E test failures, indicating underlying compatibility or environment problems.

## 7. Success Criteria

MVP integration testing is considered successful when the following criteria are met:

*   The HVAC Community Events plugin is successfully deployed to the staging environment.
*   All key MVP Playwright E2E test cases listed in Section 4 pass without errors when executed against the staging environment.
*   No critical errors, conflicts, or breaking issues are observed on the staging site related to the required TEC plugins when the HVAC Community Events plugin is active.

## 8. MVP Integration Testing Flow

```mermaid
graph TD
    A[Deploy HVAC Plugin to Staging] --> B{Required TEC Plugins Active?};
    B -- Yes --> C[Run Playwright MVP E2E Tests];
    B -- No --> D[Activate Required TEC Plugins];
    D --> C;
    C --> E{All MVP Tests Pass?};
    E -- Yes --> F[MVP Integration Testing Successful];
    E -- No --> G[Identify & Fix Issues];
    G --> A;
```

This flow illustrates the iterative process of deploying the plugin, ensuring the environment is ready, running the automated tests, and addressing any failures until the success criteria are met.

---
**Recent Update [2025-04-24]:**  
- All plugin verification and activation scripts now target the correct TEC plugin slugs (`the-events-calendar`, `events-calendar-pro`, `the-events-calendar-community-events`, `event-tickets`, `event-tickets-plus`).  
- Playwright E2E tests and debug artifact capture are in place.  
- All plugin activation issues are resolved.  
- `[tribe_community_events view="list"]` rendering and "my-events" page issues remain for further investigation.