- Removed PHP 7.4+ type declarations (private int, return types) that were causing fatal errors - Fixed constructor parameter and property declarations for older PHP versions - Created minimal dashboard data class as emergency fallback - Root cause: Server running older PHP version incompatible with modern type declarations 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
89 lines
No EOL
4.3 KiB
TypeScript
89 lines
No EOL
4.3 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
test('Simple Error Check - All Pages', async ({ page }) => {
|
|
console.log('=== Simple Error Check ===');
|
|
|
|
const pages = [
|
|
{ url: 'https://upskill-staging.measurequick.com/', name: 'Homepage' },
|
|
{ url: 'https://upskill-staging.measurequick.com/community-login/', name: 'Community Login' },
|
|
{ url: 'https://upskill-staging.measurequick.com/hvac-dashboard/', name: 'HVAC Dashboard' },
|
|
{ url: 'https://upskill-staging.measurequick.com/certificate-reports/', name: 'Certificate Reports' },
|
|
{ url: 'https://upskill-staging.measurequick.com/generate-certificates/', name: 'Generate Certificates' },
|
|
{ url: 'https://upskill-staging.measurequick.com/trainer-profile/', name: 'Trainer Profile' },
|
|
{ url: 'https://upskill-staging.measurequick.com/wp-admin/', name: 'WP Admin' }
|
|
];
|
|
|
|
for (const pageInfo of pages) {
|
|
console.log(`\nChecking: ${pageInfo.name}`);
|
|
|
|
try {
|
|
await page.goto(pageInfo.url, { waitUntil: 'load', timeout: 15000 });
|
|
await page.waitForLoadState('domcontentloaded');
|
|
|
|
// Get the page content
|
|
const content = await page.content();
|
|
const bodyText = await page.locator('body').textContent() || '';
|
|
|
|
console.log(` URL: ${page.url()}`);
|
|
console.log(` Title: ${await page.title()}`);
|
|
|
|
// Check for various error indicators
|
|
const errorChecks = {
|
|
'Critical Error': bodyText.includes('There has been a critical error'),
|
|
'Fatal Error': bodyText.includes('Fatal error'),
|
|
'Parse Error': bodyText.includes('Parse error'),
|
|
'Call Stack': bodyText.includes('Call Stack'),
|
|
'PHP Error': content.includes('PHP Fatal error') || content.includes('PHP Parse error'),
|
|
'WordPress Error': content.includes('wp-die') || content.includes('WordPress has experienced an error'),
|
|
'Plugin Error': bodyText.includes('Plugin could not be activated') || bodyText.includes('Plugin file does not exist'),
|
|
'Database Error': bodyText.includes('Error establishing a database connection'),
|
|
'Memory Error': bodyText.includes('Fatal error: Allowed memory size'),
|
|
'Syntax Error': bodyText.includes('syntax error') || bodyText.includes('unexpected')
|
|
};
|
|
|
|
let hasAnyError = false;
|
|
for (const [errorType, hasError] of Object.entries(errorChecks)) {
|
|
if (hasError) {
|
|
console.log(` ❌ ${errorType} detected`);
|
|
hasAnyError = true;
|
|
}
|
|
}
|
|
|
|
if (!hasAnyError) {
|
|
console.log(` ✅ No errors detected`);
|
|
} else {
|
|
// Get error details
|
|
const errorLines = bodyText.split('\n')
|
|
.filter(line => line.includes('error') || line.includes('Error') || line.includes('Fatal') || line.includes('.php'))
|
|
.slice(0, 10);
|
|
|
|
if (errorLines.length > 0) {
|
|
console.log(' Error details:');
|
|
errorLines.forEach((line, i) => {
|
|
if (line.trim()) console.log(` ${i + 1}: ${line.trim()}`);
|
|
});
|
|
}
|
|
|
|
await page.screenshot({
|
|
path: `error-${pageInfo.name.replace(/[^a-zA-Z0-9]/g, '-').toLowerCase()}.png`,
|
|
fullPage: true
|
|
});
|
|
}
|
|
|
|
// Check response status
|
|
const response = await page.goto(pageInfo.url, { waitUntil: 'load' });
|
|
if (response?.status() !== 200) {
|
|
console.log(` ⚠️ HTTP Status: ${response?.status()}`);
|
|
}
|
|
|
|
} catch (error) {
|
|
console.log(` ❌ Exception: ${error}`);
|
|
await page.screenshot({
|
|
path: `exception-${pageInfo.name.replace(/[^a-zA-Z0-9]/g, '-').toLowerCase()}.png`
|
|
});
|
|
}
|
|
}
|
|
|
|
console.log('\n=== Error Check Complete ===');
|
|
console.log('If critical errors exist, screenshots have been saved to the test directory.');
|
|
}); |