upskill-event-manager/test-navigation-headed.js
Ben 4367f6a395 feat: implement professional navigation with smooth dropdowns and best practices
- Created hvac-navigation-enhanced.css with modern dropdown styles
  - Pure CSS hover dropdowns for desktop (no JS needed)
  - Smooth animations with 300ms transitions
  - Professional hover effects with bottom border animation
  - Proper z-index layering (z-index: 9999 for dropdowns)
  - Keyboard navigation support

- Added hvac-navigation-enhanced.js for enhanced UX
  - Mobile hamburger menu with smooth animations
  - Keyboard navigation (arrow keys, escape, enter)
  - Click outside to close
  - Accessibility improvements with ARIA attributes
  - Smooth scroll for anchor links

- Fixed menu toggle visibility issue
  - Removed conflicting Astra theme buttons
  - Using pure CSS :hover for desktop dropdowns
  - Better mobile responsive behavior

- Updated class-hvac-scripts-styles.php
  - Added new CSS and JS files to build pipeline
  - Proper dependency management

Best practices implemented:
- WCAG 2.1 AA compliant keyboard navigation
- Focus management for accessibility
- Smooth 300ms transitions for professional feel
- Mobile-first responsive design
- No JavaScript required for desktop dropdowns
2025-08-20 23:10:53 -03:00

96 lines
3.4 KiB
JavaScript

const { chromium } = require('playwright');
(async () => {
console.log('🔍 Testing HVAC Navigation Menu - Headed Browser');
console.log('==============================================\n');
const browser = await chromium.launch({
headless: false,
slowMo: 500 // Slow down actions to see what's happening
});
const page = await browser.newPage();
try {
// Navigate to dashboard
console.log('1. Navigating to dashboard...');
await page.goto('https://upskill-staging.measurequick.com/trainer/dashboard/');
await page.waitForTimeout(2000);
// Take initial screenshot
await page.screenshot({ path: 'nav-initial.png' });
console.log(' ✅ Dashboard loaded\n');
// Click hamburger menu
console.log('2. Clicking hamburger menu...');
const hamburger = await page.locator('button:has-text("Toggle menu")');
await hamburger.click();
await page.waitForTimeout(1000);
await page.screenshot({ path: 'nav-menu-open.png' });
console.log(' ✅ Menu opened\n');
// Click Events dropdown
console.log('3. Clicking Events dropdown...');
const eventsMenu = await page.locator('text=Events').first();
await eventsMenu.click();
await page.waitForTimeout(1000);
await page.screenshot({ path: 'nav-events-dropdown.png' });
// Check if submenu items are visible
const dashboardLink = await page.locator('a:has-text("Dashboard")').isVisible();
const newEventLink = await page.locator('a:has-text("New Event")').isVisible();
if (dashboardLink && newEventLink) {
console.log(' ✅ Events submenu items visible');
} else {
console.log(' ❌ Events submenu items NOT visible');
}
console.log('');
// Click Certificates dropdown
console.log('4. Clicking Certificates dropdown...');
const certsMenu = await page.locator('text=Certificates').first();
await certsMenu.click();
await page.waitForTimeout(1000);
await page.screenshot({ path: 'nav-certs-dropdown.png' });
// Check if submenu items are visible
const reportsLink = await page.locator('a:has-text("Reports")').isVisible();
const newCertLink = await page.locator('a:has-text("New Certificate")').isVisible();
if (reportsLink && newCertLink) {
console.log(' ✅ Certificates submenu items visible');
} else {
console.log(' ❌ Certificates submenu items NOT visible');
}
console.log('');
// Click Profile dropdown
console.log('5. Clicking Profile dropdown...');
const profileMenu = await page.locator('text=Profile').first();
await profileMenu.click();
await page.waitForTimeout(1000);
await page.screenshot({ path: 'nav-profile-dropdown.png' });
// Check if submenu items are visible
const profileLink = await page.locator('a:has-text("Trainer Profile")').isVisible();
if (profileLink) {
console.log(' ✅ Profile submenu items visible');
} else {
console.log(' ❌ Profile submenu items NOT visible');
}
console.log('\n==============================================');
console.log('Navigation test complete!');
console.log('Check the screenshot files for visual confirmation.');
// Keep browser open for 5 seconds to observe
await page.waitForTimeout(5000);
} catch (error) {
console.error('❌ Error during test:', error.message);
} finally {
await browser.close();
}
})();