chore(e2e/sm): 🔧 Update test files for Vite fix verification and age-gate validation
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
3afe506cad
commit
f70beecfa0
2 changed files with 266 additions and 0 deletions
138
e2e/smoke/tests/vite-fix-verification.spec.ts
Normal file
138
e2e/smoke/tests/vite-fix-verification.spec.ts
Normal file
|
|
@ -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`);
|
||||
});
|
||||
}
|
||||
128
e2e/smoke/tests/vite-fix-with-agegate.spec.ts
Normal file
128
e2e/smoke/tests/vite-fix-with-agegate.spec.ts
Normal file
|
|
@ -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`);
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue