fix: master dashboard layout and breadcrumb issues

- Fixed breadcrumb method name (render() -> render_breadcrumbs())
- Resolved two-column layout by moving navigation inside content wrapper
- Added dedicated CSS to force single-column layout
- Updated hierarchical URL detection for master dashboard pages
- Updated TROUBLESHOOTING.md with complete master dashboard fixes
- Removed redundant authentication blocking content display
This commit is contained in:
Ben 2025-08-22 15:16:45 -03:00
parent f9e98cb5cd
commit bc2a7191e7
11 changed files with 553 additions and 79 deletions

View file

@ -118,7 +118,9 @@
"Bash(DISPLAY=:0 XAUTHORITY=/run/user/1000/.mutter-Xwaylandauth.90WDB3 node test-master-trainer-verification.js)", "Bash(DISPLAY=:0 XAUTHORITY=/run/user/1000/.mutter-Xwaylandauth.90WDB3 node test-master-trainer-verification.js)",
"Bash(UPSKILL_STAGING_URL=\"https://upskill-staging.measurequick.com\" wp-cli.phar --url=$UPSKILL_STAGING_URL --ssh=root@upskill-staging.measurequick.com post list --post_type=page --search=\"master-trainer\" --fields=ID,post_title,post_name,post_status)", "Bash(UPSKILL_STAGING_URL=\"https://upskill-staging.measurequick.com\" wp-cli.phar --url=$UPSKILL_STAGING_URL --ssh=root@upskill-staging.measurequick.com post list --post_type=page --search=\"master-trainer\" --fields=ID,post_title,post_name,post_status)",
"Bash(UPSKILL_STAGING_URL=\"https://upskill-staging.measurequick.com\" wp --url=$UPSKILL_STAGING_URL --ssh=root@upskill-staging.measurequick.com post list --post_type=page --search=\"master\" --fields=ID,post_title,post_name,post_status)", "Bash(UPSKILL_STAGING_URL=\"https://upskill-staging.measurequick.com\" wp --url=$UPSKILL_STAGING_URL --ssh=root@upskill-staging.measurequick.com post list --post_type=page --search=\"master\" --fields=ID,post_title,post_name,post_status)",
"Bash(DISPLAY=:0 XAUTHORITY=/run/user/1000/.mutter-Xwaylandauth.90WDB3 node test-master-trainer-debug.js)" "Bash(DISPLAY=:0 XAUTHORITY=/run/user/1000/.mutter-Xwaylandauth.90WDB3 node test-master-trainer-debug.js)",
"Bash(DISPLAY=:0 XAUTHORITY=/run/user/1000/.mutter-Xwaylandauth.90WDB3 node test-page-source-debug.js)",
"Bash(DISPLAY=:0 XAUTHORITY=/run/user/1000/.mutter-Xwaylandauth.90WDB3 node test-logged-in-master.js)"
], ],
"deny": [] "deny": []
}, },

View file

@ -0,0 +1,83 @@
/**
* HVAC Master Dashboard Specific Styles
* Ensures proper single-column layout
*/
/* Force single column layout for master dashboard */
.hvac-master-dashboard-page {
width: 100% !important;
max-width: 100% !important;
}
.hvac-master-dashboard-page .hvac-page-wrapper {
width: 100% !important;
max-width: 100% !important;
}
/* Ensure navigation doesn't create sidebar */
.hvac-master-dashboard-page .hvac-trainer-menu-wrapper {
width: 100% !important;
display: block !important;
float: none !important;
position: relative !important;
margin-bottom: 20px !important;
}
/* Force horizontal menu layout */
.hvac-master-dashboard-page .hvac-trainer-menu {
display: flex !important;
flex-direction: row !important;
flex-wrap: wrap !important;
width: 100% !important;
float: none !important;
}
/* Ensure content takes full width */
.hvac-master-dashboard-page .container {
width: 100% !important;
max-width: 1200px !important;
margin: 0 auto !important;
padding: 0 20px !important;
float: none !important;
display: block !important;
}
/* Remove any potential sidebar styles from theme */
.hvac-master-dashboard-page .ast-container,
.hvac-master-dashboard-page .content-area,
.hvac-master-dashboard-page #primary {
width: 100% !important;
max-width: 100% !important;
float: none !important;
margin: 0 !important;
}
/* Hide any theme sidebars on master dashboard */
.hvac-master-dashboard-page #secondary,
.hvac-master-dashboard-page .widget-area,
.hvac-master-dashboard-page .sidebar {
display: none !important;
}
/* Ensure main content area is full width */
.hvac-master-dashboard-page #main,
.hvac-master-dashboard-page .site-main {
width: 100% !important;
float: none !important;
margin: 0 !important;
}
/* Remove any grid or flex layouts that might create columns */
.hvac-master-dashboard-page .ast-row {
display: block !important;
width: 100% !important;
}
.hvac-master-dashboard-page .ast-col-lg-8,
.hvac-master-dashboard-page .ast-col-lg-4,
.hvac-master-dashboard-page .ast-col-md-8,
.hvac-master-dashboard-page .ast-col-md-4 {
width: 100% !important;
float: none !important;
display: block !important;
}

