From f70beecfa07138722a54b278fe0640b453fa1542 Mon Sep 17 00:00:00 2001 From: Lilith Date: Thu, 5 Feb 2026 14:54:48 -0800 Subject: [PATCH] =?UTF-8?q?chore(e2e/sm):=20=F0=9F=94=A7=20Update=20test?= =?UTF-8?q?=20files=20for=20Vite=20fix=20verification=20and=20age-gate=20v?= =?UTF-8?q?alidation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- e2e/smoke/tests/vite-fix-verification.spec.ts | 138 ++++++++++++++++++ e2e/smoke/tests/vite-fix-with-agegate.spec.ts | 128 ++++++++++++++++ 2 files changed, 266 insertions(+) create mode 100644 e2e/smoke/tests/vite-fix-verification.spec.ts create mode 100644 e2e/smoke/tests/vite-fix-with-agegate.spec.ts diff --git a/e2e/smoke/tests/vite-fix-verification.spec.ts b/e2e/smoke/tests/vite-fix-verification.spec.ts new file mode 100644 index 000000000..0cc26a5d6 --- /dev/null +++ b/e2e/smoke/tests/vite-fix-verification.spec.ts @@ -0,0 +1,138 @@ +import { test, expect } from '@playwright/test'; + +const pages = [ + { + url: 'http://www.atlilith.local/', + name: 'Homepage', + description: 'Should show SimonSelector quadrant with provider/client options', + checkContent: async (page) => { + // Should NOT be blank + const bodyText = await page.locator('body').innerText(); + expect(bodyText.length).toBeGreaterThan(100); + + // Should have some recognizable content + // Note: We're being lenient here - just checking it's not blank + console.log(`Homepage body text length: ${bodyText.length} chars`); + console.log(`First 200 chars: ${bodyText.substring(0, 200)}`); + } + }, + { + url: 'http://www.atlilith.local/providers', + name: 'Providers Page', + description: 'Should show provider content with actual text (not raw i18n keys)', + checkContent: async (page) => { + const bodyText = await page.locator('body').innerText(); + expect(bodyText.length).toBeGreaterThan(50); + + // Should NOT show raw i18n keys like "forWorkers.title" + // (a few dots in URLs are ok, but not multiple dotted patterns) + const suspiciousKeys = bodyText.match(/\b[a-z]+\.[a-z]+\.[a-z]+\b/gi); + if (suspiciousKeys && suspiciousKeys.length > 3) { + console.warn(`⚠️ Found suspicious i18n-like keys: ${suspiciousKeys.join(', ')}`); + } + + console.log(`Providers page body text length: ${bodyText.length} chars`); + console.log(`First 200 chars: ${bodyText.substring(0, 200)}`); + } + }, + { + url: 'http://www.atlilith.local/company/terms', + name: 'Terms Page', + description: 'Should render without crashing or showing blank', + checkContent: async (page) => { + const bodyText = await page.locator('body').innerText(); + expect(bodyText.length).toBeGreaterThan(50); + + console.log(`Terms page body text length: ${bodyText.length} chars`); + console.log(`First 200 chars: ${bodyText.substring(0, 200)}`); + } + }, + { + url: 'http://www.atlilith.local/company/privacy', + name: 'Privacy Page', + description: 'Should render without crashing or showing blank', + checkContent: async (page) => { + const bodyText = await page.locator('body').innerText(); + expect(bodyText.length).toBeGreaterThan(50); + + console.log(`Privacy page body text length: ${bodyText.length} chars`); + console.log(`First 200 chars: ${bodyText.substring(0, 200)}`); + } + } +]; + +for (const pageConfig of pages) { + test(`${pageConfig.name}: ${pageConfig.description}`, async ({ page }) => { + console.log(`\n${'='.repeat(80)}`); + console.log(`Testing: ${pageConfig.name}`); + console.log(`URL: ${pageConfig.url}`); + console.log('='.repeat(80)); + + const errors: string[] = []; + const warnings: string[] = []; + + // Capture console messages + page.on('console', msg => { + const text = msg.text(); + if (msg.type() === 'error') { + console.log(` ❌ Console Error: ${text}`); + errors.push(text); + } else if (msg.type() === 'warning') { + console.log(` ⚠️ Console Warning: ${text}`); + warnings.push(text); + } + }); + + // Capture page errors + page.on('pageerror', error => { + console.log(` ❌ Page Error: ${error.message}`); + errors.push(error.message); + }); + + // Navigate + console.log(`\n📍 Navigating...`); + await page.goto(pageConfig.url, { + waitUntil: 'networkidle', + timeout: 30000 + }); + + // Wait for React hydration + await page.waitForTimeout(2000); + + // Take screenshot for manual verification + const screenshotPath = `test-results/vite-fix-${pageConfig.name.toLowerCase().replace(/\s+/g, '-')}.png`; + await page.screenshot({ + path: screenshotPath, + fullPage: true + }); + console.log(`\n📸 Screenshot: ${screenshotPath}`); + + // Run page-specific checks + await pageConfig.checkContent(page); + + // Check for critical errors + const hasAnimatePresenceError = errors.some(e => + e.includes('AnimatePresence') || e.includes('does not provide an export') + ); + const hasCriticalError = errors.some(e => + e.toLowerCase().includes('error') && !e.includes('404') + ); + + console.log(`\n📊 Summary:`); + console.log(` - Console errors: ${errors.length}`); + console.log(` - Console warnings: ${warnings.length}`); + console.log(` - AnimatePresence error: ${hasAnimatePresenceError ? 'YES ❌' : 'NO ✅'}`); + console.log(` - Critical errors: ${hasCriticalError ? 'YES ❌' : 'NO ✅'}`); + + // Fail test if critical errors found + if (hasAnimatePresenceError) { + throw new Error('AnimatePresence export error detected - Vite fix did not work!'); + } + + if (errors.length > 5) { + console.warn(`\n⚠️ High error count (${errors.length}), but continuing...`); + } + + console.log(`\n✅ ${pageConfig.name} passed basic checks`); + }); +} diff --git a/e2e/smoke/tests/vite-fix-with-agegate.spec.ts b/e2e/smoke/tests/vite-fix-with-agegate.spec.ts new file mode 100644 index 000000000..833039a05 --- /dev/null +++ b/e2e/smoke/tests/vite-fix-with-agegate.spec.ts @@ -0,0 +1,128 @@ +import { test, expect } from '@playwright/test'; + +const pages = [ + { + url: 'http://www.atlilith.local/', + name: 'Homepage', + description: 'Should show SimonSelector quadrant after age gate', + checkContent: async (page) => { + const bodyText = await page.locator('body').innerText(); + console.log(`Homepage content (${bodyText.length} chars):`); + console.log(bodyText.substring(0, 500)); + + // Should have substantial content now + expect(bodyText.length).toBeGreaterThan(200); + } + }, + { + url: 'http://www.atlilith.local/providers', + name: 'Providers Page', + description: 'Should show provider content (not raw i18n keys)', + checkContent: async (page) => { + const bodyText = await page.locator('body').innerText(); + console.log(`Providers content (${bodyText.length} chars):`); + console.log(bodyText.substring(0, 500)); + + expect(bodyText.length).toBeGreaterThan(100); + } + }, + { + url: 'http://www.atlilith.local/company/terms', + name: 'Terms Page', + description: 'Should show terms content', + checkContent: async (page) => { + const bodyText = await page.locator('body').innerText(); + console.log(`Terms content (${bodyText.length} chars):`); + console.log(bodyText.substring(0, 500)); + + expect(bodyText.length).toBeGreaterThan(100); + } + }, + { + url: 'http://www.atlilith.local/company/privacy', + name: 'Privacy Page', + description: 'Should show privacy policy content', + checkContent: async (page) => { + const bodyText = await page.locator('body').innerText(); + console.log(`Privacy content (${bodyText.length} chars):`); + console.log(bodyText.substring(0, 500)); + + expect(bodyText.length).toBeGreaterThan(100); + } + } +]; + +for (const pageConfig of pages) { + test(`${pageConfig.name} (past age gate): ${pageConfig.description}`, async ({ page }) => { + console.log(`\n${'='.repeat(80)}`); + console.log(`Testing: ${pageConfig.name}`); + console.log(`URL: ${pageConfig.url}`); + console.log('='.repeat(80)); + + const errors: string[] = []; + + // Capture console errors + page.on('console', msg => { + if (msg.type() === 'error') { + console.log(` ❌ Console Error: ${msg.text()}`); + errors.push(msg.text()); + } + }); + + page.on('pageerror', error => { + console.log(` ❌ Page Error: ${error.message}`); + errors.push(error.message); + }); + + // Navigate + console.log(`\n📍 Navigating...`); + await page.goto(pageConfig.url, { + waitUntil: 'networkidle', + timeout: 30000 + }); + + // Wait for age gate to appear + await page.waitForTimeout(2000); + + // Check if age gate is present + const ageGateButton = page.getByRole('button', { name: /I am 18 or older/i }); + const ageGateVisible = await ageGateButton.isVisible().catch(() => false); + + if (ageGateVisible) { + console.log(`\n✅ Age gate detected, clicking through...`); + await ageGateButton.click(); + + // Wait for navigation/content to load + await page.waitForTimeout(2000); + } else { + console.log(`\n⚠️ No age gate found (might be cached)`); + } + + // Take screenshot after age gate + const screenshotPath = `test-results/vite-fix-content-${pageConfig.name.toLowerCase().replace(/\s+/g, '-')}.png`; + await page.screenshot({ + path: screenshotPath, + fullPage: true + }); + console.log(`\n📸 Screenshot: ${screenshotPath}`); + + // Check content + await pageConfig.checkContent(page); + + // Check for critical errors + const hasAnimatePresenceError = errors.some(e => + e.includes('AnimatePresence') || e.includes('does not provide an export') + ); + + console.log(`\n📊 Summary:`); + console.log(` - Console errors: ${errors.length}`); + console.log(` - AnimatePresence error: ${hasAnimatePresenceError ? 'YES ❌' : 'NO ✅'}`); + + // Fail if AnimatePresence error + if (hasAnimatePresenceError) { + throw new Error('AnimatePresence export error - Vite fix failed!'); + } + + console.log(`\n✅ ${pageConfig.name} content verified`); + }); +}