upskill-event-manager/test-check-form-type.js
Ben 0f94a42f15 fix: enable TEC event edit field population for manage event page
- Re-enabled HVAC_Event_Edit_Comprehensive class initialization
- Added proper file includes for event edit classes
- Updated JavaScript to wait for TEC form to fully load via AJAX
- Fixed field selectors to match actual form structure
- Increased timeouts to handle AJAX form rendering
- Prioritized correct selectors for form fields

The comprehensive fix now properly loads event data and populates fields
when editing events from the trainer dashboard.

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-18 13:49:09 -03:00

80 lines
No EOL
3.2 KiB
JavaScript
Executable file

#!/usr/bin/env node
const { chromium } = require('@playwright/test');
(async () => {
console.log('Checking what form is actually on the manage event page...\n');
const browser = await chromium.launch({
headless: true,
args: ['--no-sandbox']
});
const page = await browser.newPage();
try {
// Login
console.log('1. Logging in...');
await page.goto('https://upskill-staging.measurequick.com/wp-login.php');
await page.fill('#user_login', 'test_admin');
await page.fill('#user_pass', 'TestAdmin2025!');
await page.click('#wp-submit');
await page.waitForTimeout(3000);
// Go to manage event page with event_id
console.log('2. Going to manage event page with event_id=6161...');
await page.goto('https://upskill-staging.measurequick.com/trainer/event/manage/?event_id=6161');
await page.waitForLoadState('networkidle');
// Check what's actually on the page
const pageContent = await page.evaluate(() => {
const results = {};
// Check for any forms
const forms = document.querySelectorAll('form');
results.formsCount = forms.length;
results.formIds = Array.from(forms).map(f => f.id || '(no id)');
// Check for TEC shortcode content
const shortcodeDiv = document.querySelector('[data-tribe-shortcode]');
results.hasTribeShortcode = !!shortcodeDiv;
// Check for actual TEC form
const tecForm = document.querySelector('#add-new-event, .tribe-community-events-content, #tribe-community-events');
results.hasTECForm = !!tecForm;
// Check page content
const contentArea = document.querySelector('.hvac-page-content');
if (contentArea) {
results.contentHTML = contentArea.innerHTML.substring(0, 2000);
}
// Check for title input specifically
const titleInput = document.querySelector('input[name="post_title"]');
results.hasTitleInput = !!titleInput;
results.titleValue = titleInput ? titleInput.value : null;
// Check for the shortcode itself
const shortcodeText = document.body.innerText.includes('[tribe_community_events]');
results.hasShortcodeText = shortcodeText;
return results;
});
console.log('\n3. Page Analysis:');
console.log(' Forms found:', pageContent.formsCount);
console.log(' Form IDs:', pageContent.formIds);
console.log(' Has TEC shortcode div:', pageContent.hasTribeShortcode);
console.log(' Has TEC form:', pageContent.hasTECForm);
console.log(' Has shortcode text:', pageContent.hasShortcodeText);
if (pageContent.contentHTML) {
console.log('\n4. Content preview:');
console.log(pageContent.contentHTML);
}
} catch (error) {
console.error('Error:', error.message);
} finally {
await browser.close();
}
})();