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

cypress run times out waiting for the browser to connect #3310

Closed
achelonmm opened this issue Feb 4, 2019 · 72 comments
Closed

cypress run times out waiting for the browser to connect #3310

achelonmm opened this issue Feb 4, 2019 · 72 comments
Labels
CI General issues involving running in a CI provider prevent-stale mark an issue so it is ignored by stale[bot]

Comments

@achelonmm
Copy link

achelonmm commented Feb 4, 2019

Current behavior:

I have an automated release for my test suite. It consists of 8 specs that are executed one after the other.

A few weeks back, one of the specs got stuck and I had to force a shutdown of the release. After that, on every release, after the first spec is run, Cypress fails to open the browser or find it or something and the tests fail.

This is the error I'm getting:

2019-02-04T02:11:09.1221261Z Timed out waiting for the browser to connect. Retrying...
2019-02-04T02:11:39.1105823Z 
2019-02-04T02:11:39.4465327Z Timed out waiting for the browser to connect. Retrying again...
2019-02-04T02:12:09.4535443Z 
2019-02-04T02:12:10.1352111Z The browser never connected. Something is wrong. The tests cannot run. Aborting...

I have deleted the Virtual Machine I use for the test and created it again, changed versions of Chrome, changed versions of Cypress and nothing changes.
If I enter the VM with the release user, and use the command manually on a command line, it works, but in the automated release doesn't.

I'm currently out of ideas.

Desired behavior:

Every spec should run correctly as it did before

Versions

Cypress 3.1.4 and 3.1.5
Chrome 72.0.3626
VSTS for release automation

@jennifer-shehane
Copy link
Member

Is there any way to clear the App Data or maybe uninstall / reinstall Cypress altogether?

@jennifer-shehane jennifer-shehane added CI: VSTS stage: needs information Not enough info to reproduce the issue labels Feb 21, 2019
@achelonmm
Copy link
Author

Is there any way to clear the App Data or maybe uninstall / reinstall Cypress altogether?

We did. We uninstalled and reinstalled and then uninstalled again and installed previous version.
After that we uninstalled and reinstalled.
We even deleted the VM and created it again new, and nothing changed.

@jennifer-shehane
Copy link
Member

Are these tests able to run when opened in Electron locally?

Could you provide the test code - for spec 1 + spec 2?

Likely something changed a few weeks ago that is causing this.

@achelonmm
Copy link
Author

achelonmm commented Feb 22, 2019

If I run them locally, they open both in Electron and in Chrome.
In fact, if I enter the VM and run the same command manually it works.

import { documentManagementModule } from "../../id-collection"

const setDate = (datePicker, date) => { 
    datePicker.wait(3000)
               
    let dels = '{selectall}{del}';

    datePicker.type('${dels}${date}')
    cy.wait(4000)
}

