Symfony: {{ dump() }} creates an iframe

That’s it, that’s the message.

Some context

You are here for the story behind? I’m happy to tell you, but might be boring 🙂 I’m still working on a payment plugin for Shopware 6 and because the damn iframe for card payment and blik is changing its name all the time, I’ll access it in my cypress tests via:

cy.iframe('iframe:nth-child(1)')

which works well – except if you have a {{ dump() }} on your page, because then the BLIK iframe is not the first child 🙂

Prefixed CSS classes for special purpose

So make sure your tests are stable. You can even think about adding prefixed CSS classes like js- so your frontend colleagues now, that is something important for JS, so I shouldn’t remove it or cy- so everyone knows that is something important for cypress. You can have all kind of classes which are not for CSS, which make it easier in a bigger team.

Thanks for sharing, but I recommend not to use “js” prefixed CSS classes, use data attributes instead.

Good addition by Wahid Rahim on LinkedIn, thanks for that!

But why not?

But I couldn’t, because the iframe is created by a JS library ? So I’ll do my best.

Leave a Reply