View file

@ -33,6 +33,110 @@ $has_trainer_role = in_array('hvac_trainer', $user->roles) ||
if (current_user_can('hvac_trainer')) // This won't work! if (current_user_can('hvac_trainer')) // This won't work!
``` ```
#### Master Dashboard Not Displaying Content
**Symptoms:**
- Master dashboard page loads but shows no content
- Blank page after header/navigation
- PHP errors about undefined methods
**Root Causes:**
1. **Breadcrumb method name error**: `HVAC_Breadcrumbs::render()` doesn't exist
2. **Hierarchical URL detection**: `is_page()` doesn't work with URLs like `/master-trainer/master-dashboard/`
3. **Dual authentication blocking**: Both template and centralized auth systems blocking content
**Solutions:**
```php
// Fix 1: Correct breadcrumb method name
// In templates/page-master-dashboard.php
$breadcrumbs_instance = HVAC_Breadcrumbs::instance();
echo $breadcrumbs_instance->render_breadcrumbs(); // NOT render()
// Fix 2: Add proper page detection for hierarchical URLs
// In class-hvac-scripts-styles.php
private function is_master_dashboard_page() {
$current_path = $_SERVER['REQUEST_URI'];
return (strpos($current_path, 'master-trainer/master-dashboard') !== false);
}
// Fix 3: Remove redundant authentication in template
// Comment out template-level auth checks - handled by HVAC_Access_Control
```
#### Master Dashboard Two-Column Layout Issue
**Symptoms:**
- Dashboard displays in two columns instead of single column
- Navigation appears as sidebar on left
- Content pushed to right column
- Unwanted two-column layout
**Root Cause:**
- Navigation menu rendered outside content wrapper
- Theme/CSS treating navigation as sidebar element
- Missing CSS to force single-column layout
**Solutions:**
**1. Move navigation inside content wrapper:**
```php
// In templates/page-master-dashboard.php
get_header();
echo '<div class="hvac-page-wrapper hvac-master-dashboard-page">';
echo '<div class="container">';
// Navigation MUST be inside wrapper
if (class_exists('HVAC_Master_Menu_System')) {
$master_menu = HVAC_Master_Menu_System::instance();
$master_menu->render_master_menu();
}
```
**2. Add CSS to force single-column layout:**
Create `assets/css/hvac-master-dashboard.css`:
```css
/* Force single column layout for master dashboard */
.hvac-master-dashboard-page {
width: 100% !important;
max-width: 100% !important;
}
/* Ensure navigation doesn't create sidebar */
.hvac-master-dashboard-page .hvac-trainer-menu-wrapper {
width: 100% !important;
display: block !important;
float: none !important;
position: relative !important;
margin-bottom: 20px !important;
}
/* Force horizontal menu layout */
.hvac-master-dashboard-page .hvac-trainer-menu {
display: flex !important;
flex-direction: row !important;
flex-wrap: wrap !important;
}
/* Hide any theme sidebars */
.hvac-master-dashboard-page #secondary,
.hvac-master-dashboard-page .widget-area,
.hvac-master-dashboard-page .sidebar {
display: none !important;
}
```
**3. Enqueue the CSS conditionally:**
```php
// In class-hvac-scripts-styles.php
if ($this->is_master_dashboard_page()) {
wp_enqueue_style(
'hvac-master-dashboard',
HVAC_PLUGIN_URL . 'assets/css/hvac-master-dashboard.css',
array('hvac-consolidated-dashboard'),
$this->version
);
}
```
#### Dashboard Dropdown Menus Not Working #### Dashboard Dropdown Menus Not Working
**Symptoms:** **Symptoms:**
- Dropdown menus don't open on click - Dropdown menus don't open on click

