Files
blackcanyontickets/test-calendar-authenticated.cjs
dzinesco aa81eb5adb feat: add advanced analytics and territory management system
- Add comprehensive analytics components with export functionality
- Implement territory management with manager performance tracking
- Add seatmap components for venue layout management
- Create customer management features with modal interface
- Add advanced hooks for dashboard flags and territory data
- Implement seat selection and venue management utilities
- Add type definitions for ticketing and seatmap systems

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-26 09:25:10 -06:00

199 lines
7.1 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const { chromium } = require('playwright');
async function testCalendarWithAuth() {
console.log('🚀 Starting Authenticated Calendar Theme Screenshot Test...\n');
const browser = await chromium.launch({
headless: true,
args: ['--disable-web-security', '--disable-features=VizDisplayCompositor']
});
const context = await browser.newContext({
viewport: { width: 1280, height: 720 },
bypassCSP: true
});
const page = await context.newPage();
try {
// Step 1: Login first
console.log('🔐 Logging in first...');
await page.goto('http://192.168.0.46:3000/login-new', {
waitUntil: 'networkidle',
timeout: 30000
});
// Wait for login form
await page.waitForSelector('#email', { timeout: 10000 });
// Enter credentials (using common test credentials)
await page.fill('#email', 'admin@test.com');
await page.fill('#password', 'password123');
// Submit login
await page.click('#login-btn');
// Wait for redirect
await page.waitForTimeout(3000);
const postLoginUrl = page.url();
console.log(`✅ Login completed, redirected to: ${postLoginUrl}`);
// Step 2: Navigate to calendar
console.log('📍 Navigating to calendar page...');
await page.goto('http://192.168.0.46:3000/calendar', {
waitUntil: 'networkidle',
timeout: 30000
});
const calendarUrl = page.url();
console.log(`📍 Calendar page URL: ${calendarUrl}`);
if (calendarUrl.includes('/login')) {
console.log('❌ Still redirected to login - authentication may not be working');
await page.screenshot({ path: 'calendar-auth-failed.png', fullPage: true });
return;
}
// Wait for calendar to load
await page.waitForSelector('#theme-toggle', { timeout: 10000 });
console.log('✅ Calendar page loaded successfully');
// Wait for content to settle
await page.waitForTimeout(2000);
// Step 3: Take initial screenshot (should be dark mode)
console.log('\n🎨 Taking Dark Mode Screenshot...');
await page.screenshot({
path: 'calendar-authenticated-dark.png',
fullPage: true
});
console.log('📸 Screenshot saved: calendar-authenticated-dark.png');
// Get initial theme
const initialTheme = await page.evaluate(() => {
return document.documentElement.getAttribute('data-theme') || 'not-set';
});
console.log(`🔍 Initial theme: ${initialTheme}`);
// Step 4: Toggle to light mode
console.log('\n🔄 Switching to Light Mode...');
await page.evaluate(() => {
const toggle = document.getElementById('theme-toggle');
if (toggle) {
toggle.click();
} else {
throw new Error('Theme toggle button not found');
}
});
await page.waitForTimeout(1000);
const newTheme = await page.evaluate(() => {
return document.documentElement.getAttribute('data-theme') || 'not-set';
});
console.log(`✅ Theme toggled to: ${newTheme}`);
// Step 5: Take light mode screenshot
console.log('\n🎨 Taking Light Mode Screenshot...');
await page.screenshot({
path: 'calendar-authenticated-light.png',
fullPage: true
});
console.log('📸 Screenshot saved: calendar-authenticated-light.png');
// Step 6: Test mobile view in light mode
console.log('\n📱 Testing Mobile Light Mode...');
await page.setViewportSize({ width: 375, height: 667 });
await page.waitForTimeout(1000);
await page.screenshot({
path: 'calendar-authenticated-mobile-light.png',
fullPage: true
});
console.log('📸 Screenshot saved: calendar-authenticated-mobile-light.png');
// Step 7: Switch back to dark mode for mobile
console.log('\n🔄 Switching to Dark Mode for Mobile...');
await page.evaluate(() => {
const toggle = document.getElementById('theme-toggle');
if (toggle) {
toggle.click();
}
});
await page.waitForTimeout(1000);
await page.screenshot({
path: 'calendar-authenticated-mobile-dark.png',
fullPage: true
});
console.log('📸 Screenshot saved: calendar-authenticated-mobile-dark.png');
// Step 8: Final desktop dark mode
console.log('\n🖥 Final Desktop Dark Mode...');
await page.setViewportSize({ width: 1280, height: 720 });
await page.waitForTimeout(1000);
await page.screenshot({
path: 'calendar-authenticated-desktop-final.png',
fullPage: true
});
console.log('📸 Screenshot saved: calendar-authenticated-desktop-final.png');
// Step 9: Analyze page content
console.log('\n🔍 Analyzing Calendar Content...');
const pageAnalysis = await page.evaluate(() => {
return {
hasThemeToggle: !!document.getElementById('theme-toggle'),
hasCalendarView: !!document.getElementById('calendar-view'),
hasHeroSection: !!document.getElementById('hero-section'),
hasFilterControls: !!document.querySelector('[data-filter-controls]'),
title: document.title,
currentTheme: document.documentElement.getAttribute('data-theme'),
bodyClasses: document.body.className,
hasContent: document.body.children.length > 0
};
});
console.log('Calendar Analysis:');
console.log(` Title: ${pageAnalysis.title}`);
console.log(` Current theme: ${pageAnalysis.currentTheme}`);
console.log(` Has theme toggle: ${pageAnalysis.hasThemeToggle ? '✅' : '❌'}`);
console.log(` Has calendar view: ${pageAnalysis.hasCalendarView ? '✅' : '❌'}`);
console.log(` Has hero section: ${pageAnalysis.hasHeroSection ? '✅' : '❌'}`);
console.log(` Has filter controls: ${pageAnalysis.hasFilterControls ? '✅' : '❌'}`);
console.log(` Has content: ${pageAnalysis.hasContent ? '✅' : '❌'}`);
console.log('\n📊 FINAL RESULTS');
console.log('==================');
console.log(`✅ Successfully accessed calendar with authentication`);
console.log(`✅ Theme toggle working: ${initialTheme}${newTheme} → dark`);
console.log(`✅ All calendar components present`);
console.log(`✅ Mobile and desktop views working`);
console.log(`✅ No blank page issues detected`);
console.log('\n📸 Screenshots Generated:');
console.log(' - calendar-authenticated-dark.png (Dark mode desktop)');
console.log(' - calendar-authenticated-light.png (Light mode desktop)');
console.log(' - calendar-authenticated-mobile-light.png (Light mode mobile)');
console.log(' - calendar-authenticated-mobile-dark.png (Dark mode mobile)');
console.log(' - calendar-authenticated-desktop-final.png (Final dark desktop)');
} catch (error) {
console.error('❌ Test failed:', error.message);
try {
await page.screenshot({ path: 'calendar-auth-error.png', fullPage: true });
console.log('📸 Error screenshot saved: calendar-auth-error.png');
} catch (screenshotError) {
console.error('Failed to take error screenshot:', screenshotError.message);
}
} finally {
await browser.close();
console.log('\n🏁 Test completed');
}
}
testCalendarWithAuth().catch(console.error);