#!/usr/bin/env node import { chromium } from 'playwright'; const PORTRAIT = { width: 375, height: 667 }; // iPhone SE portrait const LANDSCAPE = { width: 667, height: 375 }; // iPhone SE landscape (async () => { const browser = await chromium.launch({ headless: true }); console.log('๐Ÿงช Testing Mobile Portrait & Landscape Views\n'); // TEST 1: Portrait with Blur Bar console.log('๐Ÿ“ฑ TEST 1: Portrait Mode with iOS Blur Bar\n'); const portraitContext = await browser.newContext({ viewport: PORTRAIT }); const portraitPage = await portraitContext.newPage(); await portraitPage.goto('http://localhost:1999/?lang=en&view=extended'); await portraitPage.waitForLoadState('networkidle'); // Check for blur backdrop const blurBackdrop = await portraitPage.locator('.fixed-buttons-backdrop'); const backdropExists = await blurBackdrop.count() > 0; console.log(`๐Ÿ“Š Blur Backdrop:`); console.log(` โ€ข Element exists: ${backdropExists ? 'โœ…' : 'โŒ'}`); if (backdropExists) { const backdropStyles = await blurBackdrop.evaluate(el => { const computed = window.getComputedStyle(el); return { position: computed.position, bottom: computed.bottom, height: computed.height, backdropFilter: computed.backdropFilter, background: computed.background, borderTop: computed.borderTop, zIndex: computed.zIndex }; }); console.log(` โ€ข Position: ${backdropStyles.position}`); console.log(` โ€ข Bottom: ${backdropStyles.bottom}`); console.log(` โ€ข Height: ${backdropStyles.height}`); console.log(` โ€ข Backdrop filter: ${backdropStyles.backdropFilter}`); console.log(` โ€ข Border top: ${backdropStyles.borderTop}`); console.log(` โ€ข Z-index: ${backdropStyles.zIndex}`); const hasBlur = backdropStyles.backdropFilter.includes('blur'); const isFixed = backdropStyles.position === 'fixed'; const atBottom = backdropStyles.bottom === '0px'; console.log(`\nโœ… Blur Bar Check:`); console.log(` โ€ข Fixed position: ${isFixed ? 'โœ…' : 'โŒ'}`); console.log(` โ€ข At bottom: ${atBottom ? 'โœ…' : 'โŒ'}`); console.log(` โ€ข Has blur effect: ${hasBlur ? 'โœ…' : 'โŒ'}`); } await portraitPage.screenshot({ path: 'tests/screenshots/mobile-portrait-blur-bar.png', fullPage: true }); console.log('\n๐Ÿ“ธ Screenshot: tests/screenshots/mobile-portrait-blur-bar.png'); await portraitContext.close(); // TEST 2: Landscape Orientation console.log('\n๐Ÿ“ฑ TEST 2: Landscape Mode\n'); const landscapeContext = await browser.newContext({ viewport: LANDSCAPE }); const landscapePage = await landscapeContext.newPage(); await landscapePage.goto('http://localhost:1999/?lang=en&view=extended'); await landscapePage.waitForLoadState('networkidle'); // Check landscape-specific styles const cvName = await landscapePage.locator('.cv-name'); const cvPhoto = await landscapePage.locator('.cv-photo'); const actionBar = await landscapePage.locator('.action-bar'); const nameStyles = await cvName.evaluate(el => { const computed = window.getComputedStyle(el); return { fontSize: computed.fontSize, marginBottom: computed.marginBottom }; }); const photoStyles = await cvPhoto.evaluate(el => { const computed = window.getComputedStyle(el); return { display: computed.display, width: computed.width, maxWidth: computed.maxWidth }; }); const actionBarPadding = await actionBar.evaluate(el => { return window.getComputedStyle(el).padding; }); console.log(`๐Ÿ“Š Landscape Optimizations:`); console.log(` โ€ข Name font size: ${nameStyles.fontSize} (should be ~1.2rem)`); console.log(` โ€ข Photo visible: ${photoStyles.display !== 'none' ? 'โœ… YES' : 'โŒ NO'}`); console.log(` โ€ข Photo width: ${photoStyles.width} (max: ${photoStyles.maxWidth})`); console.log(` โ€ข Action bar compact: ${actionBarPadding}`); const isOptimized = photoStyles.display !== 'none' && parseFloat(photoStyles.maxWidth) <= 80 && parseFloat(nameStyles.fontSize) < 20; console.log(`\n${isOptimized ? 'โœ…' : 'โŒ'} Landscape mode ${isOptimized ? 'IS' : 'is NOT'} optimized`); await landscapePage.screenshot({ path: 'tests/screenshots/mobile-landscape-optimized.png', fullPage: true }); console.log('\n๐Ÿ“ธ Screenshot: tests/screenshots/mobile-landscape-optimized.png'); await landscapeContext.close(); console.log('\nโœ… All tests completed!\n'); await browser.close(); })();