cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.87k stars 3.17k forks source link

Missing browserCriClient in connectToNewSpec #27657

Closed joshkaplan closed 4 months ago

joshkaplan commented 1 year ago

Current behavior

Sometimes when running tests (in CD, in docker), cypress simply fails.

We see:

Timed out waiting for the browser to connect. Retrying...
Error: Missing browserCriClient in connectToNewSpec

And then cypress.run returns:

{
  "failures": 1,
  "message": "Could not find Cypress test run results"
}

Notes:

Desired behavior

tests to run without crashing (or some indication of what is being done incorrectly)

Test code to reproduce

unsure how to reliably reproduce. most projects run fine most of the time.

Cypress Version

12.17.3

Node version

16.20.0

Operating System

Linux / docker

Debug Logs

No response

Other

Looks like the same problem as https://github.com/cypress-io/cypress/issues/27241 and https://github.com/cypress-io/cypress/issues/24650

joshkaplan commented 1 year ago

here's a couple of snippets from the debug output with DEBUG=cypress*

can't share the entire thing here, since it's huge and contains sensitive info. if there are select modules we should capture, could try that.

note that "sem-pages" is the 2nd spec in this project

2023-08-25T20:53:31.876Z cypress:server:run spec results { [REDACTED] }
2023-08-25T20:53:31.877Z cypress:server:run about to run spec { spec: { fileExtension: '.ts', baseName: 'sem-pages.test.ts', fileName: 'sem-pages', specFileExtension: '.test.ts', relativeToCommonRoot: 'sem-pages.test.ts', specType: 'integration', name: 'integration/sem-pages.test.ts', relative: 'integration/sem-pages.test.ts', absolute: '/pokey/tests/frontend/editorial-pages/cypress/integration/sem-pages.test.ts' }, isHeadless: true, browser: { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '106.0.5249.119', path: 'google-chrome', minSupportedVersion: 64, majorVersion: '106', isHeadless: true, isHeaded: false } }
2023-08-25T20:53:31.877Z cypress:server:run created videoRecording { videoRecording: { api: { onError: [Function (anonymous)], videoName: '/pokey/tests/frontend/editorial-pages/cypress/cypress/videos/sem-pages.test.ts.mp4', compressedVideoName: '/pokey/tests/frontend/editorial-pages/cypress/cypress/videos/sem-pages.test.ts-compressed.mp4', useFfmpegVideoController: [AsyncFunction: useFfmpegVideoController], useVideoController: [Function: useVideoController], onProjectCaptureVideoFrames: [Function: onProjectCaptureVideoFrames] }, controller: undefined } }
2023-08-25T20:53:31.877Z cypress:server:run waiting for socket to connect and browser to launch...
2023-08-25T20:53:31.877Z cypress:server:run waiting for socket connection... { id: '9n454ipst4' }
2023-08-25T20:53:31.877Z cypress:server:open_project resetting project state, preparing to launch browser chrome for spec { fileExtension: '.ts', baseName: 'sem-pages.test.ts', fileName: 'sem-pages', specFileExtension: '.test.ts', relativeToCommonRoot: 'sem-pages.test.ts', specType: 'integration', name: 'integration/sem-pages.test.ts', relative: 'integration/sem-pages.test.ts', absolute: '/pokey/tests/frontend/editorial-pages/cypress/integration/sem-pages.test.ts' } options { projectRoot: '/pokey/tests/frontend/editorial-pages/cypress', shouldLaunchNewTab: true, onError: [Function (anonymous)], videoApi: { onError: [Function (anonymous)], videoName: '/pokey/tests/frontend/editorial-pages/cypress/cypress/videos/sem-pages.test.ts.mp4', compressedVideoName: '/pokey/tests/frontend/editorial-pages/cypress/cypress/videos/sem-pages.test.ts-compressed.mp4', useFfmpegVideoController: [AsyncFunction: useFfmpegVideoController], useVideoController: [Function: useVideoController], onProjectCaptureVideoFrames: [Function: onProjectCaptureVideoFrames] }, automationMiddleware: { onBeforeRequest: [Function: onBeforeRequest], onAfterResponse: [Function: onAfterResponse] }, onWarning: [Function: onWarning] }
2023-08-25T20:53:31.878Z cypress:server:project resetting project instance /pokey/tests/frontend/editorial-pages/cypress
2023-08-25T20:53:31.878Z cypress:proxy:http:util:buffers resetting buffers
2023-08-25T20:53:31.879Z cypress:server:open_project launching browser: { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '106.0.5249.119', path: 'google-chrome', minSupportedVersion: 64, majorVersion: '106', isHeadless: true, isHeaded: false }, spec: integration/sem-pages.test.ts
2023-08-25T20:53:31.879Z cypress:server:browsers getBrowserLauncher { browser: { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '106.0.5249.119', path: 'google-chrome', minSupportedVersion: 64, majorVersion: '106', isHeadless: true, isHeaded: false } }
2023-08-25T20:53:31.879Z cypress-verbose:packherd:trace Module._load "./chrome"
2023-08-25T20:53:31.879Z cypress-verbose:packherd:trace Loaded "/pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/packages/server/lib/browsers/chrome.ts" (module-fullpath:node | Module._cache) -> moduleCache: 901, exportsCache: 3760, loaded: 900
2023-08-25T20:53:31.879Z cypress-verbose:packherd:trace Resolved "./chrome" via module-fullpath:node (packages/server/lib/browsers/chrome.ts | /pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/packages/server/lib/browsers/chrome.ts)
2023-08-25T20:53:31.880Z cypress:server:browsers:chrome connecting to new chrome tab in existing instance with url and debugging port {
  url: 'https://www.[REDACTED].com/__/#/specs/runner?file=integration/sem-pages.test.ts'
}
2023-08-25T20:53:31.880Z cypress:server:browsers:cri-client registering CDP on event { eventName: 'Inspector.targetCrashed' }
2023-08-25T20:53:31.880Z cypress:server:browsers:chrome attaching listeners to chrome { url: 'https://www.[REDACTED].com/__/#/specs/runner?file=integration/sem-pages.test.ts', options: { onInitializeNewBrowserTab: [AsyncFunction: s], browser: { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '106.0.5249.119', path: 'google-chrome', minSupportedVersion: 64, majorVersion: '106', isHeadless: true, isHeaded: false }, url: 'https://www.[REDACTED].com/__/#/specs/runner?file=integration/sem-pages.test.ts', browsers: [ [Object], [Object] ], userAgent: 'Cypress bot', proxyUrl: 'http://localhost:40607', proxyServer: 'http://localhost:40607', socketIoRoute: '/__socket', chromeWebSecurity: false, isTextTerminal: true, downloadsFolder: '/pokey/tests/frontend/editorial-pages/cypress/cypress/downloads', experimentalModifyObstructiveThirdPartyCode: false, experimentalWebKitSupport: false, projectRoot: '/pokey/tests/frontend/editorial-pages/cypress', shouldLaunchNewTab: true, onError: [Function (anonymous)], videoApi: { onError: [Function (anonymous)], videoName: '/pokey/tests/frontend/editorial-pages/cypress/cypress/videos/sem-pages.test.ts.mp4', compressedVideoName: '/pokey/tests/frontend/editorial-pages/cypress/cypress/videos/sem-pages.test.ts-compressed.mp4', useFfmpegVideoController: [AsyncFunction: useFfmpegVideoController], useVideoController: [Function: useVideoController], onProjectCaptureVideoFrames: [Function: onProjectCaptureVideoFrames] }, automationMiddleware: { onBeforeRequest: [Function: onBeforeRequest], onAfterResponse: [Function: onAfterResponse] }, onWarning: [Function: onWarning], onBrowserClose: [Function (anonymous)] } }
2023-08-25T20:53:31.880Z cypress:server:browsers:cri-client registering CDP on event { eventName: 'Network.requestWillBeSent' }
2023-08-25T20:53:31.880Z cypress:server:browsers:cri-client registering CDP on event { eventName: 'Network.responseReceived' }
2023-08-25T20:53:31.880Z cypress-verbose:server:browsers:cri-client:send:[-->] sending CDP command { id: 1, method: 'Network.enable', params: { maxTotalBufferSize: 0, maxResourceBufferSize: 0, maxPostDataSize: 0 } }
2023-08-25T20:53:31.881Z cypress-verbose:server:browsers:cri-client:recv:[<--] received CDP message { id: 1, result: {} }
2023-08-25T20:53:31.881Z cypress-verbose:server:browsers:cri-client:send:[-->] sending CDP command { id: 2, method: 'Page.enable', params: {} }
2023-08-25T20:53:31.881Z cypress-verbose:server:browsers:cri-client:recv:[<--] received CDP message { id: 2, result: {} }
2023-08-25T20:53:31.882Z cypress-verbose:server:browsers:cri-client:send:[-->] sending CDP command { id: 3, method: 'Storage.clearDataForOrigin', params: { origin: '*', storageTypes: 'all' } }
2023-08-25T20:53:31.882Z cypress-verbose:server:browsers:cri-client:send:[-->] sending CDP command { id: 4, method: 'Network.clearBrowserCache', params: {} }
2023-08-25T20:53:31.884Z cypress-verbose:server:browsers:cri-client:recv:[<--] received CDP message { id: 3, result: {} }
2023-08-25T20:53:31.885Z cypress-verbose:server:browsers:cri-client:recv:[<--] received CDP message { id: 4, result: {} }
2023-08-25T20:53:31.897Z cypress:server:video capture started { command: "ffmpeg -n 20 /pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/node_modules/@ffmpeg-installer/linux-x64/ffmpeg -f image2pipe -use_wallclock_as_timestamps 1 -i pipe:0 -y -vcodec libx264 -filter:v crop='floor(in_w/2)*2:floor(in_h/2)*2' -preset ultrafast /pokey/tests/frontend/editorial-pages/cypress/cypress/videos/sem-pages.test.ts.mp4" }
2023-08-25T20:53:31.897Z cypress:server:browsers:cri-client registering CDP on event { eventName: 'Page.downloadWillBegin' }
2023-08-25T20:53:31.897Z cypress:server:browsers:cri-client registering CDP on event { eventName: 'Page.downloadProgress' }
2023-08-25T20:53:31.897Z cypress:server:browsers:cri-client registering CDP on event { eventName: 'Page.downloadWillBegin' }
2023-08-25T20:53:31.897Z cypress:server:browsers:cri-client registering CDP on event { eventName: 'Page.downloadProgress' }
2023-08-25T20:53:31.897Z cypress-verbose:server:browsers:cri-client:send:[-->] sending CDP command { id: 5, method: 'Page.setDownloadBehavior', params: { behavior: 'allow', downloadPath: '/pokey/tests/frontend/editorial-pages/cypress/cypress/downloads' } }
2023-08-25T20:53:31.897Z cypress:server:run setting videoController for videoRecording { api: { onError: [Function (anonymous)], videoName: '/pokey/tests/frontend/editorial-pages/cypress/cypress/videos/sem-pages.test.ts.mp4', compressedVideoName: '/pokey/tests/frontend/editorial-pages/cypress/cypress/videos/sem-pages.test.ts-compressed.mp4', useFfmpegVideoController: [AsyncFunction: useFfmpegVideoController], useVideoController: [Function: useVideoController], onProjectCaptureVideoFrames: [Function: onProjectCaptureVideoFrames] }, controller: undefined }
2023-08-25T20:53:31.897Z cypress:server:browsers:cri-client registering CDP on event { eventName: 'Page.screencastFrame' }
2023-08-25T20:53:31.897Z cypress-verbose:server:browsers:cri-client:send:[-->] sending CDP command { id: 6, method: 'Page.startScreencast', params: { format: 'jpeg', everyNthFrame: 5 } }
2023-08-25T20:53:31.898Z cypress-verbose:server:browsers:cri-client:recv:[<--] received CDP message { id: 5, result: {} }
2023-08-25T20:53:31.898Z cypress-verbose:server:browsers:cri-client:recv:[<--] received CDP message { method: 'Page.screencastVisibilityChanged', params: { visible: true } }
2023-08-25T20:53:31.899Z cypress-verbose:server:browsers:cri-client:recv:[<--] received CDP message { id: 6, result: {} }
2023-08-25T20:53:31.899Z cypress:server:browsers:chrome received CRI client
2023-08-25T20:53:31.899Z cypress:server:browsers:chrome navigating to page https://www.[REDACTED].com/__/#/specs/runner?file=integration/sem-pages.test.ts
2023-08-25T20:53:31.899Z cypress-verbose:server:browsers:cri-client:send:[-->] sending CDP command { id: 7, method: 'Page.bringToFront', params: {} }
2023-08-25T20:53:31.900Z cypress-verbose:server:browsers:cri-client:recv:[<--] received CDP message { id: 7, result: {} }
2023-08-25T20:53:31.900Z cypress-verbose:server:browsers:cri-client:send:[-->] sending CDP command { id: 8, method: 'Page.navigate', params: { url: 'https://www.[REDACTED].com/__/#/specs/runner?file=integration/sem-pages.test.ts' } }
2023-08-25T20:54:28.990Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 43002 }
2023-08-25T20:54:29.030Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 43016 }
2023-08-25T20:54:29.089Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 42998 }
2023-08-25T20:54:29.461Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 42994 }
2023-08-25T20:54:29.464Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 53212 }
2023-08-25T20:54:29.464Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 42988 }

