Comments (10)
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.
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.
Thanks and great work tracking it down!
from mocha-phantomjs.
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.
@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.
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.
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.
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.
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.
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)
- Error codes should be exposed to terminal HOT 4
- "'undefined' is not a function (evaluating 'mocha.ui('bdd')')" HOT 5
- travis ci build failing on no-colors test HOT 2
- Mac OS Sierra cannot run PhantomJS 1.9.7 HOT 3
- Add junit xml format. HOT 2
- Separate console output and test results HOT 1
- phantomjs package deprecated HOT 3
- websocket opened and then closed immediately. HOT 3
- I can only get it to work with absolute paths..... HOT 2
- Output file no data HOT 1
- Calling phantomJS function HOT 4
- will it support slimerjs in docker container(ubuntu) HOT 5
- Low contrast terminal output with corrupt characters HOT 3
- phantom doesn't have cookie(?) HOT 1
- Can't find window.__coverage__ variable when using with Istanbul HOT 2
- phantomjs terminated with signal SIGSEGV HOT 1
- Please Updae Phantomjs Version HOT 2
- how to use Page Module inside tests HOT 2
- update mocha-phantomjs-core HOT 4
- Security Warnings in newer version : npm audit
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 mocha-phantomjs.