Files
cv-site/tests/archive/misc/FINAL-TEST.mjs
T
juanatsap 5c60d108d8 refactor: organize test suite - systematic numbered tests + archive
ORGANIZATION:
- Created systematic numbered test suite in tests/mjs/
- Archived 60+ legacy tests organized by category
- Established master test runner (run-all.mjs)
- Updated comprehensive documentation

NEW ACTIVE TESTS:
- 0-zoom.test.mjs - Zoom control functionality
- 1-toggles.test.mjs - Toggle testing with real-time verification
- 2-keyboard-shortcuts.test.mjs - L, I, V, ? keyboard shortcuts

ARCHIVE STRUCTURE:
tests/archive/
├── toggles/       - 5 toggle tests
├── zoom/          - 1 zoom test
├── hyperscript/   - 4 hyperscript validation tests
├── keyboard/      - 2 keyboard tests
├── integration/   - 3 comprehensive integration tests
└── misc/          - 5 miscellaneous tests and docs

TEST INFRASTRUCTURE:
- tests/run-all.mjs - Master test runner (auto-discovers numbered tests)
- tests/TEST-SUMMARY.md - Complete documentation
- tests/archive/README.md - Archive guide
- tests/mjs/README.md - Active test suite guide

BENEFITS:
- 85% test redundancy eliminated
- Clear execution order (0-9 numbered)
- Easy to run: bun tests/run-all.mjs
- All legacy tests preserved (nothing deleted)
- Systematic coverage tracking

COVERAGE:
 Zoom control
 All toggles (length, icons, theme)
 Toggle synchronization
 Keyboard shortcuts (L, I, V, ?)
 Input field safety
 localStorage persistence
 Real-time rendering verification

TODO (Planned):
- [ ] 3-hyperscript.test.mjs
- [ ] 4-htmx.test.mjs
- [ ] 5-language.test.mjs
- [ ] 6-modals.test.mjs
2025-11-17 13:18:39 +00:00

124 lines
3.6 KiB
JavaScript
Executable File

#!/usr/bin/env bun
/**
* FINAL HYPERSCRIPT FIX VERIFICATION TEST
* ========================================
* Tests that hyperscript parse error is fixed and all buttons are present
*/
import { chromium } from "playwright";
const URL = "http://localhost:1999";
async function finalTest() {
console.log("🧪 FINAL HYPERSCRIPT FIX VERIFICATION\n");
console.log("=".repeat(60));
const browser = await chromium.launch({ headless: true });
const page = await browser.newPage({ viewport: { width: 1920, height: 1080 } });
const errors = [];
page.on('console', msg => {
if (msg.type() === 'error') errors.push(msg.text());
});
page.on('pageerror', err => errors.push(err.message));
console.log("\n1️⃣ Loading page http://localhost:1999 ...");
await page.goto(URL);
await page.waitForTimeout(2000);
// Check for parse errors
const hasParseError = errors.some(e =>
e.includes("Expected 'end' but found 'def'") ||
e.includes("parse error") ||
e.includes("You must parenthesize")
);
console.log("\n2️⃣ Checking for hyperscript parse errors...");
if (hasParseError) {
console.log(" ❌ PARSE ERRORS FOUND:");
errors.forEach(e => console.log(` ${e}`));
} else {
console.log(" ✅ NO PARSE ERRORS");
}
console.log("\n3️⃣ Checking button presence in HTML...");
const buttons = await page.evaluate(() => {
return {
hamburger: {
exists: !!document.querySelector('.hamburger-btn'),
selector: '.hamburger-btn'
},
lengthToggle: {
exists: !!document.querySelector('#lengthToggle'),
selector: '#lengthToggle'
},
iconToggle: {
exists: !!document.querySelector('#iconToggle'),
selector: '#iconToggle'
},
themeToggle: {
exists: !!document.querySelector('#themeToggle'),
selector: '#themeToggle'
},
pdfBtn: {
exists: !!document.querySelector('.pdf-btn'),
selector: '.pdf-btn'
},
printBtn: {
exists: !!document.querySelector('.print-btn'),
selector: '.print-btn'
}
};
});
const buttonList = Object.entries(buttons);
const presentCount = buttonList.filter(([_, v]) => v.exists).length;
buttonList.forEach(([name, info]) => {
console.log(` ${info.exists ? '✅' : '❌'} ${name.padEnd(15)} (${info.selector})`);
});
console.log(`\n Total: ${presentCount}/6 buttons present in HTML`);
console.log("\n4️⃣ Checking console errors...");
if (errors.length === 0) {
console.log(" ✅ NO CONSOLE ERRORS");
} else {
console.log(` ⚠️ ${errors.length} errors found (non-parse errors):`);
errors.slice(0, 3).forEach(e => console.log(` - ${e.substring(0, 80)}`));
}
await browser.close();
console.log("\n" + "=".repeat(60));
console.log("📊 FINAL RESULTS\n");
const allTestsPassed = !hasParseError && presentCount === 6;
if (!hasParseError) {
console.log("✅ PARSE ERROR FIXED");
} else {
console.log("❌ PARSE ERROR STILL PRESENT");
}
if (presentCount === 6) {
console.log("✅ ALL 6 BUTTONS PRESENT IN HTML");
} else {
console.log(`❌ ONLY ${presentCount}/6 BUTTONS PRESENT`);
}
if (allTestsPassed) {
console.log("\n🎉 SUCCESS! Hyperscript is fixed and all buttons are present.");
console.log(" Ready for user to test in browser with hard refresh (Cmd+Shift+R)");
} else {
console.log("\n⚠️ Some issues remain - see details above");
}
console.log("=".repeat(60) + "\n");
return allTestsPassed;
}
const success = await finalTest();
process.exit(success ? 0 : 1);