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 test runner redirects to __ suddenly #1245

Closed
joelgrimberg opened this issue Feb 1, 2018 · 6 comments
Closed

Cypress test runner redirects to __ suddenly #1245

joelgrimberg opened this issue Feb 1, 2018 · 6 comments
Labels
topic: 😳 whoops there is no test to run Error msg: "Whoops there is no test to run"
Milestone

Comments

@joelgrimberg
Copy link

I am building an E2E test in which I use a button / submit to go to a second page.
the submit triggers a redirect through jQuery.

I tried using :

Cypress.on('window:before:load', (win) => {
      Object.defineProperty(win, 'self', {
        get: () => {
          return window.top
        }
      })
    })

I also tried using

cy.visit('url', {
			 onBeforeLoad: (win) => {
			 Object.defineProperty(win, 'self', {
			 get: () => {
			 return window.top
		 }

The code as shown above does not work (I still get the 'whoops') for redirects behind buttons;
it only works for redirects behind cy.visit as it looks.

#1064
#392
#969
#992

@brian-mann
Copy link
Member

You'll need to find the JS from your site causing the redirect. It is 100% on your application code and likely should be disabled when running in Cypress. It's called framebusting. The fix that you're using only works for framebusting which is checking window.self. There are always ways to implement it like by counting window.frames.length and the easiest thing here is just to remove the JS altogether.

@odranoelBR
Copy link

odranoelBR commented Feb 9, 2018

Tks a lot @brian-mann .
I will inpect what works behing the button.

You guys are creating a great tool, keep working and i help / hope it get bigger.

@brian-mann brian-mann added this to the 2.0.0 milestone Feb 12, 2018
@brian-mann
Copy link
Member

Fixed by #1295

@brian-mann
Copy link
Member

Released in 2.0.0.

@joelgrimberg
Copy link
Author

joelgrimberg commented Feb 16, 2018 via email

@jennifer-shehane
Copy link
Member

@joelgrimberg It is released now.

@jennifer-shehane jennifer-shehane added the topic: 😳 whoops there is no test to run Error msg: "Whoops there is no test to run" label Jan 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: 😳 whoops there is no test to run Error msg: "Whoops there is no test to run"
Projects
None yet
Development

No branches or pull requests

4 participants