2023-08-25T20:54:31.882Z cypress:server:browsers killing browser process
2023-08-25T20:54:31.882Z cypress:server:browsers:chrome closing remote interface client
2023-08-25T20:54:31.883Z cypress:server:browsers:chrome closing chrome
2023-08-25T20:54:31.888Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 49610 }
2023-08-25T20:54:31.890Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 44854 }
2023-08-25T20:54:31.891Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 44882 }
2023-08-25T20:54:31.892Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 44802 }
2023-08-25T20:54:31.892Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 43066 }
2023-08-25T20:54:31.892Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 44866 }
2023-08-25T20:54:31.892Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 53074 }
2023-08-25T20:54:31.893Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 33994 }
2023-08-25T20:54:31.893Z cypress:server:socket-base socket-disconnecting transport close
2023-08-25T20:54:31.893Z cypress:server:socket-base socket-disconnect transport close
2023-08-25T20:54:31.913Z cypress:launcher:browsers chrome exited: { code: null, signal: 'SIGTERM' }
2023-08-25T20:54:31.930Z cypress:server:preprocessor removeFile /pokey/tests/frontend/editorial-pages/cypress/integration/experience-cards.test.ts
2023-08-25T20:54:31.930Z cypress:server:preprocessor base emitter plugin close event
2023-08-25T20:54:31.930Z cypress:server:preprocessor base emitter native close event
2023-08-25T20:54:31.930Z cypress:server:preprocessor base emitter native close event
2023-08-25T20:54:31.930Z cypress:server:browsers:chrome closing remote interface client
2023-08-25T20:54:31.930Z cypress:server:browsers browser process killed
2023-08-25T20:54:31.931Z cypress-verbose:packherd:trace Loaded "/pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/node_modules/strip-ansi/index.js" (cache | exports) -> moduleCache: 902, exportsCache: 3761, loaded: 901
2023-08-25T20:54:31.932Z cypress-verbose:packherd:trace Loaded "/pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/packages/errors/src/errorUtils.ts" (cache | exports) -> moduleCache: 903, exportsCache: 3761, loaded: 902
2023-08-25T20:54:31.932Z cypress-verbose:packherd:trace Loaded "/pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/packages/errors/src/stripIndent.ts" (cache | exports) -> moduleCache: 904, exportsCache: 3761, loaded: 903
2023-08-25T20:54:31.933Z cypress-verbose:packherd:trace Loaded "/pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/node_modules/chalk/index.js" (cache | exports) -> moduleCache: 904, exportsCache: 3761, loaded: 903
2023-08-25T20:54:31.933Z cypress-verbose:packherd:trace Loaded "/pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/packages/errors/src/errTemplate.ts" (cache | definitions) -> moduleCache: 905, exportsCache: 3761, loaded: 904
2023-08-25T20:54:31.934Z cypress-verbose:packherd:trace Loaded "/pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/node_modules/lodash/lodash.js" (cache | exports) -> moduleCache: 905, exportsCache: 3761, loaded: 904
2023-08-25T20:54:31.935Z cypress-verbose:packherd:trace Loaded "/pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/node_modules/lodash/lodash.js" (cache | exports) -> moduleCache: 905, exportsCache: 3761, loaded: 904
Timed out waiting for the browser to connect. Retrying...
2023-08-25T20:54:31.936Z cypress-verbose:packherd:trace Loaded "/pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/node_modules/chalk/index.js" (cache | exports) -> moduleCache: 905, exportsCache: 3761, loaded: 904
2023-08-25T20:54:31.936Z cypress:server:run waiting for socket to connect and browser to launch...
2023-08-25T20:54:31.936Z cypress:server:run waiting for socket connection... { id: '9n454ipst4' }
2023-08-25T20:54:31.936Z cypress:server:open_project resetting project state, preparing to launch browser chrome for spec { fileExtension: '.ts', baseName: 'sem-pages.test.ts', fileName: 'sem-pages', specFileExtension: '.test.ts', relativeToCommonRoot: 'sem-pages.test.ts', specType: 'integration', name: 'integration/sem-pages.test.ts', relative: 'integration/sem-pages.test.ts', absolute: '/pokey/tests/frontend/editorial-pages/cypress/integration/sem-pages.test.ts' } options { projectRoot: '/pokey/tests/frontend/editorial-pages/cypress', shouldLaunchNewTab: true, onError: [Function (anonymous)], videoApi: { onError: [Function (anonymous)], videoName: '/pokey/tests/frontend/editorial-pages/cypress/cypress/videos/sem-pages.test.ts.mp4', compressedVideoName: '/pokey/tests/frontend/editorial-pages/cypress/cypress/videos/sem-pages.test.ts-compressed.mp4', useFfmpegVideoController: [AsyncFunction: useFfmpegVideoController], useVideoController: [Function: useVideoController], onProjectCaptureVideoFrames: [Function: onProjectCaptureVideoFrames] }, automationMiddleware: { onBeforeRequest: [Function: onBeforeRequest], onAfterResponse: [Function: onAfterResponse] }, onWarning: [Function: onWarning] }
2023-08-25T20:54:31.936Z cypress:server:project resetting project instance /pokey/tests/frontend/editorial-pages/cypress
2023-08-25T20:54:31.936Z cypress:proxy:http:util:buffers resetting buffers
2023-08-25T20:54:31.937Z cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: 'www', domain: '[REDACTED]', tld: 'com' }
2023-08-25T20:54:31.937Z cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: 'www', domain: '[REDACTED]', tld: 'com' }
2023-08-25T20:54:31.937Z cypress:server:remote-states setting remote state { auth: undefined, origin: 'https://www.[REDACTED].com', strategy: 'http', fileServer: null, domainName: '[REDACTED].com', props: { port: '443', protocol: 'https:', subdomain: 'www', domain: '[REDACTED]', tld: 'com' } } for https://[REDACTED].com
2023-08-25T20:54:31.937Z cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: null, domain: '[REDACTED]', tld: 'com' }
2023-08-25T20:54:31.937Z cypress:server:remote-states getting remote state: { auth: undefined, origin: 'https://www.[REDACTED].com', strategy: 'http', fileServer: null, domainName: '[REDACTED].com', props: { port: '443', protocol: 'https:', subdomain: 'www', domain: '[REDACTED]', tld: 'com' } } for: https://[REDACTED].com
2023-08-25T20:54:31.937Z cypress:server:project_utils returning spec url https://www.[REDACTED].com/__/#/specs/runner?file=integration/sem-pages.test.ts
2023-08-25T20:54:31.937Z cypress:server:open_project open project url https://www.[REDACTED].com/__/#/specs/runner?file=integration/sem-pages.test.ts
2023-08-25T20:54:31.937Z cypress:server:project project has config { baseUrl: 'https://www.[REDACTED].com', supportFile: '/pokey/tests/frontend/editorial-pages/cypress/support/index.ts', specPattern: 'integration/**/*.test.ts', viewportWidth: 1400, viewportHeight: 1000, blockHosts: [ '*google-analytics.com', '*googleadservices.com', '*googletagmanager.com', '*doubleclick.net', '*google.com', '*ampcid.google.com', '*facebook.com' ], chromeWebSecurity: false, responseTimeout: 60000, defaultCommandTimeout: 8000, fixturesFolder: '/pokey/tests/frontend/editorial-pages/cypress/fixtures', supportFolder: '/pokey/tests/frontend/editorial-pages/cypress/support', retries: 3, testIsolation: false, pageLoadTimeout: 120000, userAgent: 'Cypress bot', experimentalRunAllSpecs: true, setupNodeEvents: '[Function ]', projectRoot: '/pokey/tests/frontend/editorial-pages/cypress', projectName: 'cypress', repoRoot: '/pokey/tests/frontend/editorial-pages/cypress', rawJson: { e2e: { baseUrl: 'https://hyperloop.localhost.[REDACTED].com/', supportFile: 'support/index.ts', specPattern: 'integration/**/*.test.ts', viewportWidth: 1400, viewportHeight: 1000, blockHosts: [Array], chromeWebSecurity: false, responseTimeout: 60000, defaultCommandTimeout: 8000, fixturesFolder: 'fixtures', supportFolder: 'support', retries: 3, testIsolation: false, pageLoadTimeout: 120000, userAgent: 'Cypress bot', experimentalRunAllSpecs: true, setupNodeEvents: '[Function ]' }, baseUrl: 'https://www.[REDACTED].com', supportFile: 'support/index.ts', specPattern: 'integration/**/*.test.ts', viewportWidth: 1400, viewportHeight: 1000, blockHosts: [ '*google-analytics.com', '*googleadservices.com', '*googletagmanager.com', '*doubleclick.net', '*google.com', '*ampcid.google.com', '*facebook.com' ], chromeWebSecurity: false, responseTimeout: 60000, defaultCommandTimeout: 8000, fixturesFolder: 'fixtures', supportFolder: 'support', retries: 3, testIsolation: false, pageLoadTimeout: 120000, userAgent: 'Cypress bot', experimentalRunAllSpecs: true, setupNodeEvents: '[Function ]', envFile: {}, projectRoot: '/pokey/tests/frontend/editorial-pages/cypress', projectName: 'cypress', repoRoot: '/pokey/tests/frontend/editorial-pages/cypress' }, configFile: 'cypress.config.js', morgan: false, isTextTerminal: true, socketId: '9n454ipst4', report: true, reporter: '/pokey/tests/frontend/cypress/script/pokeyReporter.js', video: true, videoCompression: false, animationDistanceThreshold: 5, arch: 'x64', clientCertificates: [], downloadsFolder: '/pokey/tests/frontend/editorial-pages/cypress/cypress/downloads', env: { UNIQUE_ID: '01H8Q6X8DR8V3CZM2WBYK0XWJH_1692996470222', KUBE_GEN_ENV: 'production', KUBE_GEN_PROJECT: 'seo-loop', JOB_NAME: 'cy-cron', LOG_PATH: '/pokey/tests/test-output.log', CACHE_FOLDER: '.cache/cypress', grepTags: '', secrets: { [REDACTED] } }, execTimeout: 60000, experimentalCspAllowList: false, experimentalFetchPolyfill: false, experimentalInteractiveRunEvents: false, experimentalMemoryManagement: false, experimentalModifyObstructiveThirdPartyCode: false, experimentalSkipDomainInjection: null, experimentalOriginDependencies: false, experimentalSourceRewriting: false, experimentalSingleTabRunMode: false, experimentalStudio: false, experimentalWebKitSupport: false, fileServerFolder: '/pokey/tests/frontend/editorial-pages/cypress', excludeSpecPattern: '*.hot-update.js', includeShadowDom: false, keystrokeDelay: 0, modifyObstructiveCode: true, nodeVersion: undefined, numTestsKeptInMemory: 0, platform: 'linux', port: 40607, projectId: null, redirectionLimit: 20, reporterOptions: null, requestTimeout: 5000, resolvedNodePath: '/usr/bin/node_real', resolvedNodeVersion: '16.20.0', screenshotOnRunFailure: true, screenshotsFolder: '/pokey/tests/frontend/editorial-pages/cypress/cypress/screenshots', slowTestThreshold: 10000, scrollBehavior: 'top', taskTimeout: 60000, trashAssetsBeforeRuns: true, videosFolder: '/pokey/tests/frontend/editorial-pages/cypress/cypress/videos', videoUploadOnPasses: true, waitForAnimations: true, watchForFileChanges: false, additionalIgnorePattern: [], autoOpen: false, browsers: [ { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '106.0.5249.119', path: 'google-chrome', minSupportedVersion: 64, majorVersion: '106' }, { name: 'electron', channel: 'stable', family: 'chromium', displayName: 'Electron', version: '106.0.5249.51', path: '', majorVersion: 106 } ], clientRoute: '/__/', cypressBinaryRoot: '/pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app', devServerPublicPathRoute: '/__cypress/src', hosts: null, isInteractive: true, namespace: '__cypress', reporterRoute: '/__cypress/reporter', socketIoCookie: '__socket', socketIoRoute: '/__socket', version: '12.17.3', cypressEnv: 'production', resolved: { animationDistanceThreshold: { value: 5, from: 'default' }, arch: { value: 'x64', from: 'default' }, baseUrl: { value: 'https://www.[REDACTED].com', from: 'env' }, blockHosts: { value: [Array], from: 'config' }, chromeWebSecurity: { value: false, from: 'config' }, clientCertificates: { value: [], from: 'default' }, defaultCommandTimeout: { value: 8000, from: 'config' }, downloadsFolder: { value: 'cypress/downloads', from: 'default' }, env: { UNIQUE_ID: [Object], KUBE_GEN_ENV: [Object], KUBE_GEN_PROJECT: [Object], JOB_NAME: [Object], LOG_PATH: [Object], CACHE_FOLDER: [Object], grepTags: [Object], secrets: [Object] }, execTimeout: { value: 60000, from: 'default' }, experimentalCspAllowList: { value: false, from: 'default' }, experimentalFetchPolyfill: { value: false, from: 'default' }, experimentalInteractiveRunEvents: { value: false, from: 'default' }, experimentalRunAllSpecs: { value: true, from: 'config' }, experimentalMemoryManagement: { value: false, from: 'default' }, experimentalModifyObstructiveThirdPartyCode: { value: false, from: 'default' }, experimentalSkipDomainInjection: { value: null, from: 'default' }, experimentalOriginDependencies: { value: false, from: 'default' }, experimentalSourceRewriting: { value: false, from: 'default' }, experimentalSingleTabRunMode: { value: false, from: 'default' }, experimentalStudio: { value: false, from: 'default' }, experimentalWebKitSupport: { value: false, from: 'default' }, fileServerFolder: { value: '', from: 'default' }, fixturesFolder: { value: 'fixtures', from: 'config' }, excludeSpecPattern: { value: '*.hot-update.js', from: 'default' }, includeShadowDom: { value: false, from: 'default' }, keystrokeDelay: { value: 0, from: 'default' }, modifyObstructiveCode: { value: true, from: 'default' }, nodeVersion: { value: undefined, from: 'default' }, numTestsKeptInMemory: { value: 0, from: 'config' }, platform: { value: 'linux', from: 'default' }, pageLoadTimeout: { value: 120000, from: 'config' }, port: { value: null, from: 'default' }, projectId: { value: null, from: 'default' }, redirectionLimit: { value: 20, from: 'default' }, reporter: { value: '/pokey/tests/frontend/cypress/script/pokeyReporter.js', from: 'cli' }, reporterOptions: { value: null, from: 'default' }, requestTimeout: { value: 5000, from: 'default' }, resolvedNodePath: { value: null, from: 'default' }, resolvedNodeVersion: { value: null, from: 'default' }, responseTimeout: { value: 60000, from: 'config' }, retries: { value: 3, from: 'config' }, screenshotOnRunFailure: { value: true, from: 'default' }, screenshotsFolder: { value: 'cypress/screenshots', from: 'default' }, slowTestThreshold: { value: 10000, from: 'default' }, scrollBehavior: { value: 'top', from: 'default' }, supportFile: { value: 'support/index.ts', from: 'config' }, supportFolder: { value: 'support', from: 'config' }, taskTimeout: { value: 60000, from: 'default' }, testIsolation: { value: false, from: 'config' }, trashAssetsBeforeRuns: { value: true, from: 'default' }, userAgent: { value: 'Cypress bot', from: 'config' }, video: { value: true, from: 'cli' }, videoCompression: { value: false, from: 'cli' }, videosFolder: { value: 'cypress/videos', from: 'default' }, videoUploadOnPasses: { value: true, from: 'default' }, viewportHeight: { value: 1000, from: 'config' }, viewportWidth: { value: 1400, from: 'config' }, waitForAnimations: { value: true, from: 'default' }, watchForFileChanges: { value: false, from: 'config' }, specPattern: { value: 'integration/**/*.test.ts', from: 'config' }, browsers: { value: [Array], from: 'runtime' }, hosts: { value: null, from: 'default' }, isInteractive: { value: true, from: 'default' } }, testingType: 'e2e', remote: {}, browser: null, specs: [], proxyUrl: 'http://localhost:40607', browserUrl: 'https://www.[REDACTED].com/__/', reporterUrl: 'https://www.[REDACTED].com/__cypress/reporter', proxyServer: 'http://localhost:40607', state: {} }
2023-08-25T20:54:31.937Z cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: null, domain: '[REDACTED]', tld: 'com' }
2023-08-25T20:54:31.937Z cypress:server:remote-states getting remote state: { auth: undefined, origin: 'https://www.[REDACTED].com', strategy: 'http', fileServer: null, domainName: '[REDACTED].com', props: { port: '443', protocol: 'https:', subdomain: 'www', domain: '[REDACTED]', tld: 'com' } } for: https://[REDACTED].com
2023-08-25T20:54:31.937Z cypress:server:open_project launching browser: { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '106.0.5249.119', path: 'google-chrome', minSupportedVersion: 64, majorVersion: '106', isHeadless: true, isHeaded: false }, spec: integration/sem-pages.test.ts
2023-08-25T20:54:31.937Z cypress:server:browsers getBrowserLauncher { browser: { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '106.0.5249.119', path: 'google-chrome', minSupportedVersion: 64, majorVersion: '106', isHeadless: true, isHeaded: false } }
2023-08-25T20:54:31.937Z cypress-verbose:packherd:trace Module._load "./chrome"
2023-08-25T20:54:31.938Z cypress-verbose:packherd:trace Loaded "/pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/packages/server/lib/browsers/chrome.ts" (module-fullpath:node | Module._cache) -> moduleCache: 905, exportsCache: 3761, loaded: 904
2023-08-25T20:54:31.938Z cypress-verbose:packherd:trace Resolved "./chrome" via module-fullpath:node (packages/server/lib/browsers/chrome.ts | /pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/packages/server/lib/browsers/chrome.ts)
2023-08-25T20:54:31.938Z cypress:server:browsers:chrome connecting to new chrome tab in existing instance with url and debugging port {
  url: 'https://www.[REDACTED].com/__/#/specs/runner?file=integration/sem-pages.test.ts'
}
2023-08-25T20:54:31.931Z cypress:webpack close /pokey/tests/frontend/editorial-pages/cypress/integration/experience-cards.test.ts
2023-08-25T20:54:31.940Z cypress:server:cypress exiting with err Error: Missing browserCriClient in connectToNewSpec
    at Object.connectToNewSpec (<embedded>:4560:46243)
    at Object.connectToNewSpec (<embedded>:4560:25729)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async v.relaunchBrowser (<embedded>:4626:397035)
