upskill-event-manager/scripts/verify-page-templates.js
bengizmo 993a820a84 feat: Add comprehensive development artifacts to repository
- Add 26 documentation files including test reports, deployment guides, and troubleshooting documentation
- Include 3 CSV data files for trainer imports and user registration tracking
- Add 43 JavaScript test files covering mobile optimization, Safari compatibility, and E2E testing
- Include 18 PHP utility files for debugging, geocoding, and data analysis
- Add 12 shell scripts for deployment verification, user management, and database operations
- Update .gitignore with whitelist patterns for development files, documentation, and CSV data

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 12:26:11 -03:00

71 lines
No EOL
3 KiB
JavaScript

const { chromium } = require('playwright');
const fs = require('fs');
const path = require('path');
(async () => {
const browser = await chromium.launch();
const context = await browser.newContext();
const page = await context.newPage();
// Create screenshots directory
const screenshotDir = path.join(__dirname, '../screenshots/template-verification');
if (!fs.existsSync(screenshotDir)) {
fs.mkdirSync(screenshotDir, { recursive: true });
}
const baseUrl = 'https://upskill-staging.measurequick.com';
// Test pages to verify
const testPages = [
{ name: 'trainer-dashboard', url: '/trainer/dashboard/', expectedContent: 'Welcome' },
{ name: 'certificate-reports', url: '/trainer/certificate-reports/', expectedContent: 'Certificate Reports' },
{ name: 'generate-certificates', url: '/trainer/generate-certificates/', expectedContent: 'Generate Certificates' },
{ name: 'master-dashboard', url: '/master-trainer/dashboard/', expectedContent: 'Master Dashboard' },
{ name: 'trainer-registration', url: '/trainer/registration/', expectedContent: 'Trainer Registration' }
];
console.log('Starting page template verification...');
for (const testPage of testPages) {
console.log(`\nTesting ${testPage.name}...`);
try {
await page.goto(baseUrl + testPage.url, { waitUntil: 'networkidle' });
// Check if we're redirected to login
const currentUrl = page.url();
if (currentUrl.includes('training-login')) {
console.log(`${testPage.name} - Redirected to login (authentication required)`);
} else {
// Check for expected content
const bodyText = await page.textContent('body');
if (bodyText.includes(testPage.expectedContent)) {
console.log(`${testPage.name} - Content found: "${testPage.expectedContent}"`);
} else {
console.log(`${testPage.name} - Expected content not found`);
}
// Check if page has sidebar (indicates template issue)
const hasSidebar = await page.locator('.widget-area, .sidebar, #secondary').count();
if (hasSidebar > 0) {
console.log(`⚠️ ${testPage.name} - Has sidebar (possible template issue)`);
} else {
console.log(`${testPage.name} - No sidebar (template working)`);
}
}
// Take screenshot
await page.screenshot({
path: path.join(screenshotDir, `${testPage.name}.png`),
fullPage: true
});
} catch (error) {
console.log(`${testPage.name} - Error: ${error.message}`);
}
}
console.log('\nVerification complete. Screenshots saved to:', screenshotDir);
await browser.close();
})();