describe('Document Management - Search Document', function () {
    after(function() {
        cy.reload(true)

        cy.url()
            .should('contain',Cypress.env('url_base_comparar'))

        cy.get(documentManagementModule.common.user_badge_topmenu)
            .click()
        
        cy.get(documentManagementModule.common.user_badge_popup)
            .should('exist')
            
        cy.get(documentManagementModule.common.user_badge_logout)
            .click()
            .wait(2000)
    })

    it('TC1163 - check functionality of Document List button', function () {
        cy.reload(true)
        
        cy.get(documentManagementModule.DMcommon.menu_item_UploadDocument)
            .should('be.visible')

        cy.get(documentManagementModule.DMcommon.menu_item_UploadDocument)
            .click()

        cy.get(documentManagementModule.searchDocument.patientSearch)
            .should('be.visible')

        cy.url()
            .should('contain', 'new')
            
        cy.get(documentManagementModule.DMcommon.menu_item_ListDocuments)
            .should('be.visible')
        
        cy.get(documentManagementModule.DMcommon.menu_item_ListDocuments)
            .click()
        
        cy.url()
            .should('contain','search')
    })

    it('TC1205 - check there are no documents when page loads and the filter window is open', function () {
        cy.visit('app/search')
        
        cy.get('body')
            .type('{esc}',{force:true})
            
        cy.get(documentManagementModule.searchDocument.noResults)
            .should('exist')
    })

    it('TC1207 - check functionality of select all', function () {
        cy.visit('app/search')

        cy.get('body')
            .type('{esc}',{force:true})
            
        cy.get(documentManagementModule.searchDocument.noResults)
            .should('exist')

        cy.get(documentManagementModule.searchDocument.medicalServices_Input)
            .wait(4000)
            .type('cardio{enter}',{ force: true })
        
        cy.get(documentManagementModule.searchDocument.searchButton)
            .click()

        cy.get(documentManagementModule.searchDocument.results_list)
            .should('contain','CARDIOLOGÍA')

        cy.get(documentManagementModule.searchDocument.selectCounter)
            .should('contain','0')

        cy.get(documentManagementModule.searchDocument.selectAll)
            .click({force:true})

        cy.get(documentManagementModule.searchDocument.selectCounter)
            .should('contain','52')
    })
    
    it('TC1206 - chech functionality of filter button', function () {
        cy.visit('app/search')

        cy.get(documentManagementModule.searchDocument.patientSearchComponent)
            .should('exist')

        cy.get(documentManagementModule.searchDocument.btnFilters)
            .click()

        cy.get(documentManagementModule.searchDocument.patientSearchComponent)
            .should('not.exist')

        cy.get(documentManagementModule.searchDocument.btnFilters)
            .click()

        cy.get(documentManagementModule.searchDocument.patientSearchComponent)
            .should('exist')
    })

    it('TC1184 - search by patient', function () {
        cy.visit('app/search')

        cy.get(documentManagementModule.searchDocument.patientSearchComponent)
            .type(Cypress.env('patient'),{ force: true })

        cy.get(documentManagementModule.searchDocument.patient_search_result)
            .should('contain',Cypress.env('patient'))
            .click()
        
        cy.get(documentManagementModule.searchDocument.searchButton)
            .click()

        cy.get(documentManagementModule.searchDocument.results_list)
            .should('contain',Cypress.env('patient'))
    })

    it('TC1185 - search by issuer', function () {
        cy.visit('app/search')

        cy.get(documentManagementModule.searchDocument.issuers_Input)
            .wait(4000)
            .type('adeslas{enter}{esc}')
        
        cy.get(documentManagementModule.searchDocument.searchButton)
            .click()

        cy.get(documentManagementModule.searchDocument.results_list)
            .should('not.contain','Sin resul')
    })

    it('TC1203 - search by document date', function () {
        cy.visit('app/search')

        setDate(cy.get(documentManagementModule.searchDocument.documentDateStart), '01/01/2018')

        cy.get(documentManagementModule.searchDocument.helper_documentDateEnd)
            .should('contain','rellenar también')

        setDate(cy.get(documentManagementModule.searchDocument.documentDateEnd), '01/01/2017')

        cy.get(documentManagementModule.searchDocument.helper_documentDateEnd)
            .should('contain','debe ser mayor')
        
        setDate(cy.get(documentManagementModule.searchDocument.documentDateEnd), '07/11/2018')

        cy.get(documentManagementModule.searchDocument.searchButton)
            .click()

        cy.get(documentManagementModule.searchDocument.results_list)
            .should('contain','07/11/2018')
    })

    it('TC1204 - search by publish date', function () {    
        cy.visit('app/search')

        setDate(cy.get(documentManagementModule.searchDocument.publishedDateStart), '01/01/2018')

        cy.get(documentManagementModule.searchDocument.helper_publishedDateEnd)
            .should('contain','rellenar también')

        setDate(cy.get(documentManagementModule.searchDocument.publishedDateEnd), '01/01/2017')

        cy.get(documentManagementModule.searchDocument.helper_publishedDateEnd)
            .should('contain','debe ser mayor')
        
        setDate(cy.get(documentManagementModule.searchDocument.publishedDateEnd), '07/11/2018')

        cy.get(documentManagementModule.searchDocument.searchButton)
            .click()

        cy.get(documentManagementModule.searchDocument.results_list)
            .should('contain','07/11/2018')
    })

    it('TC1186 - search by medical services', function () {
        cy.visit('app/search')

        cy.get(documentManagementModule.searchDocument.medicalServices_Input)
            .wait(4000)
            .debug()
            .type('admi{enter}alerg{enter}qui{enter}{esc}')

        cy.get(documentManagementModule.searchDocument.medicalServices_Values)
            .should('contain','3 seleccionados')     

        cy.get(documentManagementModule.searchDocument.documentName)
            .click()

        cy.get(documentManagementModule.searchDocument.medicalServices_Input)
            .type('qui{enter}alerg{enter}{esc}')

        cy.get(documentManagementModule.searchDocument.medicalServices_Values)
            .should('contain','ADMISIONP')
        
        cy.get(documentManagementModule.searchDocument.searchButton)
            .click()
            
        cy.get(documentManagementModule.searchDocument.results_list)
            .should('contain','ADMISIÓN')
    })

    it('TC1187 - search by document name', function () {
        cy.visit('app/search')

        cy.get(documentManagementModule.searchDocument.documentName)
            .type('UDA',{ force: true })
        
        cy.get(documentManagementModule.searchDocument.searchButton)
            .click()

        cy.get(documentManagementModule.searchDocument.helper_documentName)
            .should('contain','al menos 4')

        cy.get(documentManagementModule.searchDocument.documentName)
            .clear()

        cy.get(documentManagementModule.searchDocument.documentName)
            .type('BUDA',{ force: true })

        cy.get(documentManagementModule.searchDocument.searchButton)
            .click()

        cy.get(documentManagementModule.searchDocument.results_list)
            .should('not.contain','Sin resultados')
    })

    it('TC1217 - search by category', function () {
        cy.visit('app/search')

        cy.get(documentManagementModule.searchDocument.categories_Input)
            .wait(4000)
            .type('tipos{enter}acre{enter}ident{enter}local{enter}{esc}')

        cy.get(documentManagementModule.searchDocument.categories_Values)
            .should('contain','4 seleccionados')   

        cy.get(documentManagementModule.searchDocument.documentTypes_Input)
            .type('empa{enter}{esc}')
        
        cy.get(documentManagementModule.searchDocument.documentTypes_Values)
            .should('contain','EMPADRONAMIENTO')

        cy.get(documentManagementModule.searchDocument.categories_Input)
            .type('local{enter}{esc}')

        cy.get(documentManagementModule.searchDocument.categories_Values)
            .should('contain','3 seleccionados')   

        cy.get(documentManagementModule.searchDocument.documentTypes_clear_button)
            .click()

        cy.get(documentManagementModule.searchDocument.categories_Input)
            .type('{esc}')

        cy.get(documentManagementModule.searchDocument.documentTypes_Input)
            .type('dni{enter}{esc}')

        cy.get(documentManagementModule.searchDocument.documentTypes_Values)
            .should('contain','DNI')

        cy.get(documentManagementModule.searchDocument.categories_Input)
            .type('ident{enter}{esc}')

        cy.get(documentManagementModule.searchDocument.categories_Values)
            .should('contain','2 seleccionados') 

        cy.get(documentManagementModule.searchDocument.documentTypes_clear_button)
            .click()

        cy.get(documentManagementModule.searchDocument.categories_Input)
            .type('{esc}')

        cy.get(documentManagementModule.searchDocument.documentTypes_Input)
            .type('derecho{enter}{esc}')

        cy.get(documentManagementModule.searchDocument.documentTypes_Values)
            .should('contain','DOCUMENTO DE DERECHO')

        cy.get(documentManagementModule.searchDocument.categories_Input)
            .type('acre{enter}{esc}')

        cy.get(documentManagementModule.searchDocument.categories_Values)
            .should('contain','TIPOS FLORENCE')  

        cy.get(documentManagementModule.searchDocument.documentTypes_clear_button)
            .click()

        cy.get(documentManagementModule.searchDocument.categories_Input)
            .type('{esc}')

        cy.get(documentManagementModule.searchDocument.documentTypes_Input)
            .type('alta{enter}{esc}')

        cy.get(documentManagementModule.searchDocument.documentTypes_Values)
            .should('contain','ALTA VOLUNTARIA')

        cy.get(documentManagementModule.searchDocument.searchButton)
            .click()

        cy.get(documentManagementModule.searchDocument.results_list)
            .should('contain','ALTA VOLUNTARIA')
    })

    it('TC1218 - search by document type', function () {
        cy.visit('app/search')

        cy.get(documentManagementModule.searchDocument.documentTypes_Input)
            .wait(4000)
            .type('alta{enter}derecho{enter}dni{enter}empa{enter}{esc}')
    
        cy.get(documentManagementModule.searchDocument.documentTypes_Values)
            .should('contain','4 seleccionados')

        cy.get(documentManagementModule.searchDocument.categories_Input)
            .type('tipos{enter}acre{enter}local{enter}iden{enter}{esc}')
        
        cy.get(documentManagementModule.searchDocument.categories_Values)
            .should('contain','4 seleccionados') 
            
        cy.get(documentManagementModule.searchDocument.searchButton)
            .click()

        cy.get(documentManagementModule.searchDocument.results_list)
            .should('not.contain','Sin resulta')
    })

    it('TC1221 - search by clinical act type', function () {
        cy.visit('app/search')

        cy.get(documentManagementModule.searchDocument.clinicalActTypes_Input)
            .wait(4000)
            .type('inter{enter}imagen{enter}{esc}')
        
        cy.get(documentManagementModule.searchDocument.clinicalActTypes_Values)
            .should('contain','2 seleccionados')

        cy.get(documentManagementModule.searchDocument.searchButton)
            .click()

        cy.get(documentManagementModule.searchDocument.results_list)
            .should('contain','TORAX')
    })

    it('TC1222 - search by clinical act', function () {
        cy.visit('app/search')

        cy.get(documentManagementModule.searchDocument.clinicalActs_Input)
            .wait(4000)
            .type('13000023 - Densi{enter}{esc}')

        cy.get(documentManagementModule.searchDocument.clinicalActTypes_Input)
            .wait(4000)
            .type('inter{enter}imagen{enter}{esc}')
        
        cy.get(documentManagementModule.searchDocument.clinicalActs_Values)
            .should('not.exist')

        cy.get(documentManagementModule.searchDocument.clinicalActs_Input)
            .type('13000023 - Densi{enter}{esc}')

        cy.get(documentManagementModule.searchDocument.patientSearchComponent)
            .type(Cypress.env('patient'),{ force: true })

        cy.get(documentManagementModule.searchDocument.patient_search_result)
            .should('contain',Cypress.env('patient'))
            .click()

        cy.get(documentManagementModule.searchDocument.clinicalActs_Input)
            .type('13000023 - Densi{enter}{esc}')

        cy.get(documentManagementModule.searchDocument.clinicalActs_Values)
            .should('contain','DENSITOMETRIA')

        cy.get(documentManagementModule.searchDocument.searchButton)
            .click()

        cy.get(documentManagementModule.searchDocument.results_list)
            .should('contain','DENSITOMETRIA')
    })

    it('TC1223 - search by clinical act code', function () {
        cy.visit('app/search')

        cy.get(documentManagementModule.searchDocument.clinicalActCode)
            .type('13000023',{ force: true })

        cy.get(documentManagementModule.searchDocument.searchButton)
            .click()

        cy.get(documentManagementModule.searchDocument.results_list)
            .should('contain','13000023')
    })

    it('TC1224 - check functionality of CLEAN button', function () {
        cy.visit('app/search')

        cy.get(documentManagementModule.searchDocument.patientSearchComponent)
            .type(Cypress.env('patient'),{ force: true })//1043319

        cy.get(documentManagementModule.searchDocument.patient_search_result)
            .should('contain',Cypress.env('patient'))
            .click()
        
        cy.get(documentManagementModule.searchDocument.documentName)
            .type('Test name',{ force: true })
            .wait(4000)
        
        cy.get(documentManagementModule.searchDocument.medicalServices_Input)
            .type('admisi{enter}{esc}')

        cy.get(documentManagementModule.searchDocument.issuers_Input)
            .type('adeslas{enter}{esc}')

        cy.get(documentManagementModule.searchDocument.medicalServices_Input)
            .type('{esc}')

        cy.get(documentManagementModule.searchDocument.categories_Input)
            .type('florence{enter}{esc}')
        
        cy.get(documentManagementModule.searchDocument.documentTypes_Input)
            .type('alta{enter}{esc}')

        cy.get(documentManagementModule.searchDocument.clinicalActTypes_Input)
            .type('imagen{enter}{esc}')

        cy.get(documentManagementModule.searchDocument.documentTypes_Input)
            .type('{esc}')
        
        cy.get(documentManagementModule.searchDocument.clinicalActTypes_Input)
            .type('{esc}')

        cy.get(documentManagementModule.searchDocument.clinicalActs_Input)
            .type('densitometria{enter}{esc}',{forced:true})

        cy.get(documentManagementModule.searchDocument.clinicalActCode)
            .type('13000023',{ force: true })

        setDate(cy.get(documentManagementModule.searchDocument.documentDateStart), '01/04/2018')

        setDate(cy.get(documentManagementModule.searchDocument.documentDateEnd), '30/04/2018')

        setDate(cy.get(documentManagementModule.searchDocument.publishedDateStart), '01/04/2018')

        setDate(cy.get(documentManagementModule.searchDocument.publishedDateEnd), '30/04/2018')

        cy.get(documentManagementModule.searchDocument.cleanButton)
            .click()

        cy.get(documentManagementModule.searchDocument.patientSearchComponent)
            .should('be.empty')

        cy.get(documentManagementModule.searchDocument.documentName)
            .should('be.empty')
        
        cy.get(documentManagementModule.searchDocument.medicalServices_Input)
            .should('be.empty')

        cy.get(documentManagementModule.searchDocument.issuers_Input)
            .should('be.empty')

        cy.get(documentManagementModule.searchDocument.categories_Input)
            .should('be.empty')
        
        cy.get(documentManagementModule.searchDocument.documentTypes_Input)
            .should('be.empty')

        cy.get(documentManagementModule.searchDocument.clinicalActTypes_Input)
            .should('be.empty')

        cy.get(documentManagementModule.searchDocument.clinicalActs_Input)
            .should('be.empty')

        cy.get(documentManagementModule.searchDocument.clinicalActCode)
            .should('be.empty')

        cy.get(documentManagementModule.searchDocument.documentDateStart)
            .should('be.empty')

        cy.get(documentManagementModule.searchDocument.documentDateEnd)
            .should('be.empty')

        cy.get(documentManagementModule.searchDocument.publishedDateStart)
            .should('be.empty')

        cy.get(documentManagementModule.searchDocument.publishedDateEnd)
            .should('be.empty')

        cy.get('body')
            .type('{esc}',{force:true})
    })
    
    it('TC1219 - click on a document and check its opened and data is correct', function () {
        cy.visit('app/search')

        cy.get(documentManagementModule.searchDocument.patientSearchComponent)
            .type(Cypress.env('patient'),{ force: true })

        cy.get(documentManagementModule.searchDocument.patient_search_result)
            .should('contain',Cypress.env('patient'))
            .click()
        
        cy.get(documentManagementModule.searchDocument.documentName)
            .type('ENALG')

        cy.get(documentManagementModule.searchDocument.searchButton)
            .click()

        cy.get(documentManagementModule.searchDocument.btnView_result)
            .click()

        cy.url()
            .should('contain','/view/')
        
        cy.get(documentManagementModule.searchDocument.patientSearch)
            .should('contain','FELICISIMO ANGEL')

        cy.get(documentManagementModule.searchDocument.categoryInput)
            .should('contain','TIPOS FLORENCE')

        cy.get(documentManagementModule.searchDocument.serviceInput)
            .should('contain','ALERGOLOGÍA')

        cy.get(documentManagementModule.searchDocument.documentTypeInput)
            .should('contain','INFORME ENDOSCOPIA')
    })
})

