Comments (6)
Hey @markerikson, thanks for logging the issue. Will you try (or have you tried) setting modifyObstructiveCode
to false
in your cypress.json and see if that fixes your issue? We're using Penpal + Cypress on a project at work and I think this is what fixed it in our case.
from penpal.
Hmm. Here's what I was trying in the process of getting stuff to work earlier today:
- Original project setup:
[email protected]
(or so - still using the version before you went back to publishing ES5-compat syntax)- Small
cypress.json
file, no compilation related options - Result: "Must be used in an iframe" error
- Researched, found Cypress's docs on
modifyObstructiveCode
- Added
"modifyObstructiveCode": true
tocypress.json
- result: same "Must be used in an iframe" error
- Added
- Further research, found
experimentalSourceRewriting
- Added
"experimentalSourceRewriting": "true"
tocypress.json
, in addition to"modifyObstructiveCode":
true` - result: iframe loaded correctly, but Cypress pegged my CPU repeatedly and had very long delays in loading both the original page and the iframe (very understandable if it's parsing and rewriting megabytes of minified JS)
- Added
- Hand-edited the code in
node_modules/penpal/
to comment out thatvalidateWindowIsIframe()
check and turned off both of those flags- result: iframe loaded, no long delays, Cypress test now passes in 15s or so (and most of that is actually exercising the portion of the app in the iframe)
So, I never technically tried "modifyObstructiveCode": false
, but that's because it wasn't on in the first place and I assume that false
is the default.
Any further thoughts?
from penpal.
from penpal.
Huh. Clearly I misread that docs page :) It does indeed say it defaults to true
.
Yeah, I just tried uncommenting those lines in node_modules
, set "modifyObstructiveCode": false
in my cypress.json
, and rebuilt the app, and the tests (still) work.
Might still be useful to have this as an option anyway, I guess, but doesn't appear to be necessary to solve this use case now.
Thanks for helping clear that up! Feel free to close this if you don't plan to make the change.
from penpal.
I'm going to update the readme with some of these details, then probably create a new ticket to just remove the check entirely in the next major version since it probably doesn't provide a lot of value anyway.
from penpal.
I've removed the check from Penpal. This change was released in v6. Thanks!
from penpal.
Related Issues (20)
- Compatibility v4-v5 HOT 2
- Latest chrome update breaks the penpal HOT 2
- TypeScript imports with Penpal 5.2.0 HOT 6
- Serializing Objects with Functions causes an error HOT 3
- Provide typing for Connection HOT 1
- How to detect if connection with child was lost? HOT 11
- Remove check that determines if `connectToParent` is running inside iframe HOT 1
- Iframe Removal Monitoring not Working with Custom Elements HOT 7
- Export types HOT 6
- Types for the response of Promise returned after connection established HOT 2
- dynamic iframe url HOT 3
- Make parentOrigin on connectToParent required
- Including penpal in babel producing errors HOT 1
- Examples for using with React Hooks HOT 4
- error "Cannot read properties of null (reading 'postMessage')" HOT 9
- Question: Why does penpal use Window#postMessage instead of MessageChannel? HOT 2
- connected fail HOT 2
- [Penpal] Parent: Awaiting handshake
- Feature request: allow subdomains of childOrigin HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from penpal.