Skip to content

Commit c8a3c7b

Browse files
authored
feat: bump playwright checks timeout to 20 min (#1177)
1 parent 469709a commit c8a3c7b

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

packages/cli/src/commands/pw-test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ import { Diagnostics, PlaywrightCheck, RuntimeCheck, Session } from '../construc
1717
import { Flags } from '@oclif/core'
1818
import { createReporters, ReporterType } from '../reporters/reporter'
1919
import TestRunner from '../services/test-runner'
20-
import { DEFAULT_CHECK_RUN_TIMEOUT_SECONDS, Events, SequenceId } from '../services/abstract-check-runner'
20+
import {
21+
DEFAULT_CHECK_RUN_TIMEOUT_SECONDS,
22+
DEFAULT_PLAYWRIGHT_CHECK_RUN_TIMEOUT_SECONDS,
23+
Events,
24+
SequenceId,
25+
} from '../services/abstract-check-runner'
2126
import { TestResultsShortLinks } from '../rest/test-sessions'
2227
import commonMessages from '../messages/common-messages'
2328
import type { Region } from '..'
@@ -59,7 +64,7 @@ export default class PwTestCommand extends AuthCommand {
5964
exclusive: ['env'],
6065
}),
6166
'timeout': Flags.integer({
62-
default: DEFAULT_CHECK_RUN_TIMEOUT_SECONDS,
67+
default: DEFAULT_PLAYWRIGHT_CHECK_RUN_TIMEOUT_SECONDS,
6368
description: 'A timeout (in seconds) to wait for checks to complete.',
6469
}),
6570
'verbose': Flags.boolean({

packages/cli/src/services/abstract-check-runner.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export type CheckRunId = string
3838
export type SequenceId = string
3939

4040
export const DEFAULT_CHECK_RUN_TIMEOUT_SECONDS = 600
41+
export const DEFAULT_PLAYWRIGHT_CHECK_RUN_TIMEOUT_SECONDS = 1200
4142

4243
const DEFAULT_SCHEDULING_DELAY_EXCEEDED_MS = 20000
4344

@@ -197,10 +198,13 @@ export default abstract class AbstractCheckRunner extends EventEmitter {
197198
}
198199

199200
private setAllTimeouts () {
200-
Array.from(this.checks.entries()).forEach(([sequenceId, { check }]) =>
201+
Array.from(this.checks.entries()).forEach(([sequenceId, { check }]) => {
202+
const checkTimeout = (check instanceof PlaywrightCheck && this.timeout === DEFAULT_CHECK_RUN_TIMEOUT_SECONDS)
203+
? DEFAULT_PLAYWRIGHT_CHECK_RUN_TIMEOUT_SECONDS
204+
: this.timeout
201205
this.timeouts.set(sequenceId, setTimeout(() => {
202206
this.timeouts.delete(sequenceId)
203-
let errorMessage = `Reached timeout of ${this.timeout} seconds waiting for check result.`
207+
let errorMessage = `Reached timeout of ${checkTimeout} seconds waiting for check result.`
204208
// Playwright checks can take longer.
205209
// We should point the user to the --timeout flag in that case.
206210
if (check instanceof PlaywrightCheck) {
@@ -212,8 +216,9 @@ export default abstract class AbstractCheckRunner extends EventEmitter {
212216
}
213217
this.emit(Events.CHECK_FAILED, sequenceId, check, errorMessage)
214218
this.emit(Events.CHECK_FINISHED, check)
215-
}, this.timeout * 1000),
216-
))
219+
}, checkTimeout * 1000),
220+
)
221+
})
217222
}
218223

219224
private disableAllTimeouts () {

0 commit comments

Comments
 (0)