question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tests from example_spec.js don't run in Chrome after newly installed cypress

See original GitHub issue
  • Operating System: macOS Sierra 10.12.6
  • Cypress Version: 0.20.1
  • Browser Version: Chrome 61.0.3163.91

Is this a Feature or Bug?

Bug

Current behavior:

Clicking example_spec.js opens up chrome browser but no tests appear. Theres also a console.warn stating “WebSocket connection to ‘ws://localhost:8080/__socket.io/?EIO=3&transport=websocket’ failed: WebSocket is closed before the connection is established.”

Desired behavior:

I’d expect the tests that are included in the example_spec.js would run in browser. instead, nothing appears in the browser

How to reproduce:

  • Fresh install of cypress via npm i -D cypress.
  • run node_modules/.bin/cypress open from command line
  • click example_spec.js in integration tests list
  • notice that chrome opens, however nothing ever shows up, tests aren’t run

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
2fat2kidnapcommented, Feb 9, 2018

So I had the same issue: launching a Cypress test would open both the Chrome and Electron browser, but nothing would happen, their pages would remain blank. In the Chrome console, I would see that the Websocket connection could not connect, as the WebSocket would close before the connection would be established.

Turns out that the problem was that for some reason, obscure to me, and almost certainly completely unrelated to Cypress, my hosts file on macOS got removed. That meant that the routing of localhost -> 127.0.0.1 got nuked, and Cypress relies on this mapping. It launches the browser with the assumption that it will find the test runner at localhost, which should be at 127.0.0.1 of course, in most cases anyways.

In short, if you’re seeing this, maybe check your hosts file just in case?

2reactions
mcMickJuicecommented, Sep 21, 2017

This was an issue with my hosts file. I had 127.0.0.1 mapped to a url that mapped to docker but not to localhost. After adding localhost to map to ip4, everything worked!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting
Split large spec files into smaller ones. Split long tests into smaller tests. Run the same test using --browser chrome. The problem might...
Read more >
Browser not launched through Cypress problem #1239
When running any test using Chrome, the browser opens and shows the following message: This browser was not launched through Cypress.
Read more >
Cypress test runner is not instantly running when the ' ...
Show activity on this post. From the command prompt, first I run this command to go to this directory'cd C:\node_modules. bin ' Then...
Read more >
How to Run Cypress Tests in Chrome and Edge
This article will demonstrate how to use Cypress browser website test cases on Google Chrome and Microsoft Edge with examples.
Read more >
Module 1 – Intro to saucectl with Cypress
spec.js' . Now when you use the command saucectl run you should see both test suites, chrome smoke and chrome regression having ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found