Cypress: Whoops, there is no test to run error msg when visiting certain websites

Created on 7 Jan 2019  路  46Comments  路  Source: cypress-io/cypress

Really weird crash - "Whoops, there is no test to run"

Cypress 3.1.4 on Mac, spec file

it('loads', () => {
  cy.visit(
    'https://stackoverflow.com/questions/379453/useful-add-ins-or-plug-ins-for-native-visual-studio-developer'
  )
})

See movie below

stackoverflow

Sometimes I see the red error message in the command log, but could not record it yet, and it flashes way too quickly to see

Final screenshot

screen shot 2019-01-07 at 3 55 12 pm

blocking needs investigating 馃槼 whoops there is no test to run bug

Most helpful comment

hey all, I was facing the same problem and the workaround that works was to change the browser to another one than Chrome.
Screen Shot 2019-07-03 at 2 50 48 PM
This another browser works for me. So, it looks like this is a chrome's version problem. I think that could be related to the arrangement between chrome within cypress and the local chrome in the machine. And this could be the reason that this problem happens only for some people.
If someone has the correct versions that chrome should have on cypress and locally, please, share here.
Thanks.

All 46 comments

I have a bit of a different result ... My "final screenshot" is ending up on the actual stackoverflow website at a 404 page for the route /__ . Also this happens to me for absolutely any url I use, I always end up thedomain.com/__ at the top level of the browser (in other words, the browser leaves the cypress testing page entirely)

That's what happens when using Chrome 71. If I use the Electron option, then cypress finally puts the URL into the integrated browser on the test page (instead of navigating away from the page entirely), however the page does not load (it just hangs forever on "Loading..."). To be clear this is happening to me regardless of what URL I use.

Also I cannot show any screenshots because github it erroring out when I try to upload them and my company's strict browsing policies prevent me from doing it any other way easily.

It's not a good look that I'm encountering blocking issues on the very first line of code trying to evaluate cypress. I'm actually the one that was pushing my company to switch to cypress. I received push-back but was able to convince them to give me just a view days to evaluate and prove it's good enough to purchase. If this doesn't get fixed fast I probably will not be able to convince anybody of anything.

I'll try older versions for now and hope this bug doesnt exist.

@parliament718 thank you for trying Cypress and reporting this bug. While unfortunate, I can promise that thousands of projects are successfully using Cypress every day locally and on CI to test a variety of sites. Where things can wrong in your case (and for StackOverflow) are custom proxies and redirects that prevent Cypress from correctly loading the site.

When you have started Cypress for the very first time, did it scaffold examples folder and could you run any of the examples there? Something like

mkdir foo 
cd foo
npm init -y
npm i -D cypress
npx cypress open

Then click on any spec file - what happens?

What happens is
1) clicking spec file launches browser to http://localhost:49606/__/#/tests/integration\examples\files.spec.js
2) browser flashes and quickly redirects to https://example.cypress.io/__/#/tests/integration\examples\files.spec.js
3) Result is 404 with message like "For root URLs (like http://example.com/) you must provide an index.html file."

If I run these example specs with Electron option it runs successfully.

Why does step 2 above happening? I once again notice that redirect to the route with a double underscore ....What is this about? When the cy.visit('localhost:4200/some/url') call ends up redirecting me to localhost:4200/__, my application is obviously running on that port and will begin to bootstrap itself with an invalid route.

I don't understand what cypress expects to happen when it redirects to the url where my application is running with a double underscore route.

Additionally, if I run my example using Electron is just hangs trying to load the localhost:4200/some/url even though this exact url has no problem loading in a regular browser session.

Hey @parliament718, could you provide screenshots of these errors and also any test code you are running to get here? This would be most helpful in tracking the exact issue.

I'm aware of 404 issues involving Chrome 72+ here https://github.com/cypress-io/cypress/issues/1872

Cypress does do some things that appear strange - like switching urls on first visit to the domain you intend use in your cy.visit() to avoid cross domain issues, so some of this is intended behavior, but certainly having the application never load is not intended and is a bug.

@bahmutov I've labeled all issues we've encountered previously with 'Whoops, there is no test to run' error within this label

