Cypress seems to be injecting script code into a file I'm downloading #20064
Unanswered
alexander-paterson
asked this question in
Questions and Help
Replies: 1 comment
-
Hello @alexander-paterson! I'm facing a similar issue, did you find a solution to this? Thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a link on a page that when clicked opens a new tab and a CSV file is downloaded.
If I download the file manually by just clicking the button everything is fine with the file. The first cell when I open it has the text Attendee Reference.
If I remove the target blank attribute and download the file with my Cypress test the first cell has the following script injected into it.
<head> <script type='text/javascript'> document.domain = 'lndo.site'; !function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}({"./injection/index.js":function(e,t,n){"use strict";n.r(t);const r=window.Cypress=parent.Cypress;if(!r)throw new Error("Something went terribly wrong and we cannot proceed. We expected to find the global Cypress in the parent window but it is missing!. This should never happen and likely is a bug. Please open an issue!");const o=(()=>{let e,t,n,r;const o=()=>{e=!1,t=!1,n=[],r={}},i=(e,t=[])=>"function"==typeof e?e.apply(window,t):window.eval(e);return o(),{wrap:()=>{const o={setTimeout:window.setTimeout,setInterval:window.setInterval,requestAnimationFrame:window.requestAnimationFrame,clearTimeout:window.clearTimeout,clearInterval:window.clearInterval},a=(e,t)=>o[e].apply(window,t),s=e=>n=>(t&&(r[n]=!0),a(e,[n])),u=t=>(...r)=>{let o,[s,u,...l]=r;return o=a(t,[(...r)=>{if(!e)return i(s,r);n.push({timerId:o,fnOrCode:s,params:r,type:t})},u,...l]),o};window.setTimeout=u("setTimeout"),window.setInterval=u("setInterval"),window.requestAnimationFrame=u("requestAnimationFrame"),window.clearTimeout=s("clearTimeout"),window.clearInterval=s("clearInterval")},reset:o,pause:a=>{e=Boolean(a),e||(t=!0,n.forEach(e=>{const{timerId:t,type:n,fnOrCode:o,params:a}=e;"setInterval"===n&&r[t]||i(o,a)}),o())}}})();r.removeAllListeners("app:timers:reset"),r.removeAllListeners("app:timers:pause"),r.on("app:timers:reset",o.reset),r.on("app:timers:pause",o.pause),o.wrap(),r.action("app:window:before:load",window)},0:function(e,t,n){e.exports=n("./injection/index.js")}}); </script> </head>"Attendee Reference"
If I remove the code that removes the attribute then there is different code injected into the first cell in the file.
Does anyone know why this is happening or how I might be able to stop it from happening?
Beta Was this translation helpful? Give feedback.
All reactions