Giter Club home page Giter Club logo

Comments (6)

Aaronius avatar Aaronius commented on June 4, 2024

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.

markerikson avatar markerikson commented on June 4, 2024

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 to cypress.json
    • result: same "Must be used in an iframe" error
  • Further research, found experimentalSourceRewriting
    • Added "experimentalSourceRewriting": "true" to cypress.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)
  • Hand-edited the code in node_modules/penpal/ to comment out that validateWindowIsIframe() 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.

Aaronius avatar Aaronius commented on June 4, 2024

from penpal.

markerikson avatar markerikson commented on June 4, 2024

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.

Aaronius avatar Aaronius commented on June 4, 2024

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.

Aaronius avatar Aaronius commented on June 4, 2024

I've removed the check from Penpal. This change was released in v6. Thanks!

from penpal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.