Ember-cli: Tests hang with latest release of PhantomJS

Created on 2 Feb 2016  路  43Comments  路  Source: ember-cli/ember-cli

Had to downgrade to 1.9.x.

bug

Most helpful comment

on Ember 2.7.0, changing

<script src="testem.js" integrity=""></script>

to

<script src="{{rootURL}}testem.js" integrity=""></script>

worked fine for me.

All 43 comments

please provide additional reproduction steps. As this works in many apps that I use, and works with the default app.

Details on how to submit a good report are in CONTRIBUTING.md which one is prompted to read before posting and issue.

  • OS - Mac OS X 10.11.3
  • npm veresion - 3.6
  • ember version - 2.3.0
  • steps to reproduce:

    • npm install --save-dev phantomjs-prebuilt

    • npm test

danke

Attempting to make an example repo.

Thank you, that will be very helpful.

Guys, is there any way to get some verbose output during ember test so I can narrow down what's hanging?

I ask because I couldn't duplicate it in a fresh project, so it must be some combination of modules I'm using.

For a giant flood of debug messages try:

DEBUG=* ember test

Phantom JS produces possibly the most frustrating troubleshooting experiences that I've experienced since developing ember apps..

The issue is likely a JS parse issue because phantom js uses an ancient WebKit.. Your best bet is to use remote debugging to connect to the failed phantom js session..

See http://bumbu.me/remotely-debug-phantomjs/ .. Testem supports setting this value using the phantomjs_debug_port option

Parse error might not be the issue if your issue is on phantomjs 2 but the rest should help

@jmurphyau Starting that...

Ok, this is what I'm seeing. Any help decoding what this means would help me track it down further. This is where it's hanging:

screen shot 2016-02-04 at 1 18 04 pm
screen shot 2016-02-04 at 1 17 20 pm

Actually, I don't think those lines are the issue anymore. I've completely removed most of my tests to run down the problem and it seems to still hang.

Ok everybody, after upgrading to the latest _everything_ this is now what I see:

version: 2.3.0
Built project successfully. Stored in "/Users/devinus/Projects/rebelmail-dashboard/tmp/class-tests_dist-AomFKkIW.tmp".
not ok 1 Browser "phantomjs /Users/devinus/Projects/rebelmail-dashboard/node_modules/testem/assets/phantom.js http://localhost:7357/6864" failed to connect. testem.js not loaded?

1..1
# tests 1
# pass  0
# skip  0
# fail  1
npm ERR! Test failed.  See above for more details

We definitely need to be able to reproduce this to help out...

We had the same issue. Tests were hanging on CircleCI with PhantomJS 2.0 but work fine with normal PhantomJS. I will try to help to reproduce when I have a bit more time

UPDATE: All works fine with PhantomJS 2.1.1 so maybe not the same issue.

@devinus - I saw the same thing after upgrading to 2.3. I was missing integrity="" in my testem.js import in tests/index.html.

I was missing integrity="" in my testem.js import in tests/index.html.

@devinus does this address the issue? or..

Would love a reproduction, even if you privately share your app with me...

@stefanpenner I unfortunately already had that.

not ok 1 Browser "phantomjs /Users/devinus/Projects/rebelmail-dashboard/node_modules/testem/assets/phantom.js http://localhost:7357/8039" failed to connect. testem.js not loaded?

I'm seeing this:

Refused to frame 'http://localhost:7357/testem/connection.html' because it violates the following Content Security Policy directive: "default-src 'none'". Note that 'frame-src' was not explicitly set, so 'default-src' is used as a fallback.

Also this later on:

screen shot 2016-02-25 at 2 52 31 am

