- Added DEPLOYMENT-RESILIENCE.md with strategies for resilient testing - Created TROUBLESHOOTING.md with solutions to common issues - Added SELECTORS.md as a centralized selector database - Created auto-recovery.sh script for automated test failure recovery - Enhanced overall testing framework resilience 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
7.1 KiB
Troubleshooting Guide for HVAC Community Events
This document provides solutions for common issues encountered during testing and deployment of the HVAC Community Events plugin.
Common Test Failures
Login Issues
Symptoms:
- Tests fail with "could not find element"
- Login form selectors not found
- Unexpected redirects during login
Solutions:
-
Verify selectors:
# Run login page debug script npx playwright test tests/e2e/debug-login-page.spec.ts -
Check login form structure:
- Inspect the login form HTML from screenshots
- Verify form IDs and input names match selectors
- Update
LoginPage.tsselectors if necessary
-
Test user credentials:
# Recreate test users ./bin/create-test-users.sh -
Clear browser session:
# Start with fresh context in tests await context.clearCookies();
Certificate Generation Issues
Symptoms:
- Certificate generation fails
- Empty certificate data
- Missing attendees in certificate list
Solutions:
-
Verify test data:
# Create fresh test data ./bin/create-test-data-with-checkins.sh -
Check plugin activation:
# Verify plugin is active ./bin/verify-plugin-status.sh -
Debug certificate system:
# Run certificate debug script ./bin/debug-certificate-system.sh -
Check for WordPress updates:
- Plugin may need updates for compatibility
- Verify WordPress core version
Dashboard Issues
Symptoms:
- Dashboard elements not found
- Event counts incorrect
- Statistics not displaying
Solutions:
-
Verify dashboard page structure:
# Run dashboard debug script npx playwright test tests/e2e/debug-dashboard.test.ts -
Check test events:
# Create test events for dashboard ./bin/create-test-events-admin.sh -
Clear cache:
# Clear WordPress cache ./bin/clear-wp-cache.sh -
Check event data:
- Verify event metadata is correct
- Check user has permission to view events
Deployment Issues
Plugin Activation Failures
Symptoms:
- Plugin fails to activate
- Missing functionality after activation
- PHP errors on activation
Solutions:
-
Check activation hooks:
- Verify activation hooks are running
- Check for PHP errors in logs
-
Reset plugin state:
# Deactivate and reactivate plugin ./bin/reset-plugin-state.sh -
Check dependencies:
- Verify required plugins are active
- Check plugin compatibility with WordPress version
-
Debug mode:
# Enable WordPress debug mode ./bin/enable-wp-debug.sh
Database Issues
Symptoms:
- Missing or corrupted data
- Database queries failing
- Unexpected query results
Solutions:
-
Check database tables:
# Verify database tables exist ./bin/check-db-tables.sh -
Repair database:
# Run WordPress database repair ./bin/repair-wp-database.sh -
Check data integrity:
- Verify data relationships are intact
- Check for orphaned records
-
Regenerate test data:
# Clean and regenerate test data ./bin/regenerate-test-data.sh
Performance Issues
Slow Test Execution
Symptoms:
- Tests taking longer than expected
- Timeouts during test execution
- Inconsistent test timing
Solutions:
-
Profile test execution:
# Run tests with timing information npx playwright test --reporter=list,json -
Optimize selectors:
- Use more specific selectors
- Avoid complex selector chains
-
Adjust timeouts:
// Increase timeouts for slow operations await page.waitForSelector(selector, { timeout: 30000 }); -
Reduce test dependencies:
- Make tests more independent
- Reduce shared state between tests
Browser Performance
Symptoms:
- Browser becomes unresponsive
- High CPU/memory usage
- Slow UI interactions
Solutions:
-
Use headless mode:
# Run tests in headless mode npx playwright test --headless -
Limit concurrent tests:
# Run with fewer workers npx playwright test --workers=2 -
Clear browser cache:
// Clear cache before tests await page.context().clearCookies(); -
Optimize page load:
// Wait for network idle await page.waitForLoadState('networkidle');
Environment Issues
Staging Environment
Symptoms:
- Tests pass locally but fail on staging
- Different behavior between environments
- Connectivity issues with staging
Solutions:
-
Verify staging config:
# Check staging configuration ./bin/verify-staging-config.sh -
Test connectivity:
# Check connectivity to staging ./bin/check-staging-connectivity.sh -
Sync local with staging:
# Sync local environment with staging ./bin/sync-staging.sh -
Debug staging environment:
# Run diagnostic on staging ./bin/diagnose-staging.sh
CI/CD Environment
Symptoms:
- Tests pass locally but fail in CI
- Timeouts specific to CI environment
- Missing dependencies in CI
Solutions:
-
Check CI configuration:
- Verify CI environment variables
- Check dependency installation
-
Increase CI timeouts:
# In CI config timeout-minutes: 30 -
Debug CI environment:
# Add debugging output to CI set -x env | sort -
Use CI-specific configs:
// In playwright.config.ts const config = { // CI-specific settings retries: process.env.CI ? 2 : 0, timeout: process.env.CI ? 60000 : 30000, };
Advanced Troubleshooting
Analyzing Test Videos
Playwright records videos of test runs. Use them to identify visual issues:
# Run tests with video recording
npx playwright test --video=on
# Videos are saved in test-results directory
Using Trace Viewer
For detailed analysis of test execution:
# Run tests with tracing
npx playwright test --trace=on
# Open trace viewer
npx playwright show-trace test-results/trace.zip
Manual Test Recovery
If automated tests consistently fail:
- Create a simpler test case that isolates the issue
- Run in headed mode with slower execution:
npx playwright test --headed --timeout=60000 --debug - Step through the test manually to identify the exact failure point
- Update selectors or test logic based on findings
Health Check Script
Run a comprehensive health check:
# Full system health check
./bin/health-check.sh
# Output detailed diagnostics
./bin/health-check.sh --verbose
Getting Help
If issues persist after trying these solutions:
- Check the issue tracker for similar problems
- Consult the WordPress support forums
- Review The Events Calendar plugin documentation
- Contact the development team with detailed reproduction steps