2023-08-25T20:54:31.940Z cypress-verbose:packherd:trace Module._load "./errors"
2023-08-25T20:54:31.940Z cypress-verbose:packherd:trace Loaded "/pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/packages/server/lib/errors.ts" (module-fullpath:node | Module._cache) -> moduleCache: 905, exportsCache: 3761, loaded: 904
2023-08-25T20:54:31.940Z cypress-verbose:packherd:trace Resolved "./errors" via module-fullpath:node (packages/server/lib/errors.ts | /pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/packages/server/lib/errors.ts)
Missing browserCriClient in connectToNewSpec
Error: Missing browserCriClient in connectToNewSpec
    at Object.connectToNewSpec (<embedded>:4560:46243)
    at Object.connectToNewSpec (<embedded>:4560:25729)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async v.relaunchBrowser (<embedded>:4626:397035)

it's clear that cypress is killing the browser: cypress:server:browsers killing browser process, but not seeing any particular reason why, or how we can prevent it

joshkaplan commented 1 year ago

updates:

hopefully that can maybe help narrow in what might be going on.

some outstanding questions:

stfnzl commented 1 year ago

Experiencing this issue as well.

Setup:

In another project this issue does not exists. Same pipeline setup but:

Would any of the following help?

stfnzl commented 1 year ago

