Skip to content
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

Unable to use in an iframe #179

Closed
tyhopp opened this issue May 15, 2022 · 4 comments
Closed

Unable to use in an iframe #179

tyhopp opened this issue May 15, 2022 · 4 comments

Comments

@tyhopp
Copy link

tyhopp commented May 15, 2022

Hi @adamdbradley, thanks for the great library.

We are integrating Partytown into Gatsby's new script component and one issue we've encountered is testing Partytown usage in Cypress.

The Partytown snippet hits this code path, dispatching an event that registerWindow in the sandbox listens for but never receives.

Is there anything else we need to do to generally to make Partytown work in Cypress?

@tyhopp
Copy link
Author

tyhopp commented May 15, 2022

Created a reproduction, turns out Partytown works fine in an iframe but does not work in Cypress' iframe. We're using Partytown's exported React component.

Reproduction repo: https://github.com/tyhopp/partytown-cypress-reproduction

This isn't exactly a concern of the Partytown library itself since Cypress is a separate tool, but given its widespread usage it would be great if you could provide some direction on this. I doubt we'll be the only ones trying to test Partytown in Cypress.

Thank you!

@tyhopp tyhopp changed the title Usage in an iframe Test Partytown in Cypress May 15, 2022
@steve8708
Copy link
Contributor

Ah yes great find, I would suggest filing an issue with Cypress for this as it appears to be an issue on that side as opposed to for Paryttown directly. If you believe I am wrong though, feel free to reopen this

@tyhopp
Copy link
Author

tyhopp commented Jun 7, 2022

Hi @steve8708, I revisited this again and wasn't able to use Partytown successfully in an iframe. Here's a reproduction - https://github.com/tyhopp/partytown-iframe-reproduction. Is there something I'm missing? I wasn't able to find a test for this specific case to copy

@tyhopp tyhopp changed the title Test Partytown in Cypress Unable to use in an iframe Jun 7, 2022
@TheFedaikin
Copy link

TheFedaikin commented Sep 6, 2022

Can confirm it's not working within iframe - was using it with proprietary analytics and it was failing because it needs an iframe to be able to function fully. The reproduction above looks right to me and it highlights the issue, but if needed I can make another one.

Can we reopen this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants