upskill-event-manager/test-certificate-pages.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

81 lines
No EOL
3.4 KiB
JavaScript

const { chromium } = require('playwright');
async function testCertificatePages() {
const browser = await chromium.launch({ headless: false });
const page = await browser.newContext().then(ctx => ctx.newPage());
console.log('=== Testing Certificate Pages ===\n');
// Login
console.log('1. Logging in...');
await page.goto('https://upskill-staging.measurequick.com/training-login/');
await page.fill('#user_login', 'JoeMedosch@gmail.com');
await page.fill('#user_pass', 'JoeTrainer2025@');
await page.locator('input[type="submit"], #wp-submit').first().click();
await page.waitForLoadState('networkidle');
await page.waitForTimeout(2000);
// Check if logged in
const loggedInUrl = page.url();
console.log('After login URL:', loggedInUrl);
// Test Certificate Reports
console.log('\n2. Testing Certificate Reports...');
await page.goto('https://upskill-staging.measurequick.com/trainer/certificate-reports/');
await page.waitForLoadState('networkidle');
const reportsContent = await page.evaluate(() => {
return {
url: window.location.href,
title: document.title,
h1: document.querySelector('h1')?.textContent?.trim(),
h2: document.querySelector('h2')?.textContent?.trim(),
hasTable: !!document.querySelector('.hvac-certificate-table'),
tableRows: document.querySelectorAll('.hvac-certificate-table tbody tr').length,
errorMessage: document.querySelector('.error')?.textContent?.trim()
};
});
console.log('Certificate Reports Page:');
console.log(' URL:', reportsContent.url);
console.log(' Title:', reportsContent.title);
console.log(' H1:', reportsContent.h1);
console.log(' H2:', reportsContent.h2);
console.log(' Has Table:', reportsContent.hasTable);
console.log(' Number of Events:', reportsContent.tableRows);
console.log(' Error:', reportsContent.errorMessage || 'None');
await page.screenshot({ path: 'certificate-reports-test.png', fullPage: true });
// Test Generate Certificates
console.log('\n3. Testing Generate Certificates...');
await page.goto('https://upskill-staging.measurequick.com/trainer/generate-certificates/');
await page.waitForLoadState('networkidle');
const generateContent = await page.evaluate(() => {
return {
url: window.location.href,
title: document.title,
h1: document.querySelector('h1')?.textContent?.trim(),
h2: document.querySelector('h2')?.textContent?.trim(),
hasForm: !!document.querySelector('.hvac-certificate-form'),
hasEventSelect: !!document.querySelector('#event_select'),
errorMessage: document.querySelector('.error')?.textContent?.trim()
};
});
console.log('Generate Certificates Page:');
console.log(' URL:', generateContent.url);
console.log(' Title:', generateContent.title);
console.log(' H1:', generateContent.h1);
console.log(' H2:', generateContent.h2);
console.log(' Has Form:', generateContent.hasForm);
console.log(' Has Event Select:', generateContent.hasEventSelect);
console.log(' Error:', generateContent.errorMessage || 'None');
await page.screenshot({ path: 'generate-certificates-test.png', fullPage: true });
await browser.close();
}
testCertificatePages().catch(console.error);