Some of them have been related to strange 'framebusting' kind of behavior - especially on large websites. Like this one for example https://github.com/cypress-io/cypress/issues/1517

@jennifer-shehane @bahmutov

When using Chrome 71 this happens:
img

For example, cy.visit('http://angular.io') and launching the test via Chrome 71 results in this:
img2

Notice the double underscore in the URL and Im no longer on the testing page. This happens for localhost as well, I get redirected to localhost:4200/__ with the double underscore. As expected, this navigates away from the cypress testing page, not sure why cypress it changing the top level url instead of the one in the integrated iframe browser

When I try to use Electron to launch the test it cannot load the page:
img3

Navigating to this URL the standard way via browser does in fact open my application.

@jennifer-shehane @bahmutov I have until the end of this week (max) to evaluate cypress for my company until we move on to other solutions. I still cannot get past this issue. Are the screenshots above expected behavior?

@parliament718 something goes terribly terribly wrong in your case (remote URLs, framebusting, etc) that we do not have time figure out. We won't have time figure out this unfortunately in any urgent time frame.

@bahmutov My company has strict browsing policies, are there any external calls that cypress makes to any domain other than *.cypress.io that I perhaps need to have whitelisted?

Hey @parliament718, I've been unable to replicate this behavior on my end with Chrome 70 & 72. Did you narrow down the issue to Chrome 71? Or were you just mentioning that.

Also, have you by chance set the modifyObstructiveCode configuration to false?

Whitelisting only our domain (*.cypress.io) should be sufficient.

@jennifer-shehane I've tried modifyObstructiveCode false with no success. Also, how can I try via Chrome 70/72? I only see the 71 option and Electron in my dropdown.

Also, please note I am on a windows machine, do you have one to try on ?

@jennifer-shehane Has anyone had a chance to test on windows? Also how can I test on Chrome 70/72 if I dont see the option in the dropdown?

Hey @parliament718, you would need to download that specific Chromium version on your machine - adding it as an application, as you would any other browser - then it should be detected within Cypress for the dropdown. It's not great documentation, but this explains how to download a specific Chromium version. https://www.chromium.org/getting-involved/download-chromium

This might be a silly question but you do have describe part also in your spec?

Hi @jennifer-shehane , i get the same message 'Whoops, there is no test to run.' when i try to access any page using http. When i use https://google.com it works fine. But when i use http://localhost:8000 it opens the page, flashes for a second and then throws the above message.
Below is the code i'm using: [Browser: chrome 71, OS: mac]

describe('Login page', () => {
  it('Login', () => {
    cy.visit('http://localhost:8000')
  })
})

Hi,

I had the same problem and it took me a long time to understand why. Indeed this is framebusting, and it's not easy to find what's wrong. Regarding my app, I commented on bits of code and I finally found it came from the google tag manager. So I added this to my cypress.json file :

"blacklistHosts": ["www.googletagmanager.com"]

like @jennifer-shehane suggest it here : 2052. And now it works !!

Good luck !

Hello everybody, I have the same problem of @parliament718, I tried the suggest of @marinav however it is still happening.
@jennifer-shehane do you know how is it going? I'm making some POC to present to my team to select a best tool to automated the tests however since we have this problem I cannot present for them cypress like an option.
Thank you.

This problem just started for me when I added
"modifyObstructiveCode": false.

The issue in the OP is coming from code on StackOverflow that is causing frame busting. If I blacklist StackOverflow's javascript, it works:

{
  "blacklistHosts": [
    "cdn.sstatic.net"
  ]
}

So it seems like there's another frame busting case we need to identify and protect against.

hey all, I was facing the same problem and the workaround that works was to change the browser to another one than Chrome.
Screen Shot 2019-07-03 at 2 50 48 PM
This another browser works for me. So, it looks like this is a chrome's version problem. I think that could be related to the arrangement between chrome within cypress and the local chrome in the machine. And this could be the reason that this problem happens only for some people.
If someone has the correct versions that chrome should have on cypress and locally, please, share here.
Thanks.

I also find this issue when I am running my test code.
It comes when my site redirects me from https://www.ucertify.com to https://www.ucertify.com/[xyz].

Hi Cypress Team @jennifer-shehane @bahmutov, this issue still exists on Chrome 78 Canary 80 Electron 61 while using Cypress ^3.4.1.