The weird thing is that it doesn't seem to be related to the spec as I tried changing them (order and so) and it didn't change a thing.
First spec always executes perfectly, second one can't open browser anymore.

Apart from that, the only thing we do is log in:

it('TC1317 - Check that login works', function () {
    cy.visit('')

    cy.get('#btnLoginOauth')
        .click()

    cy.get("#dniField")
        .type(Cypress.env('user'),{force:true})

    cy.get("#passwordField")
        .type(Cypress.env('pwd'),{force:true})

    cy.get("#btnLogin")
        .click()
    
    cy.wait(5000)
})

@jennifer-shehane
Copy link
Member

Perhaps try to collect some more logging information during cypress run https://on.cypress.io/debugging#Print-DEBUG-logs

@jennifer-shehane
Copy link
Member

You may also want to be aware of this issue - where the click does not execute in after hooks if a test fails: #2831 but I don't think this is related to your problem.

@achelonmm
Copy link
Author

achelonmm commented Feb 22, 2019

You may also want to be aware of this issue - where the click does not execute in after hooks if a test fails: #2831 but I don't think this is related to your problem.

Yeah, I've been dealing with this too, but it's not related to my problem as the first spec, which in my case just tries to log in, log out and make an incorrect login, works perfectly and it closes the browser.
And the next spec doesn't even do a click because the browser never opens.

