@casoon/auditmysite
Version:
Professional website analysis suite with robust accessibility testing, Core Web Vitals performance monitoring, SEO analysis, and content optimization insights. Features isolated browser contexts, retry mechanisms, and comprehensive API endpoints for profe
102 lines (85 loc) โข 4.43 kB
JavaScript
/**
* ๐งช Test New Analyzers - Direct test of Security Headers and Structured Data
*/
const { AccessibilityChecker } = require('./dist/core/accessibility');
async function testNewAnalyzers() {
console.log('๐งช Testing new Security Headers and Structured Data analyzers...\n');
const checker = new AccessibilityChecker({
enableComprehensiveAnalysis: true,
qualityAnalysisOptions: {
verbose: true,
includeResourceAnalysis: true,
includeTechnicalSEO: true,
includeSocialAnalysis: true,
analysisTimeout: 30000
}
});
await checker.initialize();
console.log('โ
AccessibilityChecker initialized with comprehensive analysis\n');
// Test URLs that should have different security headers and structured data
const testUrls = [
'https://example.com',
'https://httpbin.org/html'
];
for (const url of testUrls) {
try {
console.log(`๐ Testing: ${url}`);
console.log('โ'.repeat(60));
const result = await checker.testPage(url, {
verbose: true,
collectPerformanceMetrics: true,
captureScreenshots: false, // Disable screenshots for faster testing
timeout: 20000
});
console.log(`๐ Results for ${url}:`);
console.log(` Title: ${result.title}`);
console.log(` Passed: ${result.passed ? 'โ
' : 'โ'}`);
console.log(` Duration: ${result.duration}ms`);
console.log(` Errors: ${result.errors?.length || 0}`);
console.log(` Warnings: ${result.warnings?.length || 0}`);
// Check if new analyzers ran
const hasSecurityHeaders = result.securityHeaders;
const hasStructuredData = result.structuredData;
const hasPerformance = result.enhancedPerformance;
const hasSEO = result.enhancedSEO;
const hasContentWeight = result.contentWeight;
const hasMobileFriendliness = result.mobileFriendliness;
console.log(`\n๐ Analysis Results:`);
console.log(` ๐ Security Headers: ${hasSecurityHeaders ? 'โ
Present' : 'โ Missing'}`);
console.log(` ๐ Structured Data: ${hasStructuredData ? 'โ
Present' : 'โ Missing'}`);
console.log(` โก Performance: ${hasPerformance ? 'โ
Present' : 'โ Missing'}`);
console.log(` ๐ SEO: ${hasSEO ? 'โ
Present' : 'โ Missing'}`);
console.log(` ๐ Content Weight: ${hasContentWeight ? 'โ
Present' : 'โ Missing'}`);
console.log(` ๐ฑ Mobile Friendliness: ${hasMobileFriendliness ? 'โ
Present' : 'โ Missing'}`);
// Show detailed results for new analyzers if available
if (hasSecurityHeaders) {
console.log(`\n๐ Security Headers Details:`);
console.log(` Overall Score: ${hasSecurityHeaders.overallScore}/100 (${hasSecurityHeaders.grade})`);
console.log(` HTTPS Enabled: ${hasSecurityHeaders.https?.enabled ? 'โ
' : 'โ'}`);
console.log(` CSP Present: ${hasSecurityHeaders.headers?.csp?.present ? 'โ
' : 'โ'}`);
console.log(` HSTS Present: ${hasSecurityHeaders.headers?.hsts?.present ? 'โ
' : 'โ'}`);
console.log(` X-Frame-Options: ${hasSecurityHeaders.headers?.xFrameOptions?.present ? 'โ
' : 'โ'}`);
console.log(` Vulnerabilities: ${JSON.stringify(hasSecurityHeaders.vulnerabilities, null, 2)}`);
}
if (hasStructuredData) {
console.log(`\n๐ Structured Data Details:`);
console.log(` Overall Score: ${hasStructuredData.overallScore}/100 (${hasStructuredData.grade})`);
console.log(` Total Items: ${hasStructuredData.summary?.totalItems || 0}`);
console.log(` Valid Items: ${hasStructuredData.summary?.validItems || 0}`);
console.log(` JSON-LD Count: ${hasStructuredData.summary?.jsonLdCount || 0}`);
console.log(` Rich Snippets Eligible: ${hasStructuredData.richSnippets?.eligible ? 'โ
' : 'โ'}`);
console.log(` Knowledge Graph Score: ${hasStructuredData.knowledgeGraph?.readinessScore || 0}/100`);
}
} catch (error) {
console.error(`โ Failed to test ${url}: ${error.message}`);
}
console.log('\n' + '='.repeat(80) + '\n');
}
await checker.cleanup();
console.log('โ
Test completed - all resources cleaned up');
}
testNewAnalyzers().catch(error => {
console.error('โ Test failed:', error);
process.exit(1);
});