As a workaround, can we identify Cypress in the browser using window.Cypress all time?

That way we can probably skip the iFrame busting for Cypress in our QA env.

Please confirm, thanks!

I had the same issue. I fixed the problem removing the target '_top' attribute from a form that didn't need it, as suggested here #3051

I am experiencing the same issue for a Cypress POC, This doesn't look good and I can see my organisation avoiding cypress completely if I can't find a resolution by next week

I am experiencing the same issue. When I click on the below link, I am getting this error.
<b><a target="_top" href="/oscar/group/view.html?groupID=xxxxxx">yyyyy</a></b>

Cypress have a lots of issues like most of css selectors don't work if we fine it with the help of chorpath in spite it give issues and above mentioned issue i was performing POC and i am blocked so i am using selenium which is better and wide community support

Anyone know how to solve this?

image
Running google chrome 80 and have got the same issue
"Whoops, we can't run your tests.
This browser was not launched through Cypress. Tests cannot run."

Hi,

I had the same problem and it took me a long time to understand why. Indeed this is framebusting, and it's not easy to find what's wrong. Regarding my app, I commented on bits of code and I finally found it came from the google tag manager. So I added this to my cypress.json file :

"blacklistHosts": ["www.googletagmanager.com"]

like @jennifer-shehane suggest it here : 2052. And now it works !!

Good luck !

Thank you, it worked :)

@begli80 Your warning it not the same as the warning that others are seeing. See this tag for related issue: https://github.com/cypress-io/cypress/labels/topic%3A%20%F0%9F%98%B3whoops%20we%20can%27t%20run%20your%20tests

Hi @jennifer-shehane what is the work-around which you have shared for Whoops, there is no test to run" when an specific URL is loaded. ?

Hi there, I'm running into the same issue today, I have the latest version of cypress, 4.5.0. My test below actually runs but after it clicks on the emulate button, it doesn't take me to the actual page but instead I get the "Whoops, there is no test to run error msg when visiting certain websites". I tried it in all 3 browsers, chrome 81, electron, and firefox 74, same result. Test is down below. Again I get the message right after cy.get('#EMULATE-button').click();. Any idea on what's going on and when this can be fixed?

import '../../../support/commands';

describe('Verify Emulate Employer', () => {
    beforeEach(() => {
        Cypress.on('window:before:load', (win: any) => {
            win.usabilla_live = win.usabilla_live || function() {};
        });
    });
    it('Verify Emulate Employer', function() {
        const env = Cypress.env();
        cy.clearCookies();
        Cypress.config('pageLoadTimeout');
        Cypress.config('defaultCommandTimeout');

        cy.login(env.usernameAdmin, env.passwordAdmin, env.employerUrl);

        cy.get('.user-name').click();
        cy.get('[data-cy=adminLink]').click();
        cy.get('.myDiceDD3 > span').click();
        cy.get('#menu_3 > ul > :nth-child(1) > a').click();
        cy.get('[style="padding-top:.5em;"] > input').type('[email protected]');
        cy.get('#SEARCH-button').click();
        cy.get('#EMULATE-button').click();

        //Assertions

        cy.logout();
    });
});

So I found a work around for this issue, instead of clicking on the emulate button that was taking me to a new page, I made an api call then I visited the page, code down below:

cy.request({
      method: "POST",
      url: env.mearUrl + "/daf/servlet/DAFctrl",
      form: true,
      followRedirect: false,
      body: {
        user: "[email protected]",
        op: "1082",
      },
    });

    cy.visit("/employer/app/account-information");

Hi @eabusharkh0 , Can you plz tell me the solution for same problem and what changes should i do in my script.

Below is the current script i am using -

/// <reference types="Cypress" />
describe('My First Test Suite', function()
{
it('My First Test Case', function()
{
    cy.visit ('http://10.0.10.121:6868/usi')
    cy.contains ('Sign In')
    cy.get ('input[type=text]').type('usdg')
    cy.get ('input[type=password]').type('isd@1247')
    cy.get ('button').click()
} )
} )

And, the error msg saying "Whoops, there is no test to run" comes up when clicked on button.