Quick update from my side:

Do not see any issue anymore...

Dospios commented 1 year ago

I have the same problem.

There is no stable 100% STR, the problem is only on CI, in about 10-20% of cases.

After RAM was increased, the problem began to appear a little less often, but it did not disappear completely.

I hope you solve this problem or tell a workaround, this problem makes our ci tests unstable

Dospios commented 1 year ago

Any update?

stfnzl commented 1 year ago

@Dospios I did some experimenting and it seems like that setting

export NODE_OPTIONS=--max_old_space_size=8192

did help a lot.

I also set numTestsKeptInMemory: 1 in cypress.config.js but max_old_space_size is something you want to try.

Dospios commented 1 year ago

@stfnzl I already set max_old_space_size=8192 in NODE_OPTIONS when starting cypress and in js-flags in arguments when starting chrome. numTestsKeptInMemory: 0 I also clear the memory after every third test using Cypress.automation('remote:debugger:protocol', { command: 'HeapProfiler.collectGarbage' }). The maximum memory consumption at the time of the crash does not exceed 3gb. None of this helped, unfortunately. Also, sometimes before the error Missing browserCriClient in connectToNewSpec another one began to appear - cypress:launcher:browsers chrome stderr: [1020/143746.177548:WARNING:sqlite_persistent_store_backend_base.cc(198)] Failed to post task from FlushAndNotifyInBackground@net/extras/sqlite/sqlite_persistent _store_backend_base.cc :246 to client_task_runner_.

