-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Can't use window.parent.frames in my iframes #2664
Comments
When applications are run within Cypress, they are run within an iframe and Cypress has had to make some modifications in order for this to work well for most applications, yet this does sometimes cause issues with applications that rely heavily on iframes. Some of this is done under the Having this work for you may actually mean you'll need to update some of your app code, to check if you app is running within Cypress. |
Ok thanks! I noticed that my test with global.self !== global.top // true
window.self !== window.top // false Should i use Or is there another way to deal with |
After some tests i found something i don't understand. If i call directly Do you know what happened ? function sendMessage(frame, message, origin) {
console.log(frame.name + ' - ' + frame.frames.length); // test-frame - 5
console.log(frame.frames[0]); // Window(...)
}
Bus.prototype.dispatchToControllerFrame = function(type, message) {
console.log(window.parent.name + ' - ' + window.parent.frames.length); // test-frame - 0
console.log(window.parent.frames[0]); // undefined
sendMessage(window.parent,message,target);
} EDIT: let test = window.parent;
console.log(test.frames.length); // 5
console.log(window.parent.frames.length); // 0 |
Thanks, setting this key to false fixed the problem for me. Cypress was replacing |
@FlorianBurgevin have you solved this issue i am also trying to send postmessage to but they are not coming |
The code for this is done in cypress-io/cypress#5273, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
This fix is available starting in {
"experimentalSourceRewriting": true
} The fix is experimental, so there may be some situations where this is not fixed. If you're still this issue while setting the |
I am having an issue, in my cypress test it is replacing window.parent by window.self in the lower environment and the test passes. but in the staging environment, it couldn't change it because of the minified js file. |
Cypress was replacing It's not described in Cypress documentation and may heavily drain your mood with the feeling of uncertainty for some time if you encounter this problem in your tests |
My AUT is also facing the same issue and even after using the modifyObstructiveCode: false the issue is not resolved. Instead the application is crashing & the executor is returning back to the /specs selection page. Thanks |
@abhiskkk-mp Please open a new issue if you're seeing this behavior as this exact issue was fixed. |
Hello,
I am building an application with iframes inside that need to communicate with each other.
In my iframe, i try to send a post message to all siblings iframes via this function:
The problem is that
window.parent.frames.length
is equal to 0 and so others iframes do not received thepostMessage
and my app does not work.There is no problem with this integration in classic browsers.
Can someone help me ?
Thanks
I have the same problem trying to compare
window.parent
&window.self
. It always return true while i'm executing it in my iframe.if (window.self !== window.parent) {}
The text was updated successfully, but these errors were encountered: