test: view loading slow on mac

This commit is contained in:
linonetwo 2026-02-04 21:06:11 +08:00
parent f1aea3ca97
commit 3048fd8901
4 changed files with 17 additions and 25 deletions

View file

@ -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'],

View file

@ -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');
});

View file

@ -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);

View file

@ -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