stfnzl commented 1 year ago

@Dospios just for curiosity, do you run cypress and the web server in the same host? Meaning do you run cypress against http://localhost or against an external url?

Dospios commented 1 year ago

@stfnzl external url. For each PR, a test stand is deployed, on which autotests are run and manual testing is carried out

stfnzl commented 1 year ago

@Dospios thanks for the info. I asked 'cause we run against localhost and wanted to check if separating cypress/chrome and the webserver would have helped, but it is not the case seems like so not gonna spend time on setting it up.

I did a "stress test" on our setup by running 20 builds in azure devops which trigger 3 parallelized jobs each (~60 cypress runs) and I got 2 Missing browserCriClient in connectToNewSpec, the remaining are green.

3.3% failure rate is still too high imo... my goal is to have at least 100 consecutive stable runs (<1% failure rate)

...and the fact that cypress cloud will not report it as failure but rather as a timeout does not help either :disappointed:

abinaya-konda commented 11 months ago

any update on this? I keep getting this issue consistently while executing the last test on the CI/CD pipeline and nothing seems to fix this. It makes the test unusable!

Timed out waiting for the browser to connect. Retrying... Missing browserCriClient in connectToNewSpec Error: Missing browserCriClient in connectToNewSpec at Object.connectToNewSpec (:4496:47084) at Object.connectToNewSpec (:4496:26109) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async v.relaunchBrowser (:4562:36202) Test run failed, code 1 More information might be available above Cypress module has returned the following error message: Could not find Cypress test run results

