#!/usr/bin/env bun import { chromium } from 'playwright'; (async () => { const browser = await chromium.launch({ headless: false }); const page = await browser.newPage({ viewport: { width: 1920, height: 1080 } }); console.log('šŸ” Testing theme button visibility on DESKTOP...\n'); await page.goto('http://localhost:1999/'); await page.waitForLoadState('networkidle'); await page.waitForTimeout(1000); // Check theme button const themeButton = page.locator('#color-theme-switcher'); const exists = await themeButton.count() > 0; console.log(exists ? 'āœ… Theme button exists in DOM' : 'āŒ Theme button NOT in DOM'); if (exists) { const isVisible = await themeButton.isVisible(); console.log(isVisible ? 'āœ… Theme button is VISIBLE' : 'āŒ Theme button is NOT visible'); const box = await themeButton.boundingBox(); console.log('\nšŸ“¦ Bounding box:', box); // Check if Y position is positive (on screen) if (box && box.y > 0) { console.log('āœ… Button is ON SCREEN (y > 0)'); } else if (box && box.y < 0) { console.log('āŒ Button is ABOVE SCREEN (y < 0) - STILL BROKEN'); } // Get computed position const position = await page.evaluate(() => { const btn = document.getElementById('color-theme-switcher'); const computed = window.getComputedStyle(btn); return { position: computed.position, bottom: computed.bottom, left: computed.left, top: computed.top }; }); console.log('\nšŸŽØ Computed position:', position); if (position.position === 'fixed') { console.log('āœ… Position is FIXED (correct!)'); } else { console.log(`āŒ Position is ${position.position} (should be fixed)`); } // Take screenshot await page.screenshot({ path: '/Users/txeo/Git/yo/cv/tests/mjs/screenshots/theme-button-fixed.png', fullPage: false }); console.log('\nšŸ“ø Screenshot saved to screenshots/theme-button-fixed.png'); // Test tooltip console.log('\nšŸŽÆ Testing tooltip...'); await themeButton.hover(); await page.waitForTimeout(500); const tooltipVisible = await page.evaluate(() => { const btn = document.getElementById('color-theme-switcher'); const computed = window.getComputedStyle(btn, '::before'); return { opacity: computed.opacity, visibility: computed.visibility, content: computed.content }; }); console.log('šŸ’¬ Tooltip state:', tooltipVisible); if (parseFloat(tooltipVisible.opacity) > 0.5) { console.log('āœ… Tooltip is VISIBLE on hover'); } else { console.log('āš ļø Tooltip opacity is low or hidden'); } } console.log('\nāœ… Test complete - browser will close in 5 seconds'); await page.waitForTimeout(5000); await browser.close(); })();