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 hanging/stop with remote server (maybe https related) #3729

Closed
MatteoGioioso opened this issue Mar 18, 2019 · 15 comments
Closed

Cypress hanging/stop with remote server (maybe https related) #3729

MatteoGioioso opened this issue Mar 18, 2019 · 15 comments

Comments

@MatteoGioioso
Copy link

MatteoGioioso commented Mar 18, 2019

Current behavior:

I am trying to run my tests with my staging server in https

I have recorded a video of the what exactly happens:

https://www.hippovideo.io/video/play/22oQrG8pRA_ShkNs1tXdzdjBu0b8r0Pw9aU_JNy-K9Q

Looks like it is redirecting to my domain and then stop without displaying any error.

Upon inspecting the console I have this error:

Refused to execute script from 'https://www.googletagmanager.com/gtag/js?id=CODE_ID' because its MIME type ('image/gif') is not executable.

This error appears also in my localhost but in this environment the tests are running flawlessly without problems.

Unfortunately I cannot check if the tests are actually working for http, therefore I am not sure this is a problem related only with https

Steps to reproduce:

this is my cypress.env.json:

{
  "baseUrl": "https://mydomainname.com"
}

Versions

cypress:  3.1.5
Windows 7 Professional 64-bit
Chrome 72
@MatteoGioioso
Copy link
Author

Hello, any update on this?

@jennifer-shehane
Copy link
Member

@MatteoGioioso Can you try to set modifyObstructiveCode: false in your cypress.json? https://on.cypress.io/configuration#modifyObstructiveCode

This is a bit of a guess that this may change things. I'm thinking that maybe a chunk of the script was modified to try to avoid framebusting, but it's modified the googleads so that it's Content-Type is incorrect? The error you are seeing is generally due to a Content-Type header not matching the actual filetype that is served.

@cypress-bot cypress-bot bot added the stage: awaiting response Potential fix was proposed; awaiting response label Apr 4, 2019
@MatteoGioioso
Copy link
Author

@jennifer-shehane Unfortunately it did not work.
Just to be sure, we are using service worker might that be an issue?

Thanks

@MatteoGioioso
Copy link
Author

MatteoGioioso commented Apr 12, 2019

I tried to update to new cypress version, still no luck, any news on this? At the moment we cannot test on a live server.

@MatteoGioioso
Copy link
Author

Hello, any update on this?

@cypress-bot cypress-bot bot added stage: needs information Not enough info to reproduce the issue and removed stage: awaiting response Potential fix was proposed; awaiting response labels Apr 23, 2019
@jennifer-shehane
Copy link
Member

There's not much we can do without the ability to reproduce the error ourselves. If you can provide reproducible code or email the reproducible code to [email protected]

@MatteoGioioso
Copy link
Author

@jennifer-shehane There is not much to reproduce, in localhost is working flawlessly, unfortunately not on a live server. I will try to come up with something

@MatteoGioioso
Copy link
Author

up

@flotwig
Copy link
Contributor

flotwig commented May 14, 2019

@MatteoGioioso it looks like the app has some code that's causing it to bust out of the frame (framebusting) and take over the entire viewport. Check your codebase for code like top.location = self.location and wrap it in if (!window.Cypress) { /* ... */ } so that it does not break the test.

@MatteoGioioso
Copy link
Author

@flotwig I will try to check on a build of our react application, might be the service-worker.

Thanks

@MatteoGioioso
Copy link
Author

MatteoGioioso commented Jun 17, 2019

@flotwig Ok, looks like this behavior happens only after we test on a built create-react-app. I tried to look for top.location = self.location or any of the keywords associated, but I did not find anything.

I will ask this question once again, just to be sure, we are using service worker might that be an issue?

@flotwig
Copy link
Contributor

flotwig commented Jun 17, 2019

@MatteoGioioso I think the only known issue with service workers are that they are not cleared at the start of each run: #702

It still looks like you have some framebusting code in your application, that's how users usually run in to this behavior.

@bahmutov
Copy link
Contributor

@MatteoGioioso can you try disabling service worker by removing it from the navigator object to avoid registering it? https://glebbahmutov.com/blog/cypress-tips-and-tricks/#disable-serviceworker

@jennifer-shehane
Copy link
Member

Hey @MatteoGioioso, were you able to resolve your issue?

@cypress-bot cypress-bot bot added stage: awaiting response Potential fix was proposed; awaiting response and removed stage: needs information Not enough info to reproduce the issue labels Jul 11, 2019
@MatteoGioioso
Copy link
Author

MatteoGioioso commented Aug 2, 2019

@bahmutov Ok, after disabling the service worker, we could finally succeed on testing the app in our staging server.

I have used the trick you mention in your blog

@jennifer-shehane jennifer-shehane removed the stage: awaiting response Potential fix was proposed; awaiting response label Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants