upskill-event-manager/wordpress-dev/tests/e2e/debug-button-click.test.ts
bengizmo a0d47b3b3e feat: Implement configurable Communication Schedule system
This commit implements Phase 1 of the Communication Schedule system, providing:

Core Infrastructure:
- HVAC_Communication_Scheduler: Main controller with cron integration and AJAX handlers
- HVAC_Communication_Schedule_Manager: CRUD operations and database interactions
- HVAC_Communication_Trigger_Engine: Automation logic and recipient management
- HVAC_Communication_Logger: Execution logging and performance tracking
- HVAC_Communication_Installer: Database table creation and management

Features:
- Event-based triggers (before/after event, on registration)
- Custom date scheduling with recurring options
- Flexible recipient targeting (all attendees, confirmed, custom lists)
- Template integration with placeholder replacement
- WordPress cron integration for automated execution
- Comprehensive AJAX API for schedule management
- Template quickstart options for common scenarios

UI Components:
- Communication Schedules page with full management interface
- Form-based schedule creation with validation
- Schedule listing with filtering and status management
- Modal recipient preview functionality
- Pre-configured schedule templates for quick setup

Database Design:
- hvac_communication_schedules: Schedule configurations
- hvac_communication_logs: Execution history and statistics
- hvac_event_communication_tracking: Individual email tracking

The system integrates with existing email templates and provides a foundation
for automated communication workflows for HVAC trainers.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-14 00:07:30 -03:00

68 lines
No EOL
2.2 KiB
TypeScript

import { test, expect } from './fixtures/auth';
import { CommonActions } from './utils/common-actions';
test('Debug button click handler', async ({ authenticatedPage: page }) => {
test.setTimeout(30000);
const actions = new CommonActions(page);
// Navigate to templates page
await actions.navigateAndWait('/communication-templates/');
// Wait for scripts
await page.waitForFunction(() => typeof HVACTemplates !== 'undefined');
// Check what happens when we click the button
const buttonTest = await page.evaluate(() => {
const button = document.querySelector('button:has-text("Create New Template")');
if (!button) return { error: 'Button not found' };
const onclick = button.getAttribute('onclick');
return {
buttonFound: true,
onclickAttribute: onclick,
hasOnclickFunction: typeof HVACTemplates.createNewTemplate === 'function'
};
});
console.log('Button investigation:', buttonTest);
// Try to call the function manually and see what happens
const manualCall = await page.evaluate(() => {
try {
console.log('Calling HVACTemplates.createNewTemplate...');
HVACTemplates.createNewTemplate();
const overlay = document.getElementById('template-form-overlay');
return {
success: true,
overlayExists: !!overlay,
display: overlay ? overlay.style.display : 'no overlay'
};
} catch (error) {
return {
success: false,
error: error.message
};
}
});
console.log('Manual function call result:', manualCall);
// Monitor console messages during button click
const consoleMessages: string[] = [];
page.on('console', (msg) => {
consoleMessages.push(`[${msg.type()}] ${msg.text()}`);
});
// Click the button and see what happens
await page.locator('button:has-text("Create New Template")').click();
await page.waitForTimeout(2000);
console.log('Console messages after button click:', consoleMessages);
// Check if modal is visible
const modalVisible = await page.locator('#template-form-overlay').isVisible();
console.log('Modal visible after button click:', modalVisible);
await actions.screenshot('debug-button-click-result');
});