Skip to content

Commit

Permalink
hard code timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanthemanuel committed May 14, 2024
1 parent f14a11a commit 4d80ef8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/server/lib/modes/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,12 @@ async function listenForProjectEnd (project: ProjectBase, exit: boolean): Promis
})
}

let firstTime = true

async function waitForBrowserToConnect (options: { project: Project, socketId: string, onError: (err: Error) => void, spec: SpecWithRelativeRoot, isFirstSpecInBrowser: boolean, testingType: string, experimentalSingleTabRunMode: boolean, browser: Browser, screenshots: ScreenshotMetadata[], projectRoot: string, shouldLaunchNewTab: boolean, webSecurity: boolean, videoRecording?: VideoRecording, protocolManager?: ProtocolManager }) {
if (globalThis.CY_TEST_MOCK?.waitForBrowserToConnect) return Promise.resolve()

const { project, socketId, onError, spec, browser, protocolManager } = options
const browserTimeout = Number(process.env.CYPRESS_INTERNAL_BROWSER_CONNECT_TIMEOUT || 60000)
let browserLaunchAttempt = 1

// without this the run mode is only setting new spec
Expand Down Expand Up @@ -487,11 +488,12 @@ async function waitForBrowserToConnect (options: { project: Project, socketId: s
// TODO: remove the need to extend options and coerce this type
launchBrowser(options as typeof options & { setScreenshotMetadata: SetScreenshotMetadata }),
])
.timeout(browserTimeout)
.timeout(firstTime ? 1000 : 5000)
.then(() => {
telemetry.getSpan(`waitForBrowserToConnect:attempt:${browserLaunchAttempt}`)?.end()
})
.catch(Bluebird.TimeoutError, async (err) => {
firstTime = false
telemetry.getSpan(`waitForBrowserToConnect:attempt:${browserLaunchAttempt}`)?.end()
console.log('')

Expand Down

0 comments on commit 4d80ef8

Please sign in to comment.