Skip to content

Commit 6783015

Browse files
author
Alex Plischke
committed
Set global timeout conditionally
1 parent e453510 commit 6783015

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/playwright-runner.ts

-4
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,6 @@ async function runPlaywright(nodeBin: string, runCfg: RunnerConfig): Promise<Run
227227
playwrightBin, 'test'
228228
];
229229

230-
// Default value for timeout (30min)
231-
if (!suite.param.globalTimeout) {
232-
suite.param.timeout = 1800000;
233-
}
234230
let args: Record<string, unknown> = _.defaultsDeep(defaultArgs, utils.replaceLegacyKeys(suite.param));
235231

236232
// There is a conflict if the playwright project has a `browser` defined,

src/sauce.config.cjs

+6
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ for (const file of configFiles) {
2626
}
2727
}
2828

29+
// Set a default timeout of 30 minutes if one is not provided. This protects
30+
// against tests that hang and never finish.
31+
if (!userConfig.globalTimeout) {
32+
userConfig.globalTimeout = 1000 * 60 * 30; // 30 minutes
33+
}
34+
2935
const overrides = {
3036
use: {
3137
headless: process.env.HEADLESS === 'true',

src/sauce.config.mjs

+6
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ for (const file of configFiles) {
2727
}
2828
}
2929

30+
// Set a default timeout of 30 minutes if one is not provided. This protects
31+
// against tests that hang and never finish.
32+
if (!userConfig.globalTimeout) {
33+
userConfig.globalTimeout = 1000 * 60 * 30; // 30 minutes
34+
}
35+
3036
const overrides = {
3137
use: {
3238
headless: process.env.HEADLESS === 'true',

0 commit comments

Comments
 (0)