diff --git a/cypress.config.ts b/cypress.config.ts index 36dd4aa1..c4d7c7ee 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -25,17 +25,30 @@ export default defineConfig({ setupNodeEvents(on, config) { // Configure browser launch options on('before:browser:launch', (browser, launchOptions) => { - if (browser.family === 'chromium' && browser.name !== 'electron') { - // Remove --start-fullscreen flag and set window size - launchOptions.args = launchOptions.args.filter(arg => !arg.includes('--start-fullscreen')); - launchOptions.args.push('--window-size=1440,900'); - launchOptions.args.push('--window-position=100,100'); + if (browser.name === 'chrome' || browser.family === 'chromium') { + // Remove fullscreen and kiosk related flags + launchOptions.args = launchOptions.args.filter(arg => { + return !arg.includes('--start-fullscreen') && + !arg.includes('--start-maximized') && + !arg.includes('--kiosk') && + !arg.includes('--app') && + !arg.includes('--auto-open-devtools-for-tabs'); + }); - // Disable kiosk mode - const kioskIndex = launchOptions.args.indexOf('--kiosk'); - if (kioskIndex > -1) { - launchOptions.args.splice(kioskIndex, 1); - } + // Add flags to ensure windowed mode + // Position window at bottom of screen (adjust based on your screen height) + // For a 1080p screen (1920x1080), positioning at y=180 leaves the window at bottom + // For a 1440p screen (2560x1440), positioning at y=540 leaves the window at bottom + launchOptions.args.push('--window-size=1440,900'); + launchOptions.args.push('--window-position=0,180'); + launchOptions.args.push('--disable-gpu-sandbox'); + launchOptions.args.push('--no-sandbox'); + launchOptions.args.push('--disable-dev-shm-usage'); + + // Force disable fullscreen + launchOptions.args.push('--force-device-scale-factor=1'); + + console.log('Chrome launch args:', launchOptions.args); } return launchOptions; }); diff --git a/package.json b/package.json index 629e7749..3ce2bd05 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,8 @@ "test:unit:coverage": "cross-env COVERAGE=true jest --coverage", "test:components:coverage": "cross-env COVERAGE=true cypress run --component --browser chrome --headless", "test:cy": "cypress run", + "test:cy:chrome": "cypress run --browser chrome --headed", + "test:cy:chrome:windowed": "ELECTRON_EXTRA_LAUNCH_ARGS='--window-size=1440,900 --window-position=100,100' cypress run --browser chrome --headed", "test:integration": "cypress run --spec 'cypress/e2e/**/*.cy.ts'", "coverage": "cross-env COVERAGE=true pnpm run test:unit && cross-env COVERAGE=true pnpm run test:components", "generate-tokens": "node scripts/system-token/convert-tokens.cjs",