I'm checking 2831 anyway, thanks!

Will try to DEBUG and get extra information.

Just a set DEBUG=cypress:* would work or is it better to go for set DEBUG=cypress:launcher?

@achelonmm
Copy link
Author

Hello,

I have tried using DEBUG=cypress:*, however, didn't get any additional information, as the logs do not include the debugging information in the console, and if I execute everything manually, it works perfectly.

Any other idea or workaround? Is there a way to log in a file everything printed by DEBUG=cypress:*?

@jennifer-shehane
Copy link
Member

I think you're going to have to try to narrow down the test code base to find the core issue. So, cut out half of test code, does it still fail. Try half of that code, etc until you get it to the smallest amount of code to run to reproduce.

@bahmutov - you have any leads or suggestions? I know you worked with VSTS some.

@devsh4
Copy link

devsh4 commented Mar 6, 2019

@jennifer-shehane I face the same issue (intermittently). With cypress version 3.1.5. For earlier versions it use to work just fine.

Running my test suite locally using npx cypress run (Electron 59) sometimes works and sometimes it doesn't and fails before running the first test.

image

@Moin-A
Copy link

Moin-A commented Mar 24, 2019

I too got the same error, the first two specs are running properly, However from the third spec onwards I am gettin the error :
Screenshot 2019-03-23 at 8 54 20 PM

@devsh4
Copy link

devsh4 commented Mar 25, 2019

I found the cause of that issue. It seems like while starting, cypress threw an error which didn't allow the headless browser to fetch the URL (baseUrl in cypress.json) because the base URL had auth credentials and there were a couple of other URL's mentioned under env (which were cross domain) which my tests needed to access. This was the primary issue.

Removed baseUrl altogether and I created a variable under 'env' (for all the URL's) and then it worked fine. Looks like there is CORS related bug, where cypress cannot connect to electron while reading the baseUrl value from cypress.json which further has multiple urls (cross-domain) mentioned elsewhere in the same file.

@jennifer-shehane
Copy link
Member

@devsh4 See this issue - it is what you are describing #1598

@Pavel-Husakouski
Copy link

Pavel-Husakouski commented May 16, 2019

I have the very same issue. Cypress version 3.1.0. There is no auth credential in the baseUrl. Cypress fails from time to time, about one of 10 times is failed.

@cbernardes
Copy link

cbernardes commented Jul 18, 2019

Thanks @jennifer-shehane for trying to support, but I am having the same issue and all the suggestions implies try-error attempt. Here is the log I have:

We encountered an unexpected error talking to our servers.
Because you passed the --parallel flag, this run cannot proceed because it requires a valid response from our servers.
The --group flag you passed was: web
The --ciBuildId flag you passed was: 3082
The server's response was:
StatusCodeError: 503
{
  "error": "timed out creating run"
}

and it looks like a failure of cypress to orchestrate parallel request or even allocate diff servers/machines to it.

@jbpallingayan
Copy link

Were experiencing this right now. Is there any fix for this?

@cbernardes
Copy link

cbernardes commented Oct 11, 2019

There is a workout around to fix this problem. You can overwrite their values reseting the env variable API_RETRY_INTERVALS. In my case I added to my CI/CD pipeline the following configuration:

Name: API_RETRY_INTERVALS
Value: 5000,5000,5000,10000,5000,5000,5000,10000

It means the Cypress will retry every 5 seconds 3 times, then 10 seconds and so on. The number of retries are exactly the length of your value list.

@Pavel-Husakouski
Copy link

Looks like headless electron works without that issue. @cbernardes Could you explain that magic ?

@cbernardes
Copy link

Hey @Pavel-Husakouski it is not magic. It is just the way they have built, I hope intentionally, their middleware. In my case it was hanging-out on the first try only, but it was enough to delay my CI/CD. After digging through their code I found this solution :D.

#openSource <3.

@Pavel-Husakouski
Copy link

Actually, all our tests are failed because of this issue. Cypress tries to connect per every test and fails - about twenty times "The browser never connected. Something is wrong. The tests cannot run. Aborting..."
We switched to headless electron because looks like it works a bit better. However, I don't have enough statistic to make any serious judgement.

@cbernardes
Copy link

@Pavel-Husakouski this is only necessary when you run your tests in parallel. This request is exactly to know which suite to pull from the queue. Said so, I would strongly encourage you to run your CI/CD with electron.
If this is happening when you are running your tests locally, I would say you are having the wrong approach. They have a very good dashboard to help you with your tests execution and this don't require the API request which triggers the error referenced in this page issue.

@GettinDatFoShow
Copy link

I was experiencing this error while using angular cli for the server and the electron browser. I think the problem was that the live-reload server was trying to reload the application during the process of the cypress testing. When I serverd the code with these flags: ng serve --liveReload=false --watch=false, then it worked perfectly. Hopefully this helps some.

@Pavel-Husakouski
Copy link

I think the problem was that the live-reload server was trying to reload the application during the process of the cypress testing. When I served the code with these flags: ng serve --liveReload=false --watch=false, then it worked perfectly. Hopefully this helps some.

That's interesting. However, we don't use any live reload under Cypress. Moreover, we face the issue under the production environment. Anyway, electron works much better.

@mingyixu
Copy link

mingyixu commented Feb 9, 2020

I too got the same error on cypress 4.1.0, auto execution, I run CI/CD with electron, but 10% can got this error.

@suresh-cg
Copy link

suresh-cg commented Feb 19, 2020

We are also facing same issue , the fist spec execution is passed and remaining spec file execution status results in failure due to time out issue.continuous failure in headless and test runner too.unable to invoke the electron browser from second spec execution.Tried out with all specified options ,it's invain.

Issue can be reproducible with cypress 3.4.1 ,3.8.3 as well as v4.0.0 on electron .
Looking forward for further resolution .

@mdorda
Copy link

mdorda commented Apr 3, 2020

Same issue here. Everything works like a charm on MacOS, but on our system server with Debian Stretch, google-chrome-stable 79, node 12.16.1 and npm 6.14.4 it does not work. It is 100% cypress error, because I tried the following versions:

  • 4.3.0 - the error occured, browser is not connected
  • 4.2.0 - the error occured, browser is not connected
  • 4.1.0 - the error occured, browser is not connected
  • 4.0.2 - the error occured, browser is not connected
  • 4.0.1 - the error occured, browser is not connected
  • 4.0.0 - the error occured, browser is not connected
  • 3.8.3 - works!

@cypress-bot cypress-bot bot added stage: backlog and removed stage: needs information Not enough info to reproduce the issue labels Apr 29, 2022
@dawid-bobowski
Copy link

Any progress on that? I have the same issue with Cypress 8.3.0 on Jenkins.

@OndeVai
Copy link

OndeVai commented Jul 7, 2022

Same here!

@damonhnz
Copy link

I was having this issue about 50% of the time running on a mac (but not at all on Linux) using Cypress 10.3 and Electron browser. Disabling the GPU has fixed it for me.

export ELECTRON_EXTRA_LAUNCH_ARGS=disable-gpu

@testingtrail
Copy link

testingtrail commented Sep 27, 2022

Github Actions
cypress/browsers:node12.18.0-chrome83-ff77
"cypress": "^9.5.1"

I am running github actions, and In my case I changed some files from This.js to this.js and when committing to Github the files were not changed to lowercase which other cypress files were calling as import base from './this'; so I manually changed the files in the git repository to be lowercase, and then my workflow worked. It may be silly things like these that cause those errors.

@nagash77 nagash77 added the prevent-stale mark an issue so it is ignored by stale[bot] label Apr 3, 2023
@raghavharness
Copy link

We were facing same issue with cypress 12.5.0 and Electron 106. The issue for us was coming from XDG_CONFIG_HOME env variable. It was not getting set and it seems this gets used by electron. We tried to set it manually XDG_CONFIG_HOME=$HOME/.config and things started working correctly. Sharing here if it helps anyone.

@w4dd325
Copy link

w4dd325 commented Apr 26, 2023

My anti-virus was causing this issue for me. Once I disabled it, the issue stopped.

@warrensplayer
Copy link
Contributor

Thanks for the feedback and ideas for how you were able to solve this type of issue. If anyone comes across this issue again. Please file a new issue and include a reproduction. Thanks!

@warrensplayer warrensplayer removed their assignment Apr 27, 2023
@matheuspellegrini
Copy link

I've faced this same issue and after a long research I've identified that my problem is related to webpack build, so I've tried to build(npm run build) and my webpack run out of memory(WSL), I've 32GB of RAM and this still happends, so I just run this export NODE_OPTIONS=--max_old_space_size=8192 and cypress work again, took me some months to discover this as cypress doesn't stop or show errors related to webpack build(just when succeed). Hope I can help you(I've never found that related solution).