@DhruvAhluwalia find out the url that the page goes to and the api call that it's making by clicking on the button, then comment out cy.get ('button').click() and put code similar to the below, basically the cy.request you are authenticating the user you are passing in then the last line, cy.visit, is what it would take you to that page. You can ask one of your developers the exact cy.request code you need to put in to get to the landing page and the exact url you need in the cy.visit.

cy.request({
method: "POST",
url: env.mearUrl + "/daf/servlet/DAFctrl",
form: true,
followRedirect: false,
body: {
user: "[email protected]",
op: "1082",
},
});

cy.visit("/employer/app/account-information");

Dear @eabusharkh0 :) I am starting to my adventure with automatization and I have the same problem like the others with my scrypt. I recorded some video: https://drive.google.com/file/d/1dhMT3FBaWlev3ZvS623U_G2uciLlUm3N/view?usp=sharing :) And here is the code:

///<reference types="cypress"/>
describe('Login',function()
{
it('Verify logging in', function()

{
cy.visit("https://profil.wp.pl/login.html?zaloguj=poczta")

cy.wait(3000)

cy.get("#login").type("[email protected]")

cy.wait(3000)

cy.get("#password").type("test123456")

cy.wait(3000)

cy.get("#btnSubmit").click()

cy.wait(3000)

cy.get(".Button topuser__logout").click()

cy.wait(3000)
//.Button topuser__logou

}
)
it('Verify bad logging in', function()

{
cy.visit("https://profil.wp.pl/login.html?zaloguj=poczta")

cy.wait(3000)

cy.get("#login").type("[email protected]")

cy.wait(3000)

cy.get("#password").type("test123")

cy.wait(3000)

cy.get("#btnSubmit").click()

cy.wait(3000)

cy.get(".Error-msg").contains('Niestety podany login lub has艂o jest b艂臋dne.')

}
)
}
)

I will be really grateful for help because it's my "be or not be" :)

Thank You!!

BR

Cypress - Last version. Windows 10, Chrome 81, Electron 80

I have the same issue, after clicking a button it moves to this screen.
I tried the above temporary solutions but I don't get it to work.

@klaudynaz 2 suggestions, I would put your login in a separate method inside the "commands.ts" file so you can call it from all your tests if needed instead of inside each test. Here's what my login method looks like as an example, when you call it you'll just have to pass the 3 parameters:

Cypress.Commands.add(
  "login",
  (email: string, password: string, url: string) => {
    cy.log(email);
    cy.log(password);
    const env = Cypress.env();
    cy.request({
      method: "POST",
      url: env.employerUrl + "/ajaxLogin",
      body: {
        username: email,
        password: password
      },
      headers: {
        Accept: "application/json",
        "Content-Type": "application/x-www-form-urlencoded"
      }
    });
    cy.visit(url);
});

Also, you don't need to put wait statements after every command, go to your cypress.json file and put the following in it so you can remove your wait statements:

"defaultCommandTimeout": 90000,
  "pageLoadTimeout": 90000,
  "chromeWebSecurity": false

let me know if that works or not.

This is what helped me @klaudynaz

cy.xpath('//*[@id="collection-media"]/div[2]/div[1]/a').click(); cy.get('.approved-content .no-auto-submit').invoke('attr', 'target', '_self'); cy.get('.dialog-confirm.action-btn').click({force:true});

The attribute you can change in the DOM. Perhaps not the prettiest solution. But good workaround for now.

This is preventing the usage of cypress for us unfortunately :(

@straris try "modifyObstructiveCode": true, in your cypress.json file.
Having this value set to false caused Whoops problem for me when navigating around withing one superdomain.

@vrodnyanskiy I believe I tried most workarounds mentioned in all the tickets around the issue, so far no luck.
image
Including:

  • switching to electron
  • actually removing any iframes from the page
  • Checking the form for target (has no target defined)

This blocked me too!
Any solution?

This still blocks me for a long time,someone please help me to fix this.
Untitled

This issue is resolved using #992 code snippet in support/index.js

https://github.com/cypress-io/cypress/issues/992#issuecomment-348631326

@rangabarath perhaps for your case, would be great to know what that was.

Was this page helpful?
0 / 5 - 0 ratings