Finally! It seems after removing ember-cli-content-security-policy from my package.json it starts to run (with a BUNCH of new output, including deprecation output messages I never got with Phantom 1.9. Not sure what's up with that?)

So now the question is, how do I make this work without disabling SRI?

I'm having the same problem in my repo. The one I'm currently trying to troubleshoot is giving me:

Browser "pathToApp/node_modules/phantomjs/lib/phantom/bin/phantomjs pathToApp/node_modules/ember-cli/node_modules/testem/assets/phantom.js http://localhost:7357/6123" failed to connect. testem.js not loaded?

@jmurphyau @devinus Where did you place the test.js within your application and what url did you pass to open() in it when remote debugging PhantomJS? I've tried different combinations but have not been successful.

This is a partial of my _tests/index.html_ file:

    <script src="testem.js" integrity=""></script>
    <script src="assets/vendor.js"></script>
    <script src="assets/test-support.js"></script>
    <script src="assets/myApp.js"></script>
    <script src="assets/tests.js"></script>
    <script src="assets/test-loader.js"></script>

I'm running "phantomjs": "1.9.19" and have never been on 2.

@notmessenger My issue was "solved" by removing ember-cli-content-security-policy from my package.json. Maybe @rwjblue could chrime in, but otherwise you can debug Phantom by opening http://localhost:9000 after putting "phantomjs_debug_port": 9000 in your testem.json file.

ember-cli-content-security-policy from my

this is no longer part of a default ember init/new

Would love a reproduction, even if you privately share your app with me...

i'll gladly reopen if ^^ can be provided. WIthout that, this isn't terribly actionable.

@stefanpenner I'm confused.. I just ran into this when trying to spin up testing for an ember 2.5 app that also has content security policy set. is the only way to fix this to remove that?

@erichonkanen No, it's a problem with ember-csp: https://github.com/rwjblue/ember-cli-content-security-policy/issues/63

If anyone has this error: not ok 1 Browser "phantomjs /Users/devinus/Projects/rebelmail-dashboard/node_modules/testem/assets/phantom.js http://localhost:7357/6864" failed to connect. testem.js not loaded?

In my case was caused by an invalid test_page in testem.json.

@IAmJulianAcosta what was the invalid vs valid diff on that field?

@billpull in my case it was a malformed URL, IIRC, I used tests/index.html&params, instead of tests/index.html?params

Same issue. Getting the failed to connect. testem.js not loaded? message. I have a baseURL set in my environment. Setting it to '' in the test environment fixes running the tests from the command line, but I'm no longer able to run the tests in the browser.

I've got a rather complicated set up, including running haproxy.

has this been solved? I see that the issue is closed

Also ran into this and the issue in my case was that I had added loading of 3rd party libraries(Mapbox and Stripe in my case) from their CDN hosting to my tests/index.html. I was already not using _ember-cli-content-security-policy_ in this app so that was not an issue. Removing load of the 3rd party libraries fixed the issue.

on Ember 2.7.0, changing

<script src="testem.js" integrity=""></script>

to

<script src="{{rootURL}}testem.js" integrity=""></script>

worked fine for me.

Hmm. I suspect that you have a custom rootURL, and that you are being bitten by https://github.com/ember-cli/ember-cli/pull/6189.

actually, I must have missed that change when I ran ember init to update my project.
I just realised though that this is an old ticket, and everyone else above probably had a different issue.

@mschinis that solution actually helped me tremendously. I also missed that change during the ember init portion of my 2.7.0 upgrade and was having the same issue. Was driving me crazy and stumbled upon this. Thanks for pointing that out!

If nothing works always keep calm and update phantomjs.

I had a similar problem as many people here. Error message I saw looks something like this.

version: 2.3.0
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://www.ember-cli.com/user-guide/#watchman for more info.
Building...
DEPRECATION: ember-cli-htmlbars-inline-precompile is opting out of caching due to an AST plugin that does not provide a caching strategy: `transform-liquid-with-as-to-hash`.
DEPRECATION: ember-cli-htmlbars is opting out of caching due to an AST plugin that does not provide a caching strategy: `transform-liquid-with-as-to-hash`.
DEPRECATION: this.mergeTrees is deprecated, please use broccoli-merge-trees directly instead  [addon: ember-cli-raw-handlebars]
DEPRECATION: ember-cli-htmlbars is opting out of caching due to an AST plugin that does not provide a caching strategy: `transform-liquid-with-as-to-hash`.
[BABEL] Note: The code generator has deoptimised the styling of "webclient-cli/templates/components/search-popout.js" as it exceeds the max of "100KB".
[BABEL] Note: The code generator has deoptimised the styling of "webclient-cli/templates/profile/index.js" as it exceeds the max of "100KB".
Built project successfully. Stored in "/Users/jasonkim/work/node/webclient-cli/tmp/class-tests_dist-21fjNfyK.tmp".
not ok 1 Error
    ---
        message: >
            Launcher PhantomJS not found. Not installed?
    ...

1..1
# tests 1
# pass  0
# skip  0
# fail  1

Here's what I did to fix it.

  1. Remove phantom.js package from package.json in devDependencies.
  2. Remove phantom.js from Homebrew
  3. Install phantom.js globally using npm.

I was able to solve this issue by upgrading to the latest version of Ember CLI, 2.11.0.

Im currently experiencing this issue. phantom.js hangs with Built project successfully. Stored in ... message. Currently running ember-cli 2.11.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RSSchermer picture RSSchermer  路  39Comments

stefanpenner picture stefanpenner  路  28Comments

calvinmetcalf picture calvinmetcalf  路  45Comments

GavinJoyce picture GavinJoyce  路  31Comments

musaffa picture musaffa  路  51Comments