@sangeeta-chakalabbi
Copy link

sangeeta-chakalabbi commented Jul 16, 2023

I see the above issue again.. with cypress 12.17.1

Timed out waiting for the browser to connect. Retrying...

Timed out waiting for the browser to connect. Retrying again...

The browser never connected. Something is wrong. The tests cannot run. Aborting...

The browser never connected. Something is wrong. The tests cannot run. Aborting

On running with DEBUG option, I get to see the following

2023-07-16T21:16:43.732Z cypress:server:browsers browsers.kill called with no active instance 2023-07-16T21:16:43.734Z cypress:server:browsers getBrowserLauncher { browser: { name: 'electron', channel: 'stable', family: 'chromium', displayName: 'Electron', version: '106.0.5249.51', path: '', majorVersion: 106, isHeadless: true, isHeaded: false } } 2023-07-16T21:16:43.734Z cypress:server:browsers opening browser { name: 'electron', channel: 'stable', family: 'chromium', displayName: 'Electron', version: '106.0.5249.51', path: '', majorVersion: 106, isHeadless: true, isHeaded: false } 2023-07-16T21:16:43.735Z cypress:server:browsers:electron open { browser: { name: 'electron', channel: 'stable', family: 'chromium', displayName: 'Electron', version: '106.0.5249.51', path: '', majorVersion: 106, isHeadless: true, isHeaded: false }, url:

@nagash77
Copy link
Contributor

@sangeeta-chakalabbi please open a new issue with a reproducible example and the Cypress team will be happy to investigate.

@fritzfelix
Copy link

I have the same issue since we moved from yarn to pnpm. @sangeeta-chakalabbi Are you using pnpm by any chance?

@jennifer-shehane jennifer-shehane added CI General issues involving running in a CI provider and removed CI: azure labels Oct 5, 2023
@mbourd
Copy link

mbourd commented Oct 9, 2023

The problem is still present:

ℹ 「wds」: Project is running at http://localhost:36559/webpack-dev-server/
ℹ 「wds」: webpack output is served from /__cypress/src
ℹ 「wds」: Content not from webpack is served from /home/new/projects/cp1-front

====================================================================================================

  (Run Starting)

  │ Cypress:        13.3.0                                                                         
  │ Browser:        Electron 114 (headless)                                                        
  │ Node Version:   v16.14.0 (/home/new/.nvm/versions/node/v16.14.0/bin/node)                      
  │ Specs:          89 found (...)                                                    
  │ Searched:       src/**/*.cy.tsx                                                                
  │ Experiments:    experimentalMemoryManagement=true
                                                                                                    
  Running:  Features/Audit/File/FileAuditRender.cy.tsx                                     (1 of 89)
ℹ 「wdm」: wait until bundle finished: /__cypress/src/index.html

Timed out waiting for the browser to connect. Retrying...
ℹ 「wdm」: Compiled with warnings.
There was an error reconnecting to the Chrome DevTools protocol. Please restart the browser.

TypeError: Cannot read properties of undefined (reading 'webSocketDebuggerUrl')
    at _._fetchDebuggerURL (<embedded>:2502:520933)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async _._start (<embedded>:2502:520232)
  • Cypress: 13.3.0
  • Node: 16.14.0

However the issue occur only with "Electron 114+" (headless)
When I run the command: npx cypress run --component
I also have many tests (more than 450)

With the other browsers like Chrome, seems working.

Can you please fix this issue ?

@jwedel
Copy link

jwedel commented Oct 16, 2023

We are also experienced that.

  • We were running builds on Azure DevOps on prem agent (docker based) with Cypress 13.1 and Electron -> Works ✅
  • Then we switched to a scalable cloud agent with Cypress 13.1 and Electron -> failes with the mentioned error ❌
  • Then I switched from Electron to Chrome and it works -> ✅

Very weird... I tried debugging and changing from localhost to 127.0.0.1 / 0.0.0.0 on cypress and dev server side but with no luck.

@jerkovicl
Copy link

I have also experienced problems with running on Gitlab CI with image: cypress/included:cypress-13.3.1-node-20.6.1-chrome-116.0.5845.187-1-ff-117.0-edge-116.0.1938.76-1, getting same error

image

@jennifer-shehane
Copy link
Member

Please open new issues, filling out the issue template, describing your issues.

@cypress-io cypress-io locked and limited conversation to collaborators Oct 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CI General issues involving running in a CI provider prevent-stale mark an issue so it is ignored by stale[bot]
Projects
None yet
Development

No branches or pull requests