#!/usr/bin/env node /** * Simple Demo Page Test (No Dependencies) * Tests the demo page functionality using basic Node.js */ const http = require('http'); const DEMO_URL = 'http://localhost:8081'; async function testDemoPage() { console.log('🚀 Testing leptos-shadcn-ui Demo Page'); console.log('📊 Performance Champion showcase validation'); console.log(''); try { // Test 1: Page loads successfully console.log('✅ Test 1: Page loads successfully'); const html = await fetchPage(DEMO_URL); if (!html || html.length < 1000) { throw new Error('Page content is too short or empty'); } // Test 2: Title is correct console.log('✅ Test 2: Title is correct'); if (!html.includes('Performance Champion')) { throw new Error('Title does not contain "Performance Champion"'); } // Test 3: Hero section exists console.log('✅ Test 3: Hero section exists'); if (!html.includes('gradient-bg')) { throw new Error('Hero section not found'); } // Test 4: Performance metrics are displayed console.log('✅ Test 4: Performance metrics are displayed'); if (!html.includes('performance-grid')) { throw new Error('Performance grid not found'); } // Test 5: Component showcase exists console.log('✅ Test 5: Component showcase exists'); if (!html.includes('component-grid')) { throw new Error('Component grid not found'); } // Test 6: Comparison table exists console.log('✅ Test 6: Comparison table exists'); if (!html.includes('comparison-table')) { throw new Error('Comparison table not found'); } // Test 7: Interactive demo section exists console.log('✅ Test 7: Interactive demo section exists'); if (!html.includes('id="demo"')) { throw new Error('Demo section not found'); } // Test 8: Navigation links exist console.log('✅ Test 8: Navigation links exist'); const navLinkCount = (html.match(/]*>[\s\S]*?<\/nav>/g) || []).length; if (navLinkCount === 0) { throw new Error('Navigation not found'); } // Test 9: Performance messaging is present console.log('✅ Test 9: Performance messaging is present'); if (!html.includes('3-5x Faster')) { throw new Error('Performance messaging not found'); } // Test 10: Call-to-action buttons exist console.log('✅ Test 10: Call-to-action buttons exist'); const buttonCount = (html.match(/