Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Set global timeout conditionally #229

Merged
merged 1 commit into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/playwright-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
if (!xmlData) {
return;
}
let result = convert.xml2js(xmlData, {compact: true}) as any;

Check warning on line 37 in src/playwright-runner.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
if (!result.testsuites || !result.testsuites.testsuite) {
return;
}
Expand All @@ -43,14 +43,14 @@
result.testsuites.testsuite = [result.testsuites.testsuite];
}

const testsuites: any[] = [];

Check warning on line 46 in src/playwright-runner.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
let totalTests = 0;
let totalErrs = 0;
let totalFailures = 0;
let totalSkipped = 0;
let totalTime = 0;
for (let i = 0; i < result.testsuites.testsuite.length; i++) {
const testsuite = result.testsuites.testsuite[i] as any;

Check warning on line 53 in src/playwright-runner.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
if (testsuite._attributes) {
totalTests += +testsuite._attributes.tests || 0;
totalFailures += +testsuite._attributes.failures || 0;
Expand Down Expand Up @@ -227,10 +227,6 @@
playwrightBin, 'test'
];

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

// There is a conflict if the playwright project has a `browser` defined,
Expand Down
6 changes: 6 additions & 0 deletions src/sauce.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 6 additions & 0 deletions src/sauce.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down