From 6783015605c43ee4d010e9c85f12051b2ad7702b Mon Sep 17 00:00:00 2001 From: Alex Plischke Date: Wed, 30 Aug 2023 15:25:44 -0700 Subject: [PATCH] Set global timeout conditionally --- src/playwright-runner.ts | 4 ---- src/sauce.config.cjs | 6 ++++++ src/sauce.config.mjs | 6 ++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/playwright-runner.ts b/src/playwright-runner.ts index 22cdd9f3..6bed3891 100644 --- a/src/playwright-runner.ts +++ b/src/playwright-runner.ts @@ -227,10 +227,6 @@ async function runPlaywright(nodeBin: string, runCfg: RunnerConfig): Promise = _.defaultsDeep(defaultArgs, utils.replaceLegacyKeys(suite.param)); // There is a conflict if the playwright project has a `browser` defined, diff --git a/src/sauce.config.cjs b/src/sauce.config.cjs index d2f687e5..f03dcc61 100644 --- a/src/sauce.config.cjs +++ b/src/sauce.config.cjs @@ -26,6 +26,12 @@ for (const file of configFiles) { } } +// Set a default timeout of 30 minutes if one is not provided. This protects +// against tests that hang and never finish. +if (!userConfig.globalTimeout) { + userConfig.globalTimeout = 1000 * 60 * 30; // 30 minutes +} + const overrides = { use: { headless: process.env.HEADLESS === 'true', diff --git a/src/sauce.config.mjs b/src/sauce.config.mjs index 401b7bb4..fb0f30c4 100644 --- a/src/sauce.config.mjs +++ b/src/sauce.config.mjs @@ -27,6 +27,12 @@ for (const file of configFiles) { } } +// Set a default timeout of 30 minutes if one is not provided. This protects +// against tests that hang and never finish. +if (!userConfig.globalTimeout) { + userConfig.globalTimeout = 1000 * 60 * 30; // 30 minutes +} + const overrides = { use: { headless: process.env.HEADLESS === 'true',