Cypress v13.3.0 No cypress cloud. Run tests via github actions

stfnzl commented 11 months ago

We have different projects running Cypress without any issues, but the only one that is failing with Error: Missing browserCriClient in connectToNewSpec has the most tests (~250)

Do you experience the same @abinaya-konda @Dospios?

I'm thinking to split the tests in 3 or 4 groups and see if it helps or not...

Dospios commented 11 months ago

@stfnzl Also have 200+ isolated tests that run in parallel. But I noticed that the browser can crash even on 1-5 specs at the very beginning of the run. I wrote a crutch that allows you to automatically retrain the job to ci if browserCriClient is present in stdout, starting the job again in this case, but this is just a crutch, not a solution to the problem

abinaya-konda commented 11 months ago

@stfnzl - I have around 150 tests running, and it always seems to fail at the last spec file. If I skip or remove it, the issue pops up at the new last spec file. Now this happens around 80% of the tests that I have removed cypress test suite from the pipeline for now!

jazpearson commented 9 months ago

One thing that i did was to switch to using Edge as the browser. I've barely seen this issue since, whereas before the switch, we were seeing something like 30-40% of test runs fail.

timollet commented 9 months ago

Hey, I have the same issue :

Timed out waiting for the browser to connect. Retrying... Missing browserCriClient in connectToNewSpec Error: Missing browserCriClient in connectToNewSpec at Object.connectToNewSpec (:4580:46243) at Object.connectToNewSpec (:4580:25729) at process.processTicksAndRejections (node:internal/process/task_queues:96:5) at async v.relaunchBrowser (:4646:397035)

Has anyone found a solution?

polina-anisova commented 7 months ago

Experiencing this with Cypress 13.6.0, running tests in Github Actions in docker

SerdarNur commented 4 months ago

Are here any updates or solutions? @jennifer-shehane @mschile @AtofStryker

jennifer-shehane commented 4 months ago

We have gotten some DEBUG logs with more specifics that we're looking into. It looks like this error started around 11.0 in Cypress, but is maybe happening more frequently lately due to some other change.

AtofStryker commented 4 months ago

OK I am able to reproduce this. Its similar to https://github.com/cypress-io/cypress/issues/28397. The logs provided suggest that the browser is exiting mid run (I don't want to say crash because the exit code is 0). When that happens, we wait for the browser to reconnect up to 3 attempts. In this case though, since the browser closed, we closed the CRI client as well and we are able to successfully relaunch the browser, expecting the CRI client to be there, but its not so we get this error. I can reproduce it with this branch against this test suite. I will start exploring solutions shortly...

cypress-bot[bot] commented 3 months ago

Released in 13.13.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to Cypress v13.13.0, please open a new issue.