diff --git a/features/cucumber.config.js b/features/cucumber.config.js index 3f9bc5ec..baf89369 100644 --- a/features/cucumber.config.js +++ b/features/cucumber.config.js @@ -1,15 +1,7 @@ -const isCI = Boolean(process.env.CI); - -// Debug: Log CI detection for troubleshooting timeout issues -console.log('[Cucumber Config] CI environment variable:', process.env.CI); -console.log('[Cucumber Config] isCI:', isCI); -console.log('[Cucumber Config] Timeout will be:', isCI ? 25000 : 5000, 'ms'); - module.exports = { default: { require: [ 'ts-node/register', - 'features/supports/timeout-config.ts', // Must be loaded first to set global timeout 'features/stepDefinitions/**/*.ts', ], requireModule: ['ts-node/register'], diff --git a/features/stepDefinitions/browserView.ts b/features/stepDefinitions/browserView.ts index ebb9f964..9abcbc0b 100644 --- a/features/stepDefinitions/browserView.ts +++ b/features/stepDefinitions/browserView.ts @@ -18,7 +18,7 @@ import type { ApplicationWorld } from './application'; const BACKOFF_OPTIONS = { numOfAttempts: 10, startingDelay: 100, - timeMultiple: 2, + timeMultiple: 1.5, }; Then('I should see {string} in the browser view content', async function(this: ApplicationWorld, expectedText: string) { @@ -87,7 +87,7 @@ Then('the browser view should be loaded and visible', async function(this: Appli throw new Error('Browser view not loaded'); } }, - { ...BACKOFF_OPTIONS, numOfAttempts: 30 }, + { numOfAttempts: 10, startingDelay: 1000, timeMultiple: 1.1 }, ).catch(() => { throw new Error('Browser view is not loaded or visible after multiple attempts'); }); diff --git a/features/supports/timeout-config.ts b/features/supports/timeout-config.ts deleted file mode 100644 index c82d0181..00000000 --- a/features/supports/timeout-config.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { setDefaultTimeout } from '@cucumber/cucumber'; - -const isCI = Boolean(process.env.CI); - -// Set global timeout for all steps and hooks -// Local: 5s, CI: 25s -const globalTimeout = isCI ? 25000 : 5000; - -console.log('[Timeout Config] Setting global timeout to:', globalTimeout, 'ms (CI:', isCI, ')'); - -setDefaultTimeout(globalTimeout); diff --git a/features/supports/timeouts.ts b/features/supports/timeouts.ts index d375d4d3..fbd8b4d5 100644 --- a/features/supports/timeouts.ts +++ b/features/supports/timeouts.ts @@ -1,3 +1,17 @@ +import { setDefaultTimeout } from '@cucumber/cucumber'; + +const isCI = Boolean(process.env.CI); +const isMac = process.platform === 'darwin'; + +// Set global timeout for all steps and hooks +// Local: 5s (10s on macOS), CI: 25s +// macOS needs longer timeout for browser view loading +const globalTimeout = isCI ? 25000 : (isMac ? 10000 : 5000); + +console.log('[Timeout Config] Setting global timeout to:', globalTimeout, 'ms (CI:', isCI, ', macOS:', isMac, ')'); + +setDefaultTimeout(globalTimeout); + /** * Centralized timeout configuration for E2E tests * @@ -13,14 +27,11 @@ * not a timeout that should be increased. */ -const isCI = Boolean(process.env.CI); - /** * Timeout for Playwright waitForSelector and similar operations * These are internal timeouts for finding elements, not Cucumber step timeouts - * Local: 5s, CI: 25s */ -export const PLAYWRIGHT_TIMEOUT = isCI ? 25000 : 5000; +export const PLAYWRIGHT_TIMEOUT = globalTimeout; /** * Shorter timeout for operations that should be very fast