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 failed to make a connection to Firefox - ECONNREFUSED at TCPConnectWrap.afterConnect #14272

Closed
yourpchelp opened this issue Dec 22, 2020 · 5 comments
Labels
browser: firefox stage: needs investigating Someone from Cypress needs to look at this stale no activity on this issue for a long period type: bug

Comments

@yourpchelp
Copy link

yourpchelp commented Dec 22, 2020

Current behavior

When the 1st test/spec is finished,

  1. cypress cannot connect to Firefox
    image

and fails with this error:
image

 Error launching browser
Cypress failed to make a connection to Firefox.
This usually indicates there was a problem opening the Firefox browser.
Error details:
Error: connect ECONNREFUSED 127.0.0.1:57146 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1128:14)
Stack trace
Error: Cypress failed to make a connection to Firefox.
This usually indicates there was a problem opening the Firefox browser.
Error details:
Error: connect ECONNREFUSED 127.0.0.1:57146
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1128:14)
    at get (/Users/i018093/Library/Caches/Cypress/4.12.1/Cypress.app/Contents/Resources/app/packages/server/lib/errors.js:946:15)
    at Object.throwErr [as throw] (/Users/i018093/Library/Caches/Cypress/4.12.1/Cypress.app/Contents/Resources/app/packages/server/lib/errors.js:964:9)
    at /Users/i018093/Library/Caches/Cypress/4.12.1/Cypress.app/Contents/Resources/app/packages/server/lib/browsers/firefox.js:413:41
    at tryCatcher (/Users/i018093/Library/Caches/Cypress/4.12.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/i018093/Library/Caches/Cypress/4.12.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/Users/i018093/Library/Caches/Cypress/4.12.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/Users/i018093/Library/Caches/Cypress/4.12.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/Users/i018093/Library/Caches/Cypress/4.12.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:725:18)
    at _drainQueueStep (/Users/i018093/Library/Caches/Cypress/4.12.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/Users/i018093/Library/Caches/Cypress/4.12.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/Users/i018093/Library/Caches/Cypress/4.12.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/Users/i018093/Library/Caches/Cypress/4.12.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:15:14)
    at processImmediate (internal/timers.js:439:21)
  1. The 2nd test/spec cannot start.

Desired behavior

  1. Firefox should work properly without errors, similar to Chrome:
    image
  2. All tests can run one-by-one.

Test code to reproduce

describe('tests', () => {  
    before(() => {
        cy.visit('https://www.google.com');
        cy.viewport(screen.availWidth, screen.availHeight);
    })

    it('test', () => {
        // type 'Hello World!' in search field
        cy.get('.gLFyf.gsfi').clear().type('Hello World!{enter}');
	})
})

Versions

Cypress package version: 4.12.1
Cypress binary version: 4.12.1
Browser: Firefox 83
Operating System: macOS Big Sur, Version 11.1

@jennifer-shehane
Copy link
Member

I see that you are using an older version of Cypress. Please update to the current version of Cypress and let us know if this is still happening for you. Your issue may have already been fixed. Thanks!

@cypress-bot cypress-bot bot added the stage: awaiting response Potential fix was proposed; awaiting response label Dec 29, 2020
@yourpchelp
Copy link
Author

cypress --version

Cypress package version: 6.2.0
Cypress binary version: 6.2.0
Electron version: 11.0.3
Bundled Node version: 12.18.3

Tests have been finished successfully, but Cypress still fails with this error:

image

@jennifer-shehane jennifer-shehane changed the title Cypress works improperly with Firefox Cypress failed to make a connection to Firefox - ECONNREFUSED at TCPConnectWrap.afterConnect Jan 4, 2021
@jennifer-shehane jennifer-shehane added browser: firefox type: bug blocking stage: needs investigating Someone from Cypress needs to look at this and removed stage: awaiting response Potential fix was proposed; awaiting response labels Jan 4, 2021
@Camo30
Copy link

Camo30 commented Jun 23, 2021

Same issue here using the current version of Cypress.

cypress --version shows:

Cypress package version: 7.5.0
Cypress binary version: 7.5.0
Electron version: 12.0.0-beta.14
Bundled Node version:
14.15.1

The same happens with Cypress 7.6.0.

@charlesbrandt
Copy link

I am seeing this with cypress/included:7.7.0 on Ubuntu 20.04 with a docker-compose.yml

  test:
    # https://github.com/cypress-io/cypress-docker-images/tree/master/included
    # may need to run `xhost local:root` on the host
    # so the container is allowed to connect to the local X server
    # https://github.com/bahmutov/cypress-open-from-docker-compose
    # https://www.cypress.io/blog/2019/05/02/run-cypress-with-a-single-docker-command/
    image: cypress/included:7.7.0
    container_name: boilerplate_test_1
    # depends_on:
    #   - ui
    # pass custom command to start Cypress otherwise it will use the entrypoint
    # specified in the Cypress Docker image.
    # also pass "--project <folder>" so that when Cypress opens
    # it can find file "cypress.json" and show integration specs
    # https://on.cypress.io/command-line#cypress-open
    entrypoint: cypress open --project /e2e
    environment:
      - DISPLAY
      # pass base url to tests for referencing the web application
      # - CYPRESS_baseUrl=http://boilerplate_ui_1:3000
      - CYPRESS_baseUrl=http://boilerplate_web_1
      - DEBUG=cypress:*
    working_dir: /e2e
    volumes:
      - ./tests:/e2e
      # for Cypress to communicate with the X11 server pass this socket file
      # in addition to any other mapped volumes
      - /tmp/.X11-unix:/tmp/.X11-unix

Firefox worked for me initially, but then stopped working. I believe I was on cypress/included:7.4.0 at the time. I upgraded to see if that would help, but same behavior.

The issue is persisting across container restarts. I also tried

docker-compose exec test bash
cd /root/.config/Cypress/cy/
rm -r production

per https://docs.cypress.io/guides/references/troubleshooting#Clear-App-Data

Same result:
image

Error: Cypress failed to make a connection to Firefox.

This usually indicates there was a problem opening the Firefox browser.

Error details:

Error: connect ECONNREFUSED 127.0.0.1:38277
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)

    at get (/root/.cache/Cypress/7.7.0/Cypress/resources/app/packages/server/lib/errors.js:1003:15)
    at Object.throwErr [as throw] (/root/.cache/Cypress/7.7.0/Cypress/resources/app/packages/server/lib/errors.js:1021:9)
    at Object.<anonymous> (/root/.cache/Cypress/7.7.0/Cypress/resources/app/packages/server/lib/browsers/firefox.js:422:25)
    at Generator.throw (<anonymous>:null:null)
    at rejected (/root/.cache/Cypress/7.7.0/Cypress/resources/app/packages/server/node_modules/tslib/tslib.js:115:69)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label May 17, 2023
@cypress-app-bot cypress-app-bot closed this as not planned Won't fix, can't repro, duplicate, stale May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser: firefox stage: needs investigating Someone from Cypress needs to look at this stale no activity on this issue for a long period type: bug
Projects
None yet
Development

No branches or pull requests

5 participants