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
this is my cypress.env.json:
{
"baseUrl": "https://mydomainname.com"
}
cypress: 3.1.5
Windows 7 Professional 64-bit
Chrome 72
Hello, any update on this?
@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.
@jennifer-shehane Unfortunately it did not work.
Just to be sure, we are using service worker might that be an issue?
Thanks
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.
Hello, any update on this?
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]
@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
up
@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.
@flotwig I will try to check on a build of our react application, might be the service-worker.
Thanks
@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?
@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.
@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
Hey @MatteoGioioso, were you able to resolve your issue?
@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
Most helpful comment
@MatteoGioioso can you try disabling service worker by removing it from the
navigatorobject to avoid registering it? https://glebbahmutov.com/blog/cypress-tips-and-tricks/#disable-serviceworker