Files
cv-site/tests/archive/toggles/test-sync-quick.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

40 lines
1.2 KiB
JavaScript
Executable File

#!/usr/bin/env node
import { chromium } from 'playwright';
(async () => {
const browser = await chromium.launch({ headless: true });
const page = await browser.newPage();
await page.goto(`http://localhost:1999/?lang=en&_=${Date.now()}`);
await page.waitForTimeout(1000);
// Test synchronization programmatically
const result = await page.evaluate(() => {
const desktopToggle = document.querySelector('#lengthToggle');
const menuToggle = document.querySelector('#lengthToggleMenu');
const initialDesktop = desktopToggle.checked;
// Simulate clicking desktop toggle
toggleCVLength(!initialDesktop);
// Check if menu synced
const menuAfterToggle = menuToggle.checked;
return {
initialDesktop,
menuAfterToggle,
synced: menuAfterToggle === !initialDesktop
};
});
console.log('\nToggle Sync Test:');
console.log('Initial desktop state:', result.initialDesktop);
console.log('After toggling desktop to:', !result.initialDesktop);
console.log('Menu checkbox state:', result.menuAfterToggle);
console.log('Sync status:', result.synced ? '✅ SYNCED' : '❌ NOT SYNCED');
await browser.close();
process.exit(result.synced ? 0 : 1);
})();