mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-03 21:40:28 -05:00
Attempt to fix
This commit is contained in:
@@ -1195,7 +1195,6 @@ jobs:
|
||||
browser: chrome
|
||||
package: launchpad
|
||||
type: ct
|
||||
debug: cypress:*,engine:socket
|
||||
|
||||
run-launchpad-integration-tests-chrome:
|
||||
<<: *defaults
|
||||
|
||||
@@ -1046,11 +1046,16 @@ module.exports = {
|
||||
return this.currentWriteVideoFrameCallback(...arguments)
|
||||
},
|
||||
|
||||
waitForBrowserToConnect (options = {}, shouldLaunchBrowser = true) {
|
||||
waitForBrowserToConnect (options = {}, isFirstSpec = false) {
|
||||
const { project, socketId, timeout, onError, writeVideoFrame, spec } = options
|
||||
const browserTimeout = process.env.CYPRESS_INTERNAL_BROWSER_CONNECT_TIMEOUT || timeout || 60000
|
||||
let attempts = 0
|
||||
|
||||
const shouldLaunchBrowser = project.shouldLaunchBrowser || isFirstSpec
|
||||
|
||||
// Reset to e2e only once we've gotten the state for this run
|
||||
project.shouldLaunchBrowser = options.testingType === 'e2e'
|
||||
|
||||
// short circuit current browser callback so that we
|
||||
// can rewire it without relaunching the browser
|
||||
if (writeVideoFrame) {
|
||||
@@ -1081,6 +1086,12 @@ module.exports = {
|
||||
return Promise.resolve(this.navigateToNextSpec(options.spec))
|
||||
}
|
||||
|
||||
if (!project.shouldLaunchBrowser) {
|
||||
project.on('socket:disconnect', () => {
|
||||
project.shouldLaunchBrowser = true
|
||||
})
|
||||
}
|
||||
|
||||
return Promise.join(
|
||||
this.waitForSocketConnection(project, socketId)
|
||||
.tap(() => {
|
||||
@@ -1406,6 +1417,8 @@ module.exports = {
|
||||
runSpec (config, spec = {}, options = {}, estimated, firstSpec) {
|
||||
const { project, browser, onError } = options
|
||||
|
||||
project.shouldLaunchBrowser = options.testingType === 'e2e'
|
||||
|
||||
const { isHeadless } = browser
|
||||
|
||||
debug('about to run spec %o', {
|
||||
@@ -1464,7 +1477,7 @@ module.exports = {
|
||||
socketId: options.socketId,
|
||||
webSecurity: options.webSecurity,
|
||||
projectRoot: options.projectRoot,
|
||||
}, options.testingType === 'e2e' || firstSpec),
|
||||
}, firstSpec),
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
@@ -611,6 +611,11 @@ export class ProjectBase<TServer extends Server> extends EE {
|
||||
this.emit('socket:connected', id)
|
||||
},
|
||||
|
||||
onDisconnect: () => {
|
||||
debug('socket:disconnect')
|
||||
this.emit('socket:disconnect')
|
||||
},
|
||||
|
||||
onTestsReceivedAndMaybeRecord: async (runnables: unknown[], cb: () => void) => {
|
||||
debug('received runnables %o', runnables)
|
||||
|
||||
|
||||
@@ -146,6 +146,7 @@ export class SocketBase {
|
||||
onTestsReceivedAndMaybeRecord () {},
|
||||
onMocha () {},
|
||||
onConnect () {},
|
||||
onDisconnect () {},
|
||||
onRequest () {},
|
||||
onResolveUrl () {},
|
||||
onFocusTests () {},
|
||||
@@ -186,7 +187,10 @@ export class SocketBase {
|
||||
|
||||
const getFixture = (path, opts) => fixture.get(config.fixturesFolder, path, opts)
|
||||
|
||||
this.io.on('connection', (socket: Socket & { inReporterRoom?: boolean }) => {
|
||||
this.io.on('connection', (socket: Socket & {
|
||||
inRunnerRoom?: boolean
|
||||
inReporterRoom?: boolean
|
||||
}) => {
|
||||
debug('socket connected')
|
||||
|
||||
socket.on('disconnecting', (reason) => {
|
||||
@@ -195,6 +199,7 @@ export class SocketBase {
|
||||
|
||||
socket.on('disconnect', (reason) => {
|
||||
debug(`socket-disconnect ${reason}`)
|
||||
options.onDisconnect(reason)
|
||||
})
|
||||
|
||||
socket.on('error', (err) => {
|
||||
|
||||
@@ -45,6 +45,7 @@ export const ENV_VARS = {
|
||||
interface GulpGlobalVals {
|
||||
debug?: Maybe<'--inspect' | '--inspect-brk'>
|
||||
shouldWatch?: boolean
|
||||
mode?: 'open' | 'run-ct'
|
||||
}
|
||||
|
||||
const globalVals: GulpGlobalVals = {
|
||||
|
||||
@@ -77,6 +77,17 @@ gulp.task(
|
||||
),
|
||||
)
|
||||
|
||||
gulp.task(
|
||||
'debug:run',
|
||||
gulp.series(
|
||||
async function setupDebugRun () {
|
||||
setGulpGlobal('debug', '--inspect')
|
||||
setGulpGlobal('mode', 'run-ct')
|
||||
},
|
||||
'dev',
|
||||
),
|
||||
)
|
||||
|
||||
gulp.task(
|
||||
'debugBrk',
|
||||
gulp.series(
|
||||
|
||||
@@ -142,6 +142,7 @@ async function spawnCypressWithMode (
|
||||
*------------------------------------------------------------------------**/
|
||||
|
||||
export async function startCypressWatch () {
|
||||
const mode = getGulpGlobal('mode') ?? 'open'
|
||||
const watcher = chokidar.watch([
|
||||
'packages/{graphql,data-context}/src/**/*.{js,ts}',
|
||||
'packages/server/lib/graphql/**/*.{js,ts}',
|
||||
@@ -156,7 +157,7 @@ export async function startCypressWatch () {
|
||||
let child: ChildProcess | null = null
|
||||
|
||||
async function startCypressWithListeners () {
|
||||
child = await spawnCypressWithMode('open', 'dev', ENV_VARS.DEV)
|
||||
child = await spawnCypressWithMode(mode, 'dev', ENV_VARS.DEV)
|
||||
|
||||
child.on('exit', (code) => {
|
||||
if (isClosing) {
|
||||
|
||||
Reference in New Issue
Block a user