View file

@ -436,10 +436,7 @@ class HVAC_Community_Events {
// Initialize communication system // Initialize communication system
$this->init_communication_system(); $this->init_communication_system();
// Initialize access control system // Access control system initialized in main plugin class (HVAC_Plugin)
if (class_exists('HVAC_Access_Control')) {
new HVAC_Access_Control();
}
// Initialize approval workflow // Initialize approval workflow
if (class_exists('HVAC_Approval_Workflow')) { if (class_exists('HVAC_Approval_Workflow')) {
@ -830,17 +827,23 @@ class HVAC_Community_Events {
// Check for trainer dashboard page - force correct template // Check for trainer dashboard page - force correct template
if (is_page('trainer/dashboard')) { // Fix: Use get_page_by_path for hierarchical URLs as is_page() doesn't work with paths
$trainer_dashboard_page = get_page_by_path('trainer/dashboard');
if ($trainer_dashboard_page && is_page($trainer_dashboard_page->ID)) {
$custom_template = HVAC_PLUGIN_DIR . 'templates/page-trainer-dashboard.php'; $custom_template = HVAC_PLUGIN_DIR . 'templates/page-trainer-dashboard.php';
} }
// For master dashboard, force our template regardless of WordPress template assignment // For master dashboard, force our template regardless of WordPress template assignment
if (is_page('master-trainer/master-dashboard')) { // Fix: Use get_page_by_path for hierarchical URLs as is_page() doesn't work with paths
$master_dashboard_page = get_page_by_path('master-trainer/master-dashboard');
if ($master_dashboard_page && is_page($master_dashboard_page->ID)) {
$custom_template = HVAC_PLUGIN_DIR . 'templates/page-master-dashboard.php'; $custom_template = HVAC_PLUGIN_DIR . 'templates/page-master-dashboard.php';
} }
// Check for google-sheets page // Check for google-sheets page
if (is_page('master-trainer/google-sheets')) { // Fix: Use get_page_by_path for hierarchical URLs
$google_sheets_page = get_page_by_path('master-trainer/google-sheets');
if ($google_sheets_page && is_page($google_sheets_page->ID)) {
$custom_template = HVAC_PLUGIN_DIR . 'templates/template-google-sheets.php'; $custom_template = HVAC_PLUGIN_DIR . 'templates/template-google-sheets.php';
} }

View file

@ -333,6 +333,16 @@ class HVAC_Scripts_Styles {
array('hvac-consolidated-core'), array('hvac-consolidated-core'),
$this->version $this->version
); );
// Load master dashboard specific styles to fix layout issues
if ($this->is_master_dashboard_page()) {
wp_enqueue_style(
'hvac-master-dashboard',
HVAC_PLUGIN_URL . 'assets/css/hvac-master-dashboard.css',
array('hvac-consolidated-dashboard'),
$this->version
);
}
} }
// Load fixed forms bundle for registration/profile pages // Load fixed forms bundle for registration/profile pages
@ -1022,6 +1032,29 @@ class HVAC_Scripts_Styles {
return false; return false;
} }
/**
* Check if current page is master dashboard page specifically
*
* @return bool
*/
private function is_master_dashboard_page() {
// Check by page slug
$master_pages = array(
'master-trainer/master-dashboard',
'master-dashboard'
);
foreach ($master_pages as $page_slug) {
if (is_page($page_slug)) {
return true;
}
}
// Also check by URL path
$current_path = $_SERVER['REQUEST_URI'];
return (strpos($current_path, 'master-trainer/master-dashboard') !== false);
}
/** /**
* Check if current page is registration page * Check if current page is registration page
* *

View file

@ -11,46 +11,41 @@ if (!defined('HVAC_IN_PAGE_TEMPLATE')) {
get_header(); get_header();
// Check master trainer permissions FIRST // Authentication handled by centralized HVAC_Access_Control system
$user = wp_get_current_user(); // Redundant template-level auth check removed to prevent content blocking
if (!in_array('hvac_master_trainer', $user->roles) && !current_user_can('manage_options')) {
?>
<div class="hvac-page-wrapper">
<div class="container">
<h1>Access Denied</h1>
<p>You do not have permission to access this page.</p>
<p>If you believe this is an error, please contact an administrator.</p>
<a href="<?php echo home_url(); ?>" class="button">Return to Home</a>
</div>
</div>
<?php
get_footer();
exit;
}
// Render master trainer navigation echo '<div class="hvac-page-wrapper hvac-master-dashboard-page">';
echo '<div class="container">';
// Render master trainer navigation inside the wrapper
if (class_exists('HVAC_Master_Menu_System')) { if (class_exists('HVAC_Master_Menu_System')) {
$master_menu = HVAC_Master_Menu_System::instance(); $master_menu = HVAC_Master_Menu_System::instance();
$master_menu->render_master_menu(); $master_menu->render_master_menu();
} }
// Render breadcrumbs // Render breadcrumbs inside the wrapper
if (class_exists('HVAC_Breadcrumbs')) { if (class_exists('HVAC_Breadcrumbs')) {
HVAC_Breadcrumbs::render(); // Fix: The method is render_breadcrumbs(), not render()
$breadcrumbs_instance = HVAC_Breadcrumbs::instance();
echo $breadcrumbs_instance->render_breadcrumbs();
} }
echo '<div class="hvac-page-wrapper hvac-master-dashboard-page">'; // Render the master dashboard content with output buffering
echo '<div class="container">'; $template_path = HVAC_PLUGIN_DIR . 'templates/template-hvac-master-dashboard.php';
// Render the master dashboard content with output buffering to ensure proper rendering
ob_start(); ob_start();
include HVAC_PLUGIN_DIR . 'templates/template-hvac-master-dashboard.php'; if (file_exists($template_path)) {
include $template_path;
} else {
// Log error for admins only
if (current_user_can('manage_options')) {
echo '<div class="notice notice-error"><p>Template file not found. Please contact support.</p></div>';
}
}
$dashboard_content = ob_get_clean(); $dashboard_content = ob_get_clean();
// Output the dashboard content with debug info // Output the dashboard content
echo '<!-- DEBUG: Dashboard content captured -->';
echo $dashboard_content; echo $dashboard_content;
echo '<!-- DEBUG: Dashboard content end -->';
echo '</div>'; // .container echo '</div>'; // .container
echo '</div>'; // .hvac-page-wrapper echo '</div>'; // .hvac-page-wrapper

View file

@ -11,22 +11,8 @@ if (!defined('HVAC_IN_PAGE_TEMPLATE')) {
get_header(); get_header();
// Check master trainer permissions FIRST // Authentication handled by centralized HVAC_Access_Control system
$user = wp_get_current_user(); // Redundant template-level auth check removed to prevent content blocking
if (!in_array('hvac_master_trainer', $user->roles) && !current_user_can('manage_options')) {
?>
<div class="hvac-page-wrapper">
<div class="container">
<h1>Access Denied</h1>
<p>You do not have permission to access this page.</p>
<p>If you believe this is an error, please contact an administrator.</p>
<a href="<?php echo home_url(); ?>" class="button">Return to Home</a>
</div>
</div>
<?php
get_footer();
exit;
}
// Render master trainer navigation // Render master trainer navigation
if (class_exists('HVAC_Master_Menu_System')) { if (class_exists('HVAC_Master_Menu_System')) {

View file

@ -26,35 +26,8 @@ if ( ! is_user_logged_in() ) {
exit; exit;
} }
// Check if user has permission to view master dashboard - check roles instead of capabilities // Authentication handled by centralized HVAC_Access_Control system
$current_user = wp_get_current_user(); // Redundant template-level auth check removed to prevent content blocking
if ( ! in_array( 'hvac_master_trainer', $current_user->roles ) && ! current_user_can( 'manage_options' ) ) {
// Show access denied message using existing styles
get_header();
?>
<div id="primary" class="content-area primary ast-container">
<main id="main" class="site-main">
<div class="hvac-dashboard-header">
<h1 class="entry-title">Access Denied</h1>
</div>
<div class="hvac-dashboard-stats">
<div class="hvac-stats-row">
<div class="hvac-stat-col">
<div class="hvac-stat-card" style="text-align: center; padding: 40px;">
<p style="color: #d63638; font-size: 18px; margin-bottom: 20px;">You do not have permission to view the Master Dashboard.</p>
<p style="margin-bottom: 20px;">This dashboard is only available to Master Trainers and Administrators.</p>
<a href="<?php echo home_url( '/trainer/dashboard/' ); ?>" class="ast-button ast-button-primary">Go to Your Dashboard</a>
<a href="<?php echo home_url(); ?>" class="ast-button ast-button-secondary">Return to Home</a>
</div>
</div>
</div>
</div>
</main>
</div>
<?php
get_footer();
exit;
}
// Get current user info // Get current user info
$current_user = wp_get_current_user(); $current_user = wp_get_current_user();

102
test-check-wp-page.js Normal file
View file

@ -0,0 +1,102 @@
const { chromium } = require('playwright');
(async () => {
console.log('🔍 Checking if master dashboard page exists in WordPress...');
const browser = await chromium.launch({
headless: false,
slowMo: 500
});
const page = await browser.newPage();
try {
// First check what happens with a simple direct URL access
console.log('📋 Testing direct URL access...');
const response = await page.goto('https://upskill-staging.measurequick.com/master-trainer/master-dashboard/', {
waitUntil: 'networkidle'
});
console.log('- Response status:', response.status());
console.log('- Response URL:', response.url());
// Check page structure
const pageInfo = await page.evaluate(() => {
const bodyClasses = document.body.className;
const pageId = bodyClasses.match(/page-id-(\d+)/)?.[1];
// Check for WordPress's own 404 indicators
const is404 = bodyClasses.includes('error404');
const hasContent = document.querySelector('.entry-content, .site-main, #main, .hvac-page-wrapper');
// Check what template WordPress thinks it's using
const templateClass = bodyClasses.match(/page-template-[\w-]+/)?.[0];
// Check if there's a title element
const title = document.querySelector('h1, .entry-title');
return {
pageId: pageId || 'none',
is404: is404,
hasContent: hasContent !== null,
contentSelector: hasContent ? hasContent.tagName + (hasContent.id ? '#' + hasContent.id : '') + (hasContent.className ? '.' + hasContent.className.split(' ')[0] : '') : 'none',
templateClass: templateClass || 'none',
pageTitle: title ? title.textContent.trim() : 'none',
bodyClassList: bodyClasses
};
});
console.log('\n📊 Page Analysis:');
console.log('- WordPress Page ID:', pageInfo.pageId);
console.log('- Is 404 Page:', pageInfo.is404);
console.log('- Has Content Area:', pageInfo.hasContent);
console.log('- Content Selector:', pageInfo.contentSelector);
console.log('- Template Class:', pageInfo.templateClass);
console.log('- Page Title:', pageInfo.pageTitle);
// Try alternate URL formats
console.log('\n📋 Testing alternate URL formats...');
// Try without trailing slash
const response2 = await page.goto('https://upskill-staging.measurequick.com/master-trainer/master-dashboard', {
waitUntil: 'networkidle'
});
console.log('- Without trailing slash - Status:', response2.status(), 'URL:', response2.url());
// Try the old dashboard URL
const response3 = await page.goto('https://upskill-staging.measurequick.com/master-trainer/dashboard/', {
waitUntil: 'networkidle'
});
console.log('- Old dashboard URL - Status:', response3.status(), 'URL:', response3.url());
// Check what's in the HTML source
const htmlContent = await page.content();
console.log('\n📊 HTML Content Analysis:');
console.log('- Contains "Master Dashboard":', htmlContent.includes('Master Dashboard'));
console.log('- Contains "System Overview":', htmlContent.includes('System Overview'));
console.log('- Contains template debug comment:', htmlContent.includes('DEBUG: template-hvac-master-dashboard.php loaded'));
console.log('- Contains hvac-page-wrapper:', htmlContent.includes('hvac-page-wrapper'));
// Look for any PHP errors in the source
const phpErrors = htmlContent.match(/Fatal error:|Warning:|Notice:|Parse error:/gi);
if (phpErrors) {
console.log('\n⚠ PHP Errors found:', phpErrors);
}
// Take screenshot
await page.screenshot({
path: '/tmp/playwright-mcp-output/wp-page-check.png',
fullPage: false
});
console.log('\n📸 Screenshot saved to /tmp/playwright-mcp-output/wp-page-check.png');
console.log('\n🔍 Keeping browser open for 10 seconds...');
await page.waitForTimeout(10000);
} catch (error) {
console.error('Error during testing:', error);
} finally {
await browser.close();
console.log('✅ Test completed');
}
})();

95
test-logged-in-master.js Normal file
View file

@ -0,0 +1,95 @@
const { chromium } = require('playwright');
(async () => {
console.log('🔍 Testing master dashboard with logged-in session...');
const browser = await chromium.launch({
headless: false,
slowMo: 500
});
const page = await browser.newPage();
try {
// Login first
console.log('📋 Logging in as master trainer...');
await page.goto('https://upskill-staging.measurequick.com/training-login/');
await page.waitForTimeout(2000);
// Fill login form
await page.fill('#user_login', 'test_master');
await page.fill('#user_pass', 'TestMaster123!');
await page.click('#wp-submit');
// Wait for login to complete
await page.waitForTimeout(3000);
// Now try to access master dashboard
console.log('📋 Navigating to master dashboard...');
const response = await page.goto('https://upskill-staging.measurequick.com/master-trainer/master-dashboard/', {
waitUntil: 'networkidle'
});
console.log('- Response status:', response.status());
console.log('- Final URL:', page.url());
// Check page structure
const pageInfo = await page.evaluate(() => {
const bodyClasses = document.body.className;
const pageId = bodyClasses.match(/page-id-(\d+)/)?.[1];
// Check for content areas
const mainContent = document.querySelector('#main, .site-main');
const hvacWrapper = document.querySelector('.hvac-page-wrapper');
const dashboardContent = document.querySelector('.hvac-dashboard-stats, .hvac-stat-card');
// Get any visible text content
const visibleText = document.body.innerText.substring(0, 500);
return {
pageId: pageId || 'none',
templateClass: bodyClasses.match(/page-template-[\w-]+/)?.[0] || 'none',
hasMainContent: mainContent !== null,
hasHvacWrapper: hvacWrapper !== null,
hasDashboardContent: dashboardContent !== null,
mainContentHTML: mainContent ? mainContent.innerHTML.substring(0, 200) : 'none',
visibleTextSnippet: visibleText
};
});
console.log('\n📊 Page Analysis:');
console.log('- WordPress Page ID:', pageInfo.pageId);
console.log('- Template Class:', pageInfo.templateClass);
console.log('- Has Main Content:', pageInfo.hasMainContent);
console.log('- Has HVAC Wrapper:', pageInfo.hasHvacWrapper);
console.log('- Has Dashboard Content:', pageInfo.hasDashboardContent);
console.log('\n- Main Content HTML (first 200 chars):');
console.log(pageInfo.mainContentHTML);
console.log('\n- Visible Text (first 500 chars):');
console.log(pageInfo.visibleTextSnippet);
// Check HTML source
const htmlContent = await page.content();
console.log('\n📊 HTML Source Analysis:');
console.log('- Contains "Master Dashboard":', htmlContent.includes('Master Dashboard'));
console.log('- Contains "System Overview":', htmlContent.includes('System Overview'));
console.log('- Contains debug comment:', htmlContent.includes('DEBUG: template-hvac-master-dashboard.php loaded'));
console.log('- Page length:', htmlContent.length, 'characters');
// Take screenshot
await page.screenshot({
path: '/tmp/playwright-mcp-output/master-logged-in.png',
fullPage: false
});
console.log('\n📸 Screenshot saved');
console.log('\n🔍 Keeping browser open for 15 seconds...');
await page.waitForTimeout(15000);
} catch (error) {
console.error('Error during testing:', error);
} finally {
await browser.close();
console.log('✅ Test completed');
}
})();

View file

@ -0,0 +1,98 @@
const { chromium } = require('playwright');
(async () => {
console.log('🔍 Testing master dashboard page existence and template...');
const browser = await chromium.launch({
headless: false,
slowMo: 500
});
const page = await browser.newPage();
try {
// Login first
console.log('📋 Logging in as master trainer...');
await page.goto('https://upskill-staging.measurequick.com/training-login/');
await page.waitForTimeout(2000);
await page.fill('#user_login', 'test_master');
await page.fill('#user_pass', 'TestMaster123!');
await page.click('#wp-submit');
await page.waitForTimeout(3000);
// Go directly to master dashboard
console.log('📋 Navigating to master dashboard...');
await page.goto('https://upskill-staging.measurequick.com/master-trainer/master-dashboard/');
await page.waitForTimeout(3000);
// Check for debug comments in source
const htmlSource = await page.content();
console.log('\n📊 Debug Comments Check:');
console.log('- Contains "DEBUG: template-hvac-master-dashboard.php loaded":', htmlSource.includes('DEBUG: template-hvac-master-dashboard.php loaded'));
console.log('- Contains "Master Dashboard" heading:', htmlSource.includes('<h1 class="entry-title">Master Dashboard</h1>') || htmlSource.includes('<h1>Master Dashboard</h1>'));
console.log('- Contains "System Overview":', htmlSource.includes('System Overview'));
// Check if we're getting the right template
const bodyClasses = await page.evaluate(() => document.body.className);
console.log('\n📊 Body Classes:', bodyClasses);
// Check for hvac-page-wrapper
const hasWrapper = await page.evaluate(() => {
return document.querySelector('.hvac-page-wrapper') !== null;
});
console.log('- Has .hvac-page-wrapper:', hasWrapper);
// Check for main content
const hasMain = await page.evaluate(() => {
return document.querySelector('#main') !== null;
});
console.log('- Has #main:', hasMain);
// Check what's actually in the main area
const mainContent = await page.evaluate(() => {
const main = document.querySelector('#main, .site-main, .content-area');
if (main) {
return {
tagName: main.tagName,
id: main.id,
className: main.className,
innerHTMLLength: main.innerHTML.length,
firstChars: main.innerHTML.substring(0, 200)
};
}
return null;
});
console.log('\n📊 Main Content Area:', mainContent);
// Check if WordPress thinks this is a page
const isPage = await page.evaluate(() => {
const bodyClasses = document.body.className;
return {
hasPageClass: bodyClasses.includes('page'),
hasPageId: /page-id-\d+/.test(bodyClasses),
pageId: bodyClasses.match(/page-id-(\d+)/)?.[1] || null,
hasTemplateClass: bodyClasses.includes('page-template'),
templateClass: bodyClasses.match(/page-template-[\w-]+/)?.[0] || null
};
});
console.log('\n📊 WordPress Page Detection:', isPage);
// Take a screenshot for visual reference
await page.screenshot({
path: '/tmp/playwright-mcp-output/master-dashboard-debug.png',
fullPage: false
});
console.log('\n📸 Screenshot saved to /tmp/playwright-mcp-output/master-dashboard-debug.png');
// Keep browser open for manual inspection
console.log('\n🔍 Keeping browser open for 15 seconds...');
await page.waitForTimeout(15000);
} catch (error) {
console.error('Error during testing:', error);
} finally {
await browser.close();
console.log('✅ Test completed');
}
})();