Giter Club home page Giter Club logo

Comments (10)

canxerian avatar canxerian commented on August 17, 2024

The problem only appears to occur on Amazon Linux; tests run fine on OS X and Ubuntu 12.04. Our company runs Jenkins on Amazon Linux :/

from mocha-phantomjs.

canxerian avatar canxerian commented on August 17, 2024

It appeared that I an external library I was including (appmobi) was loading an FB iFrame which caused Phantomjs to fire two onloadfinished events. Still wondering why the iframe fails to load when the script is ran on ec2 but I'm closing the issue as it has nothing to do with metaskills' wonderful script!

from mocha-phantomjs.

metaskills avatar metaskills commented on August 17, 2024

Thanks and great work tracking it down!

from mocha-phantomjs.

dominicbarnes avatar dominicbarnes commented on August 17, 2024

Howdy, I came across this while trying to fix the problem I've been having. I have a widget that I'm writing tests for, and this widget basically creates an iframe to handle interaction with an external payment gateway. The src starts out as a reference to an empty HTML file, which is then changed based on params from the user.

When running mocha-phantomjs I keep seeing the Failed to load the page. error, no matter what src I try, and it also quits my test midway through. My test is initializing and destroying these widgets (along with the iframes) fairly quickly while it's testing other DOM-based assertions, which I'm guessing is triggering a download failure. (kind of like an XHR abort?)

Is using iframes in mocha-phantomjs or phantomjs just a no-no? Or am I doing something incorrectly. Thanks for your help!

from mocha-phantomjs.

metaskills avatar metaskills commented on August 17, 2024

@dominicbarnes I can not think of any reason an iframe would not work. Have you verified that the mocha tests work in a real browser first?

from mocha-phantomjs.

dominicbarnes avatar dominicbarnes commented on August 17, 2024

Yeah, that's where I started. I'm just trying to make these tests headless now.

Is it weird that i'm getting multiple Failed to load the page. errors? (basically for each time an iframe is created) Oh, and the error URL is always my input test runner file, the url never changes to reflect that it's a subresource/iframe.

Why would it be that an iframe within this page would cause an error that looks like the whole page failed?

from mocha-phantomjs.

metaskills avatar metaskills commented on August 17, 2024

Well mocha and phantomjs should be fine with it. This is exactly how Konacha when used with Poltergeist works. So it has to be something in this project. Can you find some time, create a fork, then make a test/iframe.html case and hook it up under test/src/mocha-phantomjs.coffee?

from mocha-phantomjs.

dominicbarnes avatar dominicbarnes commented on August 17, 2024

Ok, I've forked and added the test cases as you said. Here is the relevant commit and repo.

The specific case that causes mocha-phantomjs to fail is when an <iframe> is removed from the DOM before it is finished downloading it's content. (which is the first test-case in test/src/iframe.coffee)

Would you like me to create a new issue in Github?

from mocha-phantomjs.

dominicbarnes avatar dominicbarnes commented on August 17, 2024

I'm going to go ahead and push what I believe is a fix to the problem. It's a hack, unfortunately, but that seems to be the only option based on what I've seen from other people experiencing the same problem.

Basically, it looks like the onLoadFinished event is "bubbled" up from nested iframes. The only solution I've seen so far is to ensure that the onLoadFinished handler is only executed once, which should be the page in question. (and subsequent calls should be iframes) Please let me know what your thoughts are on this.

(btw, this change allows the failed tests from before to now pass)

from mocha-phantomjs.

metaskills avatar metaskills commented on August 17, 2024

Cool, BTW some of this may be helpful, or maybe no.

https://github.com/jfirebaugh/konacha/tree/master/app/assets/javascripts/konacha

Konacha has its own runner and can do things with Mocha that we are not setup to do. But something in there may be useful. Just spitballing.

from mocha-phantomjs.

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.