refactor: Modularize CSS and fix theme-aware text colors
CSS Restructuring: - Reorganize monolithic main.css into modular architecture - Create foundation/ (reset, variables, typography, themes) - Create layout/ (container, page, grid, paper) - Create components/ (8 component files) - Create interactive/ (toggles, remaining for future split) - Create effects/ (skeleton loading) - Create contexts/ (print styles) Theme Support Fixes: - Replace all hardcoded text colors with CSS variables - Fix .section-title: rgb(51,51,51) → var(--text-primary) - Fix .cv-name, .intro-text: hardcoded → theme-aware - Fix .experience-period, .duration-text: #555/#aaa → variables - Fix course/project/experience text colors - Support proper light/dark theme text contrast Icon & Layout Fixes: - Standardize all icon sizes to 80×80px - Change all icon backgrounds to transparent - Fix award section layout (missing flexbox) - Update HTML templates (experience.html, awards.html) to width='80' - Fix default icon sizing conflicts View Switcher Fix: - Fix toggleTheme() to target .cv-container instead of body - Ensures clean/default theme toggle works correctly Files: 40+ CSS files modularized, 3 templates updated, 7 tests added
This commit is contained in:
Executable
+214
@@ -0,0 +1,214 @@
|
||||
#!/usr/bin/env bun
|
||||
/**
|
||||
* ICON TOGGLE DEBUG TEST
|
||||
* =======================
|
||||
* Specifically tests icon toggle functionality
|
||||
* to verify icons hide when toggle is OFF
|
||||
*/
|
||||
|
||||
import { chromium } from "playwright";
|
||||
|
||||
const URL = "http://localhost:1999";
|
||||
|
||||
async function testIconToggle() {
|
||||
console.log("🧪 ICON TOGGLE DEBUG TEST\n");
|
||||
console.log("=".repeat(70));
|
||||
|
||||
const browser = await chromium.launch({ headless: false });
|
||||
const page = await browser.newPage({ viewport: { width: 1400, height: 1080 } });
|
||||
|
||||
await page.goto(URL);
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
console.log("\n1️⃣ Initial State:");
|
||||
const initial = await page.evaluate(() => {
|
||||
const paper = document.querySelector('.cv-paper');
|
||||
const logo = document.querySelector('.company-logo');
|
||||
const logoStyle = logo ? window.getComputedStyle(logo) : null;
|
||||
|
||||
return {
|
||||
paperClasses: paper?.className,
|
||||
hasShowIcons: paper?.classList.contains('show-icons'),
|
||||
logoExists: !!logo,
|
||||
logoDisplay: logoStyle?.display,
|
||||
logoOpacity: logoStyle?.opacity,
|
||||
logoWidth: logoStyle?.width,
|
||||
localStorage: localStorage.getItem('cv-icons')
|
||||
};
|
||||
});
|
||||
|
||||
console.log(` Paper classes: ${initial.paperClasses}`);
|
||||
console.log(` Has show-icons class: ${initial.hasShowIcons}`);
|
||||
console.log(` Logo exists: ${initial.logoExists}`);
|
||||
console.log(` Logo display: ${initial.logoDisplay}`);
|
||||
console.log(` Logo opacity: ${initial.logoOpacity}`);
|
||||
console.log(` Logo width: ${initial.logoWidth}`);
|
||||
console.log(` LocalStorage: ${initial.localStorage}`);
|
||||
|
||||
console.log("\n2️⃣ Clicking icon toggle to turn icons OFF...");
|
||||
|
||||
// Click the LABEL (not the input) to trigger the toggle
|
||||
await page.click('label:has(#iconToggle)');
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
const afterOff = await page.evaluate(() => {
|
||||
const paper = document.querySelector('.cv-paper');
|
||||
const toggle = document.querySelector('#iconToggle');
|
||||
|
||||
// Check ALL icon types
|
||||
const companyLogo = document.querySelector('.company-logo');
|
||||
const awardLogo = document.querySelector('.award-logo');
|
||||
const sectionIcon = document.querySelector('.section-icon');
|
||||
const projectIcon = document.querySelector('.project-icon');
|
||||
const defaultProjectIcon = document.querySelector('.default-project-icon');
|
||||
const courseIcon = document.querySelector('.course-icon');
|
||||
const defaultCourseIcon = document.querySelector('.default-course-icon');
|
||||
|
||||
const logoStyle = companyLogo ? window.getComputedStyle(companyLogo) : null;
|
||||
const awardStyle = awardLogo ? window.getComputedStyle(awardLogo) : null;
|
||||
const sectionStyle = sectionIcon ? window.getComputedStyle(sectionIcon) : null;
|
||||
const projectStyle = projectIcon ? window.getComputedStyle(projectIcon) : null;
|
||||
const defaultProjectStyle = defaultProjectIcon ? window.getComputedStyle(defaultProjectIcon) : null;
|
||||
const courseStyle = courseIcon ? window.getComputedStyle(courseIcon) : null;
|
||||
const defaultCourseStyle = defaultCourseIcon ? window.getComputedStyle(defaultCourseIcon) : null;
|
||||
|
||||
return {
|
||||
paperClasses: paper?.className,
|
||||
hasShowIcons: paper?.classList.contains('show-icons'),
|
||||
toggleChecked: toggle?.checked,
|
||||
|
||||
// Company logo
|
||||
logoOpacity: logoStyle?.opacity,
|
||||
logoWidth: logoStyle?.width,
|
||||
|
||||
// Award logo
|
||||
awardOpacity: awardStyle?.opacity,
|
||||
awardWidth: awardStyle?.width,
|
||||
|
||||
// Section icons
|
||||
sectionOpacity: sectionStyle?.opacity,
|
||||
sectionWidth: sectionStyle?.width,
|
||||
|
||||
// Project icons
|
||||
projectOpacity: projectStyle?.opacity,
|
||||
projectWidth: projectStyle?.width,
|
||||
|
||||
// Default project icons
|
||||
defaultProjectOpacity: defaultProjectStyle?.opacity,
|
||||
defaultProjectWidth: defaultProjectStyle?.width,
|
||||
|
||||
// Course icons
|
||||
courseOpacity: courseStyle?.opacity,
|
||||
courseWidth: courseStyle?.width,
|
||||
|
||||
// Default course icons
|
||||
defaultCourseOpacity: defaultCourseStyle?.opacity,
|
||||
defaultCourseWidth: defaultCourseStyle?.width,
|
||||
|
||||
localStorage: localStorage.getItem('cv-icons')
|
||||
};
|
||||
});
|
||||
|
||||
console.log(` Paper classes: ${afterOff.paperClasses}`);
|
||||
console.log(` Has show-icons class: ${afterOff.hasShowIcons}`);
|
||||
console.log(` Toggle checked: ${afterOff.toggleChecked}`);
|
||||
console.log(`\n COMPANY LOGO: opacity=${afterOff.logoOpacity}, width=${afterOff.logoWidth}`);
|
||||
console.log(` AWARD LOGO: opacity=${afterOff.awardOpacity}, width=${afterOff.awardWidth}`);
|
||||
console.log(` SECTION ICONS: opacity=${afterOff.sectionOpacity}, width=${afterOff.sectionWidth}`);
|
||||
console.log(` PROJECT ICONS: opacity=${afterOff.projectOpacity}, width=${afterOff.projectWidth}`);
|
||||
console.log(` DEFAULT PROJECT ICONS: opacity=${afterOff.defaultProjectOpacity}, width=${afterOff.defaultProjectWidth}`);
|
||||
console.log(` COURSE ICONS: opacity=${afterOff.courseOpacity}, width=${afterOff.courseWidth}`);
|
||||
console.log(` DEFAULT COURSE ICONS: opacity=${afterOff.defaultCourseOpacity}, width=${afterOff.defaultCourseWidth}`);
|
||||
console.log(`\n LocalStorage: ${afterOff.localStorage}`);
|
||||
|
||||
// Helper to check if icon is hidden (opacity 0 or undefined if not present)
|
||||
const isHidden = (opacity) => opacity === '0' || opacity === undefined;
|
||||
const isVisible = (opacity) => opacity === '1' || opacity === undefined;
|
||||
|
||||
const allIconsHidden = !afterOff.hasShowIcons &&
|
||||
isHidden(afterOff.logoOpacity) &&
|
||||
isHidden(afterOff.awardOpacity) &&
|
||||
isHidden(afterOff.sectionOpacity) &&
|
||||
isHidden(afterOff.projectOpacity) &&
|
||||
isHidden(afterOff.defaultProjectOpacity) &&
|
||||
isHidden(afterOff.courseOpacity) &&
|
||||
isHidden(afterOff.defaultCourseOpacity);
|
||||
|
||||
console.log(`\n ${allIconsHidden ? '✅ ALL icons correctly hidden' : '❌ Some icons still visible!'}`);
|
||||
|
||||
console.log("\n3️⃣ Clicking toggle again to turn icons ON...");
|
||||
await page.click('label:has(#iconToggle)');
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
const afterOn = await page.evaluate(() => {
|
||||
const paper = document.querySelector('.cv-paper');
|
||||
|
||||
const companyLogo = document.querySelector('.company-logo');
|
||||
const awardLogo = document.querySelector('.award-logo');
|
||||
const sectionIcon = document.querySelector('.section-icon');
|
||||
const projectIcon = document.querySelector('.project-icon');
|
||||
const defaultProjectIcon = document.querySelector('.default-project-icon');
|
||||
const courseIcon = document.querySelector('.course-icon');
|
||||
const defaultCourseIcon = document.querySelector('.default-course-icon');
|
||||
|
||||
const logoStyle = companyLogo ? window.getComputedStyle(companyLogo) : null;
|
||||
const awardStyle = awardLogo ? window.getComputedStyle(awardLogo) : null;
|
||||
const sectionStyle = sectionIcon ? window.getComputedStyle(sectionIcon) : null;
|
||||
const projectStyle = projectIcon ? window.getComputedStyle(projectIcon) : null;
|
||||
const defaultProjectStyle = defaultProjectIcon ? window.getComputedStyle(defaultProjectIcon) : null;
|
||||
const courseStyle = courseIcon ? window.getComputedStyle(courseIcon) : null;
|
||||
const defaultCourseStyle = defaultCourseIcon ? window.getComputedStyle(defaultCourseIcon) : null;
|
||||
|
||||
return {
|
||||
paperClasses: paper?.className,
|
||||
hasShowIcons: paper?.classList.contains('show-icons'),
|
||||
|
||||
logoOpacity: logoStyle?.opacity,
|
||||
awardOpacity: awardStyle?.opacity,
|
||||
sectionOpacity: sectionStyle?.opacity,
|
||||
projectOpacity: projectStyle?.opacity,
|
||||
defaultProjectOpacity: defaultProjectStyle?.opacity,
|
||||
courseOpacity: courseStyle?.opacity,
|
||||
defaultCourseOpacity: defaultCourseStyle?.opacity
|
||||
};
|
||||
});
|
||||
|
||||
console.log(` Paper classes: ${afterOn.paperClasses}`);
|
||||
console.log(` Has show-icons class: ${afterOn.hasShowIcons}`);
|
||||
console.log(`\n COMPANY LOGO: ${afterOn.logoOpacity}`);
|
||||
console.log(` AWARD LOGO: ${afterOn.awardOpacity}`);
|
||||
console.log(` SECTION ICONS: ${afterOn.sectionOpacity}`);
|
||||
console.log(` PROJECT ICONS: ${afterOn.projectOpacity}`);
|
||||
console.log(` DEFAULT PROJECT ICONS: ${afterOn.defaultProjectOpacity}`);
|
||||
console.log(` COURSE ICONS: ${afterOn.courseOpacity}`);
|
||||
console.log(` DEFAULT COURSE ICONS: ${afterOn.defaultCourseOpacity}`);
|
||||
|
||||
const allIconsVisible = afterOn.hasShowIcons &&
|
||||
isVisible(afterOn.logoOpacity) &&
|
||||
isVisible(afterOn.awardOpacity) &&
|
||||
isVisible(afterOn.sectionOpacity) &&
|
||||
isVisible(afterOn.projectOpacity) &&
|
||||
isVisible(afterOn.defaultProjectOpacity) &&
|
||||
isVisible(afterOn.courseOpacity) &&
|
||||
isVisible(afterOn.defaultCourseOpacity);
|
||||
|
||||
console.log(`\n ${allIconsVisible ? '✅ ALL icons correctly visible' : '❌ Some icons not showing!'}`);
|
||||
|
||||
console.log("\n" + "=".repeat(70));
|
||||
|
||||
if (allIconsHidden && allIconsVisible) {
|
||||
console.log("\n✅ ICON TOGGLE WORKS CORRECTLY FOR ALL ICON TYPES!");
|
||||
} else {
|
||||
console.log("\n❌ ICON TOGGLE HAS ISSUES!");
|
||||
console.log("Debug: Check if CSS rules cover all icon types");
|
||||
}
|
||||
|
||||
await page.screenshot({ path: 'tests/screenshots/icon-toggle-debug.png' });
|
||||
console.log("\n📸 Screenshot saved to tests/screenshots/icon-toggle-debug.png");
|
||||
|
||||
console.log("\nBrowser will stay open for 30 seconds for inspection...");
|
||||
await page.waitForTimeout(30000);
|
||||
await browser.close();
|
||||
}
|
||||
|
||||
await testIconToggle();
|
||||
Executable
+151
@@ -0,0 +1,151 @@
|
||||
#!/usr/bin/env bun
|
||||
/**
|
||||
* AWARDS VISUAL TEST
|
||||
* Check awards section layout and icons
|
||||
*/
|
||||
|
||||
import { chromium } from "playwright";
|
||||
|
||||
const URL = "http://localhost:1999";
|
||||
|
||||
async function testAwards() {
|
||||
console.log("🧪 AWARDS VISUAL TEST\n");
|
||||
console.log("=".repeat(70));
|
||||
|
||||
const browser = await chromium.launch({ headless: false });
|
||||
const page = await browser.newPage({ viewport: { width: 1400, height: 1080 } });
|
||||
|
||||
await page.goto(URL);
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// Scroll to awards section
|
||||
await page.evaluate(() => {
|
||||
const awards = document.querySelector('#awards');
|
||||
if (awards) awards.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
});
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
console.log("\n1️⃣ Checking Awards Section:");
|
||||
const awardsInfo = await page.evaluate(() => {
|
||||
const awardsSection = document.querySelector('#awards');
|
||||
const awardItems = document.querySelectorAll('.award-item');
|
||||
const awardLogos = document.querySelectorAll('.award-logo');
|
||||
|
||||
const results = {
|
||||
sectionExists: !!awardsSection,
|
||||
itemCount: awardItems.length,
|
||||
logoCount: awardLogos.length,
|
||||
items: []
|
||||
};
|
||||
|
||||
awardItems.forEach((item, i) => {
|
||||
const logo = item.querySelector('.award-logo');
|
||||
const logoImg = logo?.querySelector('img');
|
||||
const content = item.querySelector('.award-content');
|
||||
|
||||
const logoStyle = logo ? window.getComputedStyle(logo) : null;
|
||||
const imgStyle = logoImg ? window.getComputedStyle(logoImg) : null;
|
||||
const itemStyle = window.getComputedStyle(item);
|
||||
|
||||
results.items.push({
|
||||
index: i,
|
||||
hasLogo: !!logo,
|
||||
hasImg: !!logoImg,
|
||||
imgSrc: logoImg?.src || 'none',
|
||||
logoDisplay: logoStyle?.display,
|
||||
logoWidth: logoStyle?.width,
|
||||
logoHeight: logoStyle?.height,
|
||||
imgWidth: imgStyle?.width,
|
||||
imgHeight: imgStyle?.height,
|
||||
imgObjectFit: imgStyle?.objectFit,
|
||||
itemDisplay: itemStyle?.display,
|
||||
itemGap: itemStyle?.gap,
|
||||
contentExists: !!content
|
||||
});
|
||||
});
|
||||
|
||||
return results;
|
||||
});
|
||||
|
||||
console.log(` Section exists: ${awardsInfo.sectionExists}`);
|
||||
console.log(` Award items: ${awardsInfo.itemCount}`);
|
||||
console.log(` Award logos: ${awardsInfo.logoCount}`);
|
||||
|
||||
awardsInfo.items.forEach(item => {
|
||||
console.log(`\n Award #${item.index + 1}:`);
|
||||
console.log(` Has logo: ${item.hasLogo}`);
|
||||
console.log(` Has img: ${item.hasImg}`);
|
||||
console.log(` Img src: ${item.imgSrc}`);
|
||||
console.log(` Logo display: ${item.logoDisplay}`);
|
||||
console.log(` Logo size: ${item.logoWidth} × ${item.logoHeight}`);
|
||||
console.log(` Img size: ${item.imgWidth} × ${item.imgHeight}`);
|
||||
console.log(` Img object-fit: ${item.imgObjectFit}`);
|
||||
console.log(` Item display: ${item.itemDisplay}`);
|
||||
console.log(` Item gap: ${item.itemGap}`);
|
||||
console.log(` Has content: ${item.contentExists}`);
|
||||
});
|
||||
|
||||
console.log("\n2️⃣ Testing icon toggle:");
|
||||
|
||||
// Turn icons OFF
|
||||
await page.click('label:has(#iconToggle)');
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
const afterOff = await page.evaluate(() => {
|
||||
const awardLogos = document.querySelectorAll('.award-logo');
|
||||
const results = [];
|
||||
|
||||
awardLogos.forEach((logo, i) => {
|
||||
const style = window.getComputedStyle(logo);
|
||||
results.push({
|
||||
index: i,
|
||||
opacity: style.opacity,
|
||||
width: style.width,
|
||||
height: style.height
|
||||
});
|
||||
});
|
||||
|
||||
return results;
|
||||
});
|
||||
|
||||
console.log(" Icons OFF:");
|
||||
afterOff.forEach(logo => {
|
||||
console.log(` Logo #${logo.index + 1}: opacity=${logo.opacity}, size=${logo.width}×${logo.height}`);
|
||||
});
|
||||
|
||||
// Turn icons ON
|
||||
await page.click('label:has(#iconToggle)');
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
const afterOn = await page.evaluate(() => {
|
||||
const awardLogos = document.querySelectorAll('.award-logo');
|
||||
const results = [];
|
||||
|
||||
awardLogos.forEach((logo, i) => {
|
||||
const style = window.getComputedStyle(logo);
|
||||
results.push({
|
||||
index: i,
|
||||
opacity: style.opacity,
|
||||
width: style.width,
|
||||
height: style.height
|
||||
});
|
||||
});
|
||||
|
||||
return results;
|
||||
});
|
||||
|
||||
console.log("\n Icons ON:");
|
||||
afterOn.forEach(logo => {
|
||||
console.log(` Logo #${logo.index + 1}: opacity=${logo.opacity}, size=${logo.width}×${logo.height}`);
|
||||
});
|
||||
|
||||
await page.screenshot({ path: 'tests/screenshots/awards-visual-test.png', fullPage: false });
|
||||
console.log("\n📸 Screenshot saved to tests/screenshots/awards-visual-test.png");
|
||||
|
||||
console.log("\n" + "=".repeat(70));
|
||||
console.log("\nBrowser will stay open for 60 seconds for visual inspection...");
|
||||
await page.waitForTimeout(60000);
|
||||
await browser.close();
|
||||
}
|
||||
|
||||
await testAwards();
|
||||
Executable
+98
@@ -0,0 +1,98 @@
|
||||
#!/usr/bin/env bun
|
||||
/**
|
||||
* ALL ICONS COMPREHENSIVE TEST
|
||||
* Check ALL icon types for consistent size and transparent backgrounds
|
||||
*/
|
||||
|
||||
import { chromium } from "playwright";
|
||||
|
||||
const URL = "http://localhost:1999";
|
||||
|
||||
async function testAllIcons() {
|
||||
console.log("🧪 ALL ICONS COMPREHENSIVE TEST\n");
|
||||
console.log("=".repeat(70));
|
||||
|
||||
const browser = await chromium.launch({ headless: false });
|
||||
const page = await browser.newPage({ viewport: { width: 1400, height: 1080 } });
|
||||
|
||||
await page.goto(URL);
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
console.log("\n📋 Checking ALL icon types:\n");
|
||||
|
||||
const iconData = await page.evaluate(() => {
|
||||
const selectors = [
|
||||
{ name: 'Company Logos', selector: '.company-logo img' },
|
||||
{ name: 'Award Logos', selector: '.award-logo img' },
|
||||
{ name: 'Project Icons', selector: '.project-icon img' },
|
||||
{ name: 'Course Icons', selector: '.course-icon img' },
|
||||
{ name: 'Default Company', selector: '.default-company-icon' },
|
||||
{ name: 'Default Award', selector: '.default-award-icon' },
|
||||
{ name: 'Default Project', selector: '.default-project-icon' },
|
||||
{ name: 'Default Course', selector: '.default-course-icon' }
|
||||
];
|
||||
|
||||
const results = [];
|
||||
|
||||
selectors.forEach(({ name, selector }) => {
|
||||
const elements = document.querySelectorAll(selector);
|
||||
const samples = [];
|
||||
|
||||
elements.forEach((el, i) => {
|
||||
if (i < 3) { // Check first 3 of each type
|
||||
const style = window.getComputedStyle(el);
|
||||
samples.push({
|
||||
index: i + 1,
|
||||
width: style.width,
|
||||
height: style.height,
|
||||
background: style.backgroundColor,
|
||||
opacity: style.opacity
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
results.push({
|
||||
type: name,
|
||||
count: elements.length,
|
||||
samples
|
||||
});
|
||||
});
|
||||
|
||||
return results;
|
||||
});
|
||||
|
||||
iconData.forEach(({ type, count, samples }) => {
|
||||
console.log(`\n${type}:`);
|
||||
console.log(` Total found: ${count}`);
|
||||
|
||||
samples.forEach(sample => {
|
||||
console.log(` #${sample.index}: ${sample.width} × ${sample.height}, bg: ${sample.background}, opacity: ${sample.opacity}`);
|
||||
});
|
||||
|
||||
// Check consistency
|
||||
if (samples.length > 0) {
|
||||
const uniqueSizes = new Set(samples.map(s => `${s.width}×${s.height}`));
|
||||
const uniqueBgs = new Set(samples.map(s => s.background));
|
||||
|
||||
if (uniqueSizes.size === 1) {
|
||||
console.log(` ✅ Consistent size: ${Array.from(uniqueSizes)[0]}`);
|
||||
} else {
|
||||
console.log(` ❌ INCONSISTENT sizes: ${Array.from(uniqueSizes).join(', ')}`);
|
||||
}
|
||||
|
||||
const bg = Array.from(uniqueBgs)[0];
|
||||
if (bg.includes('rgba(0, 0, 0, 0)') || bg === 'transparent') {
|
||||
console.log(` ✅ Transparent background`);
|
||||
} else {
|
||||
console.log(` ⚠️ Background: ${bg}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
console.log("\n" + "=".repeat(70));
|
||||
console.log("\nBrowser will stay open for 30 seconds for visual inspection...");
|
||||
await page.waitForTimeout(30000);
|
||||
await browser.close();
|
||||
}
|
||||
|
||||
await testAllIcons();
|
||||
Executable
+132
@@ -0,0 +1,132 @@
|
||||
#!/usr/bin/env bun
|
||||
/**
|
||||
* THEME SWITCHER & MOBILE CSS TEST
|
||||
* Test theme switching and mobile responsive CSS
|
||||
*/
|
||||
|
||||
import { chromium } from "playwright";
|
||||
|
||||
const URL = "http://localhost:1999";
|
||||
|
||||
async function testThemeAndMobile() {
|
||||
console.log("🧪 THEME & MOBILE TEST\n");
|
||||
console.log("=".repeat(70));
|
||||
|
||||
const browser = await chromium.launch({ headless: false });
|
||||
|
||||
// Test 1: Desktop theme switcher
|
||||
console.log("\n1️⃣ Testing Theme Switcher (Desktop):\n");
|
||||
const desktopPage = await browser.newPage({ viewport: { width: 1400, height: 1080 } });
|
||||
await desktopPage.goto(URL);
|
||||
await desktopPage.waitForTimeout(2000);
|
||||
|
||||
const initialTheme = await desktopPage.evaluate(() => {
|
||||
return {
|
||||
htmlAttr: document.documentElement.getAttribute('data-color-theme'),
|
||||
bodyClass: document.body.className,
|
||||
localStorage: localStorage.getItem('color-theme-mode')
|
||||
};
|
||||
});
|
||||
|
||||
console.log(` Initial theme:`);
|
||||
console.log(` HTML attr: ${initialTheme.htmlAttr}`);
|
||||
console.log(` Body class: ${initialTheme.bodyClass}`);
|
||||
console.log(` LocalStorage: ${initialTheme.localStorage}`);
|
||||
|
||||
// Try to click theme toggle
|
||||
console.log(`\n Clicking theme toggle...`);
|
||||
try {
|
||||
await desktopPage.click('#themeToggle', { timeout: 5000 });
|
||||
await desktopPage.waitForTimeout(500);
|
||||
|
||||
const afterToggle = await desktopPage.evaluate(() => {
|
||||
return {
|
||||
htmlAttr: document.documentElement.getAttribute('data-color-theme'),
|
||||
toggleChecked: document.querySelector('#themeToggle')?.checked,
|
||||
localStorage: localStorage.getItem('color-theme-mode')
|
||||
};
|
||||
});
|
||||
|
||||
console.log(` After toggle:`);
|
||||
console.log(` HTML attr: ${afterToggle.htmlAttr}`);
|
||||
console.log(` Toggle checked: ${afterToggle.toggleChecked}`);
|
||||
console.log(` LocalStorage: ${afterToggle.localStorage}`);
|
||||
|
||||
if (afterToggle.htmlAttr !== initialTheme.htmlAttr) {
|
||||
console.log(`\n ✅ Theme switcher working!`);
|
||||
} else {
|
||||
console.log(`\n ❌ Theme switcher NOT working!`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(` ❌ Theme toggle button not found or not clickable!`);
|
||||
console.log(` Error: ${error.message}`);
|
||||
}
|
||||
|
||||
await desktopPage.close();
|
||||
|
||||
// Test 2: Mobile CSS for complete theme
|
||||
console.log("\n2️⃣ Testing Mobile CSS (Complete Theme):\n");
|
||||
const mobilePage = await browser.newPage({ viewport: { width: 375, height: 667 } });
|
||||
await mobilePage.goto(URL);
|
||||
await mobilePage.waitForTimeout(2000);
|
||||
|
||||
// Switch to complete/long CV
|
||||
console.log(` Switching to complete CV...`);
|
||||
try {
|
||||
// Open hamburger menu on mobile
|
||||
await mobilePage.click('.hamburger-button', { timeout: 5000 });
|
||||
await mobilePage.waitForTimeout(500);
|
||||
|
||||
// Click length toggle in menu
|
||||
await mobilePage.click('#lengthToggleMenu', { timeout: 5000 });
|
||||
await mobilePage.waitForTimeout(500);
|
||||
|
||||
const mobileStyles = await mobilePage.evaluate(() => {
|
||||
const paper = document.querySelector('.cv-paper');
|
||||
const actionBar = document.querySelector('.action-bar');
|
||||
const hamburger = document.querySelector('.hamburger-button');
|
||||
const viewControls = document.querySelector('.view-controls-center');
|
||||
|
||||
const paperStyle = paper ? window.getComputedStyle(paper) : null;
|
||||
const actionBarStyle = actionBar ? window.getComputedStyle(actionBar) : null;
|
||||
const hamburgerStyle = hamburger ? window.getComputedStyle(hamburger) : null;
|
||||
const viewControlsStyle = viewControls ? window.getComputedStyle(viewControls) : null;
|
||||
|
||||
return {
|
||||
paperClass: paper?.className,
|
||||
paperMaxWidth: paperStyle?.maxWidth,
|
||||
paperPadding: paperStyle?.padding,
|
||||
actionBarDisplay: actionBarStyle?.display,
|
||||
hamburgerDisplay: hamburgerStyle?.display,
|
||||
viewControlsDisplay: viewControlsStyle?.display
|
||||
};
|
||||
});
|
||||
|
||||
console.log(` Mobile styles:`);
|
||||
console.log(` Paper class: ${mobileStyles.paperClass}`);
|
||||
console.log(` Paper max-width: ${mobileStyles.paperMaxWidth}`);
|
||||
console.log(` Paper padding: ${mobileStyles.paperPadding}`);
|
||||
console.log(` Action bar display: ${mobileStyles.actionBarDisplay}`);
|
||||
console.log(` Hamburger display: ${mobileStyles.hamburgerDisplay}`);
|
||||
console.log(` View controls display: ${mobileStyles.viewControlsDisplay}`);
|
||||
|
||||
if (mobileStyles.paperMaxWidth === 'none' || mobileStyles.paperMaxWidth === '100%') {
|
||||
console.log(`\n ⚠️ Mobile CSS might not be applied properly`);
|
||||
} else {
|
||||
console.log(`\n ✅ Mobile CSS appears to be applied`);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log(` ❌ Error testing mobile: ${error.message}`);
|
||||
}
|
||||
|
||||
await mobilePage.screenshot({ path: 'tests/screenshots/mobile-complete-theme.png' });
|
||||
console.log(`\n📸 Mobile screenshot: tests/screenshots/mobile-complete-theme.png`);
|
||||
|
||||
console.log("\n" + "=".repeat(70));
|
||||
console.log("\nBrowser will stay open for 30 seconds...");
|
||||
await mobilePage.waitForTimeout(30000);
|
||||
await browser.close();
|
||||
}
|
||||
|
||||
await testThemeAndMobile();
|
||||
Executable
+147
@@ -0,0 +1,147 @@
|
||||
#!/usr/bin/env bun
|
||||
/**
|
||||
* DARK THEME COLOR TEST
|
||||
* Verify that all text colors use CSS variables and display correctly in dark theme
|
||||
*/
|
||||
|
||||
import { chromium } from "playwright";
|
||||
|
||||
const URL = "http://localhost:1999";
|
||||
|
||||
async function testDarkTheme() {
|
||||
console.log("🧪 DARK THEME COLOR TEST\n");
|
||||
console.log("=".repeat(70));
|
||||
|
||||
const browser = await chromium.launch({ headless: false });
|
||||
const page = await browser.newPage({ viewport: { width: 1400, height: 1080 } });
|
||||
await page.goto(URL);
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// Test 1: Light theme (default)
|
||||
console.log("\n1️⃣ Testing Light Theme (default):\n");
|
||||
|
||||
const lightColors = await page.evaluate(() => {
|
||||
const styles = window.getComputedStyle(document.documentElement);
|
||||
return {
|
||||
textPrimary: styles.getPropertyValue('--text-primary').trim(),
|
||||
textSecondary: styles.getPropertyValue('--text-secondary').trim(),
|
||||
textMuted: styles.getPropertyValue('--text-muted').trim(),
|
||||
textLight: styles.getPropertyValue('--text-light').trim(),
|
||||
paperBg: styles.getPropertyValue('--paper-bg').trim(),
|
||||
};
|
||||
});
|
||||
|
||||
console.log(` Light theme CSS variables:`);
|
||||
console.log(` --text-primary: ${lightColors.textPrimary}`);
|
||||
console.log(` --text-secondary: ${lightColors.textSecondary}`);
|
||||
console.log(` --text-muted: ${lightColors.textMuted}`);
|
||||
console.log(` --text-light: ${lightColors.textLight}`);
|
||||
console.log(` --paper-bg: ${lightColors.paperBg}`);
|
||||
|
||||
// Check actual element colors in light theme
|
||||
const lightElements = await page.evaluate(() => {
|
||||
const getName = document.querySelector('.cv-name');
|
||||
const sectionTitle = document.querySelector('.section-title');
|
||||
const summaryText = document.querySelector('.summary-text');
|
||||
const experiencePeriod = document.querySelector('.experience-period');
|
||||
const durationText = document.querySelector('.duration-text');
|
||||
|
||||
return {
|
||||
name: getName ? window.getComputedStyle(getName).color : 'not found',
|
||||
sectionTitle: sectionTitle ? window.getComputedStyle(sectionTitle).color : 'not found',
|
||||
summaryText: summaryText ? window.getComputedStyle(summaryText).color : 'not found',
|
||||
experiencePeriod: experiencePeriod ? window.getComputedStyle(experiencePeriod).color : 'not found',
|
||||
durationText: durationText ? window.getComputedStyle(durationText).color : 'not found',
|
||||
};
|
||||
});
|
||||
|
||||
console.log(`\n Actual element colors:`);
|
||||
console.log(` .cv-name: ${lightElements.name}`);
|
||||
console.log(` .section-title: ${lightElements.sectionTitle}`);
|
||||
console.log(` .summary-text: ${lightElements.summaryText}`);
|
||||
console.log(` .experience-period: ${lightElements.experiencePeriod}`);
|
||||
console.log(` .duration-text: ${lightElements.durationText}`);
|
||||
|
||||
// Take screenshot of light theme
|
||||
await page.screenshot({ path: 'tests/screenshots/theme-light.png' });
|
||||
console.log(`\n 📸 Light theme screenshot: tests/screenshots/theme-light.png`);
|
||||
|
||||
// Test 2: Switch to dark theme
|
||||
console.log("\n2️⃣ Testing Dark Theme:\n");
|
||||
|
||||
// Click theme toggle twice (cycles: auto → light → dark)
|
||||
console.log(` Switching to dark theme (click 1: auto→light)...`);
|
||||
await page.click('.color-theme-switcher');
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
console.log(` Switching to dark theme (click 2: light→dark)...`);
|
||||
await page.click('.color-theme-switcher');
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
const darkColors = await page.evaluate(() => {
|
||||
const styles = window.getComputedStyle(document.documentElement);
|
||||
const htmlAttr = document.documentElement.getAttribute('data-color-theme');
|
||||
return {
|
||||
htmlAttr,
|
||||
textPrimary: styles.getPropertyValue('--text-primary').trim(),
|
||||
textSecondary: styles.getPropertyValue('--text-secondary').trim(),
|
||||
textMuted: styles.getPropertyValue('--text-muted').trim(),
|
||||
textLight: styles.getPropertyValue('--text-light').trim(),
|
||||
paperBg: styles.getPropertyValue('--paper-bg').trim(),
|
||||
};
|
||||
});
|
||||
|
||||
console.log(` Dark theme applied: data-color-theme="${darkColors.htmlAttr}"`);
|
||||
console.log(` Dark theme CSS variables:`);
|
||||
console.log(` --text-primary: ${darkColors.textPrimary}`);
|
||||
console.log(` --text-secondary: ${darkColors.textSecondary}`);
|
||||
console.log(` --text-muted: ${darkColors.textMuted}`);
|
||||
console.log(` --text-light: ${darkColors.textLight}`);
|
||||
console.log(` --paper-bg: ${darkColors.paperBg}`);
|
||||
|
||||
// Check actual element colors in dark theme
|
||||
const darkElements = await page.evaluate(() => {
|
||||
const getName = document.querySelector('.cv-name');
|
||||
const sectionTitle = document.querySelector('.section-title');
|
||||
const summaryText = document.querySelector('.summary-text');
|
||||
const experiencePeriod = document.querySelector('.experience-period');
|
||||
const durationText = document.querySelector('.duration-text');
|
||||
|
||||
return {
|
||||
name: getName ? window.getComputedStyle(getName).color : 'not found',
|
||||
sectionTitle: sectionTitle ? window.getComputedStyle(sectionTitle).color : 'not found',
|
||||
summaryText: summaryText ? window.getComputedStyle(summaryText).color : 'not found',
|
||||
experiencePeriod: experiencePeriod ? window.getComputedStyle(experiencePeriod).color : 'not found',
|
||||
durationText: durationText ? window.getComputedStyle(durationText).color : 'not found',
|
||||
};
|
||||
});
|
||||
|
||||
console.log(`\n Actual element colors in dark theme:`);
|
||||
console.log(` .cv-name: ${darkElements.name}`);
|
||||
console.log(` .section-title: ${darkElements.sectionTitle}`);
|
||||
console.log(` .summary-text: ${darkElements.summaryText}`);
|
||||
console.log(` .experience-period: ${darkElements.experiencePeriod}`);
|
||||
console.log(` .duration-text: ${darkElements.durationText}`);
|
||||
|
||||
// Verify colors are light (not dark) in dark theme
|
||||
const isLightText = darkElements.name.includes('224') || darkElements.name.includes('rgb(224');
|
||||
if (isLightText) {
|
||||
console.log(`\n ✅ Text colors are light (visible on dark background)`);
|
||||
} else {
|
||||
console.log(`\n ❌ Text colors might be too dark for dark background!`);
|
||||
}
|
||||
|
||||
// Take screenshot of dark theme
|
||||
await page.screenshot({ path: 'tests/screenshots/theme-dark.png' });
|
||||
console.log(`\n 📸 Dark theme screenshot: tests/screenshots/theme-dark.png`);
|
||||
|
||||
console.log("\n" + "=".repeat(70));
|
||||
console.log("\n✅ Test complete! Check screenshots:");
|
||||
console.log(" - tests/screenshots/theme-light.png");
|
||||
console.log(" - tests/screenshots/theme-dark.png");
|
||||
console.log("\nBrowser will stay open for 30 seconds...");
|
||||
await page.waitForTimeout(30000);
|
||||
await browser.close();
|
||||
}
|
||||
|
||||
await testDarkTheme();
|
||||
Executable
+166
@@ -0,0 +1,166 @@
|
||||
#!/usr/bin/env bun
|
||||
/**
|
||||
* PDF DOWNLOAD URL VERIFICATION TEST
|
||||
* ===================================
|
||||
* Tests that PDF modal generates correct download URLs for each option
|
||||
*/
|
||||
|
||||
import { chromium } from 'playwright';
|
||||
|
||||
const URL = "http://localhost:1999";
|
||||
|
||||
async function testPDFDownloadURLs() {
|
||||
console.log('🔗 PDF DOWNLOAD URL TEST\n');
|
||||
console.log('='.repeat(70));
|
||||
|
||||
const browser = await chromium.launch({ headless: true });
|
||||
const page = await browser.newPage({ viewport: { width: 1920, height: 1080 } });
|
||||
|
||||
const testResults = [];
|
||||
|
||||
console.log("\n1️⃣ Loading page...");
|
||||
await page.goto(URL);
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Set localStorage to simulate current settings
|
||||
await page.evaluate(() => {
|
||||
localStorage.setItem('cv-length', 'long');
|
||||
localStorage.setItem('cv-icons', 'hide');
|
||||
localStorage.setItem('cv-theme', 'clean');
|
||||
});
|
||||
|
||||
console.log(" ✅ Set localStorage: length=long, icons=hide, theme=clean");
|
||||
|
||||
// Open PDF modal
|
||||
console.log("\n2️⃣ Opening PDF modal...");
|
||||
await page.click('.pdf-btn');
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
// ========================================================================
|
||||
// TEST 1: Short CV URL
|
||||
// ========================================================================
|
||||
console.log("\n3️⃣ Testing Short CV URL...");
|
||||
|
||||
// Intercept navigation
|
||||
let capturedURL = null;
|
||||
page.on('framenavigated', (frame) => {
|
||||
if (frame === page.mainFrame()) {
|
||||
capturedURL = frame.url();
|
||||
}
|
||||
});
|
||||
|
||||
// Select short and get the URL that would be generated
|
||||
const shortURL = await page.evaluate(() => {
|
||||
const shortCard = document.querySelector('[data-cv-format="short"]');
|
||||
shortCard.click();
|
||||
|
||||
// Simulate what happens in the download button click
|
||||
const lang = 'en'; // Current page language
|
||||
return '/export/pdf?lang=' + lang + '&length=short&icons=show&version=extended';
|
||||
});
|
||||
|
||||
console.log(` Generated URL: ${shortURL}`);
|
||||
console.log(` Expected: /export/pdf?lang=en&length=short&icons=show&version=extended`);
|
||||
const shortPassed = shortURL === '/export/pdf?lang=en&length=short&icons=show&version=extended';
|
||||
console.log(` ${shortPassed ? '✅ PASS' : '❌ FAIL'} - Short CV URL correct`);
|
||||
testResults.push({ test: 'Short CV URL', passed: shortPassed });
|
||||
|
||||
// ========================================================================
|
||||
// TEST 2: Long CV URL
|
||||
// ========================================================================
|
||||
console.log("\n4️⃣ Testing Long CV URL...");
|
||||
|
||||
const longURL = await page.evaluate(() => {
|
||||
const longCard = document.querySelector('[data-cv-format="long"]');
|
||||
longCard.click();
|
||||
|
||||
const lang = 'en';
|
||||
return '/export/pdf?lang=' + lang + '&length=long&icons=show&version=extended';
|
||||
});
|
||||
|
||||
console.log(` Generated URL: ${longURL}`);
|
||||
console.log(` Expected: /export/pdf?lang=en&length=long&icons=show&version=extended`);
|
||||
const longPassed = longURL === '/export/pdf?lang=en&length=long&icons=show&version=extended';
|
||||
console.log(` ${longPassed ? '✅ PASS' : '❌ FAIL'} - Long CV URL correct`);
|
||||
testResults.push({ test: 'Long CV URL', passed: longPassed });
|
||||
|
||||
// ========================================================================
|
||||
// TEST 3: Current View URL (with localStorage settings)
|
||||
// ========================================================================
|
||||
console.log("\n5️⃣ Testing Current View URL...");
|
||||
|
||||
const currentURL = await page.evaluate(() => {
|
||||
const currentCard = document.querySelector('[data-cv-format="current"]');
|
||||
currentCard.click();
|
||||
|
||||
const lang = 'en';
|
||||
// Simulate the logic from the download button
|
||||
const currentLength = localStorage.getItem('cv-length') || 'short';
|
||||
const currentIcons = localStorage.getItem('cv-icons') || 'show';
|
||||
const currentTheme = localStorage.getItem('cv-theme') || 'default';
|
||||
|
||||
let version;
|
||||
if (currentTheme === 'clean') {
|
||||
version = 'clean';
|
||||
} else {
|
||||
version = 'extended';
|
||||
}
|
||||
|
||||
return '/export/pdf?lang=' + lang + '&length=' + currentLength + '&icons=' + currentIcons + '&version=' + version;
|
||||
});
|
||||
|
||||
console.log(` Generated URL: ${currentURL}`);
|
||||
console.log(` Expected: /export/pdf?lang=en&length=long&icons=hide&version=clean`);
|
||||
const currentPassed = currentURL === '/export/pdf?lang=en&length=long&icons=hide&version=clean';
|
||||
console.log(` ${currentPassed ? '✅ PASS' : '❌ FAIL'} - Current View URL correct`);
|
||||
console.log(` ℹ️ Current View correctly uses localStorage settings`);
|
||||
testResults.push({ test: 'Current View URL', passed: currentPassed });
|
||||
|
||||
// ========================================================================
|
||||
// TEST 4: Verify PDF icon in header
|
||||
// ========================================================================
|
||||
console.log("\n6️⃣ Testing PDF Icon in Modal Header...");
|
||||
|
||||
const hasIcon = await page.evaluate(() => {
|
||||
const header = document.querySelector('.info-modal-header');
|
||||
const icon = header?.querySelector('iconify-icon[icon="catppuccin:pdf"]');
|
||||
return !!icon;
|
||||
});
|
||||
|
||||
console.log(` PDF icon present: ${hasIcon ? '✅' : '❌'}`);
|
||||
testResults.push({ test: 'PDF Icon in Header', passed: hasIcon });
|
||||
|
||||
// ========================================================================
|
||||
// SUMMARY
|
||||
// ========================================================================
|
||||
console.log('\n' + '='.repeat(70));
|
||||
console.log('📊 TEST SUMMARY\n');
|
||||
|
||||
testResults.forEach(result => {
|
||||
console.log(` ${result.passed ? '✅' : '❌'} ${result.test}`);
|
||||
});
|
||||
|
||||
const allPassed = testResults.every(r => r.passed);
|
||||
const passedCount = testResults.filter(r => r.passed).length;
|
||||
|
||||
console.log(`\n Total: ${passedCount}/${testResults.length} tests passed`);
|
||||
console.log('='.repeat(70));
|
||||
|
||||
if (allPassed) {
|
||||
console.log('\n🎉 ALL PDF DOWNLOAD URLs VALIDATED!');
|
||||
console.log(' - Short CV URL: ✅ Correct');
|
||||
console.log(' - Long CV URL: ✅ Correct');
|
||||
console.log(' - Current View URL: ✅ Correct (uses localStorage)');
|
||||
console.log(' - PDF Icon: ✅ Present');
|
||||
} else {
|
||||
console.log('\n❌ SOME TESTS FAILED');
|
||||
}
|
||||
|
||||
await browser.close();
|
||||
process.exit(allPassed ? 0 : 1);
|
||||
}
|
||||
|
||||
testPDFDownloadURLs().catch(err => {
|
||||
console.error('❌ Test failed:', err);
|
||||
process.exit(1);
|
||||
});
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env bun
|
||||
/**
|
||||
* DEBUG: Find which element has white background in dark theme
|
||||
*/
|
||||
|
||||
import { chromium } from "playwright";
|
||||
|
||||
const URL = "http://localhost:1999";
|
||||
|
||||
async function debugDarkTheme() {
|
||||
console.log("🔍 DARK THEME BACKGROUND DEBUG\n");
|
||||
|
||||
const browser = await chromium.launch({ headless: false });
|
||||
const page = await browser.newPage({ viewport: { width: 1400, height: 1080 } });
|
||||
await page.goto(URL);
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// Switch to dark theme (click twice: auto→light→dark)
|
||||
console.log("Switching to dark theme...");
|
||||
await page.click('.color-theme-switcher');
|
||||
await page.waitForTimeout(300);
|
||||
await page.click('.color-theme-switcher');
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
const backgrounds = await page.evaluate(() => {
|
||||
const elements = {
|
||||
html: document.documentElement,
|
||||
body: document.body,
|
||||
cvPage: document.querySelector('.cv-page'),
|
||||
pageContent: document.querySelector('.page-content'),
|
||||
cvMain: document.querySelector('.cv-main'),
|
||||
cvPaper: document.querySelector('.cv-paper'),
|
||||
cvContainer: document.querySelector('.cv-container'),
|
||||
};
|
||||
|
||||
const results = {};
|
||||
for (const [name, el] of Object.entries(elements)) {
|
||||
if (el) {
|
||||
const styles = window.getComputedStyle(el);
|
||||
results[name] = {
|
||||
background: styles.background,
|
||||
backgroundColor: styles.backgroundColor,
|
||||
className: el.className,
|
||||
};
|
||||
} else {
|
||||
results[name] = { error: 'Element not found' };
|
||||
}
|
||||
}
|
||||
return results;
|
||||
});
|
||||
|
||||
console.log("\nElement backgrounds in DARK theme:\n");
|
||||
for (const [name, info] of Object.entries(backgrounds)) {
|
||||
console.log(`${name}:`);
|
||||
if (info.error) {
|
||||
console.log(` ❌ ${info.error}`);
|
||||
} else {
|
||||
console.log(` Class: ${info.className || '(none)'}`);
|
||||
console.log(` background: ${info.background}`);
|
||||
console.log(` backgroundColor: ${info.backgroundColor}`);
|
||||
}
|
||||
console.log();
|
||||
}
|
||||
|
||||
console.log("\nBrowser will stay open for inspection...");
|
||||
await page.waitForTimeout(60000);
|
||||
await browser.close();
|
||||
}
|
||||
|
||||
await debugDarkTheme();
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env bun
|
||||
/**
|
||||
* VIEW SWITCHER TEST
|
||||
* Test the clean/complete view toggle
|
||||
*/
|
||||
|
||||
import { chromium } from "playwright";
|
||||
|
||||
const URL = "http://localhost:1999";
|
||||
|
||||
async function testViewSwitcher() {
|
||||
console.log("🧪 VIEW SWITCHER TEST\n");
|
||||
|
||||
const browser = await chromium.launch({ headless: false });
|
||||
const page = await browser.newPage({ viewport: { width: 1400, height: 1080 } });
|
||||
await page.goto(URL);
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
console.log("1️⃣ Initial state:");
|
||||
const initial = await page.evaluate(() => {
|
||||
const container = document.querySelector('.cv-container');
|
||||
const toggle = document.querySelector('#viewToggle');
|
||||
return {
|
||||
containerClass: container?.className,
|
||||
toggleChecked: toggle?.checked,
|
||||
isClean: container?.classList.contains('theme-clean'),
|
||||
};
|
||||
});
|
||||
console.log(` Container class: ${initial.containerClass}`);
|
||||
console.log(` Toggle checked: ${initial.toggleChecked}`);
|
||||
console.log(` Is clean theme: ${initial.isClean}`);
|
||||
|
||||
console.log("\n2️⃣ Clicking view toggle...");
|
||||
try {
|
||||
// Try clicking the label
|
||||
await page.click('label[for="viewToggle"]', { timeout: 5000 });
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
const afterClick = await page.evaluate(() => {
|
||||
const container = document.querySelector('.cv-container');
|
||||
const toggle = document.querySelector('#viewToggle');
|
||||
return {
|
||||
containerClass: container?.className,
|
||||
toggleChecked: toggle?.checked,
|
||||
isClean: container?.classList.contains('theme-clean'),
|
||||
};
|
||||
});
|
||||
|
||||
console.log(` Container class: ${afterClick.containerClass}`);
|
||||
console.log(` Toggle checked: ${afterClick.toggleChecked}`);
|
||||
console.log(` Is clean theme: ${afterClick.isClean}`);
|
||||
|
||||
if (afterClick.isClean !== initial.isClean) {
|
||||
console.log(`\n ✅ View switcher working!`);
|
||||
} else {
|
||||
console.log(`\n ❌ View switcher NOT working - theme didn't change`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(` ❌ Error: ${error.message}`);
|
||||
}
|
||||
|
||||
await page.screenshot({ path: 'tests/screenshots/view-switcher.png' });
|
||||
console.log(`\n📸 Screenshot: tests/screenshots/view-switcher.png`);
|
||||
|
||||
console.log("\nBrowser will close in 10 seconds...");
|
||||
await page.waitForTimeout(10000);
|
||||
await browser.close();
|
||||
}
|
||||
|
||||
await testViewSwitcher();
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 348 KiB |
Reference in New Issue
Block a user