-
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
Add Iframe Switching API's #685
Comments
Related to: |
This would be amazing! I like to try and keep all of the work in |
Such a shame this is not in, I can not use the tool witouth this feautre :( makes it very hard to test legacy aplications |
This comment has been minimized.
This comment has been minimized.
2 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
What about having Cypress automatically switch to the iframe if the element you |
@ianwalter how would Cypress know to find the element in the iframe? Iframes are completely separate windows and documents. It's not going to just "automatically" find them unless it queried across every single one. What if you did The only way to do to this is with frame switching APIs. @jusefb I'm confused... you can utilize iframes right now per this comment: #136 (comment) Sure it's not as nice as iframe switching API's but it does work right now. |
@brian-mann No I meant if you specifically get an iframe element it would automatically switch, so instead of Another idea: |
Sure, the The harder part is doing all of the rest of the things that we do for the parent Also when it comes to snapshotting, we currently don't snapshot inside of iframes. We'd have to do that (else this feature would be worthless) - but it may mean we'd have to snapshot both the parent document AND the iframe. Those API's don't currently take this into account. Same thing for element highlighting. There are some other complexities that I can't remember at the moment but are in my notes somewhere. That's the stuff that's been blocking this from getting done. The half ass solution is mostly good enough which is why this hasn't been a super high priority. |
Oh for sure, I understand that this is a big feature and I'm only talking about the API layer. Just wanted to add some ideas to make the API nicer to use once all the hard parts are taken care of. IMHO, I would rather not have to chain commands like in the initial example, but using an alias or a promise is fine with me. |
This comment has been minimized.
This comment has been minimized.
2 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
+1, this is blocking my company from using cypress. Otherwise, Cypress looks amazing. |
any news on the completion of this new function |
@brian-mann are there any updates on where this sits in the roadmap? |
This feature is still in the 'proposal' stage. No work has been done on this feature as of yet. We're a small team and as much as we'd love to work on everything, we have to choose what to work on based on a multitude of things. |
@jennifer-shehane I totally understand (particularly when things are open source), just wanted to see if there's anything that can be done from the outside to help make progress. It sounds like there are a number of people here who may be willing to contribute to it moving forward. |
I see that on the road-map this is listed as "partially complete", just wondering if there's any code anywhere for it, would love to help. |
So actually there IS a "not-so-easy" way to switch to iframes. Would you mind to point me to the docs that explain how to do it? |
Many people have listed some workarounds to iframes in this issue: #136 |
for many SAAS / Cloud offerings the lack of this feature is showstopper, as integrations mostly happen within IFrames |
+1 - Just faced this when trying to test a Payment form that uses Stripe Elements which happens to use iFrame too |
This comment has been minimized.
This comment has been minimized.
Something like: .get('iframe.stripe_checkout_app')
.then(function ($iframe) {
const $body = $iframe.contents().find('body')
cy
.wrap($body)
.find('input:eq(0)')
.type('4242424242424242')
cy
.wrap($body)
.find('input:eq(1)')
.type('1222')
cy
.wrap($body)
.find('input:eq(2)')
.type('123')
}) |
same was used here I guess https://medium.com/bratislava-angular/testing-an-app-inside-an-iframe-using-cypress-434a4d8b8bbe but with checking if the element is ready already |
UPDATE
As of
0.20.0
it's possible to runcy.*
commands on iframe elements as documented here: #136 (comment)However you still can't "easily" switch to iframe context which prevents you from using commands like
cy.get()
What users want
<iframe>
and then utilize all the regularcy.*
commands within this context.What we need to do
cy
commands to switch into iframes and then also switch back to the "main" frame.Things to consider
<iframe>
.{ chromeWebSecurity: false }
.Examples of how we could do this
The text was updated successfully, but these errors were encountered: