Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

"Cannot launch browser phantomjs" in v4.4.2 #528

Closed
niedzielski opened this issue Jul 21, 2016 · 31 comments
Closed

"Cannot launch browser phantomjs" in v4.4.2 #528

niedzielski opened this issue Jul 21, 2016 · 31 comments

Comments

@niedzielski
Copy link
Contributor

Output of gemini --version: 4.4.2

Contents of .gemini.yml file:

rootUrl: http://localhost:8080
browsers:
  phantomjs:
    gridUrl: http://localhost:8910
    desiredCapabilities:
      browserName: phantomjs

Test source code:

const phantom = require('phantomjs')

const viewports = [{w: 160, h: 144}, {w: 320, h: 240}, {w: 480, h: 320},
  {w: 640, h: 480}]

gemini.suite('zzz-card', function(suite) {
  suite
    .setUrl('/test/screenshot/fixture/zzz-card.html')
    .setCaptureElements('body')
    .before(function(actions, find) {
      actions.wait(1000)
    })
  viewports.forEach(function(viewport) {
    suite
      .capture('zzz-card-' + viewport.w + 'x' + viewport.h, function(actions, find) {
        actions.setWindowSize(viewport.w, viewport.h)
      })
  })
})

Command used to run the test:

Setup:

http-server -c-1&
phantomjs -w&

Run tests from command line:

gemini test foo.js

Run tests from GUI:

gemini-gui foo.js

Command line result:

✘ zzz-card zzz-card-160x144 [phantomjs]
Cannot launch browser phantomjs:
undefined while parsing file: /home/stephen/Desktop/lizzztlib/node_modules/gemini/lib/browser/client-scripts/gemini.js.
✘ zzz-card zzz-card-320x240 [phantomjs]
Cannot launch browser phantomjs:
undefined while parsing file: /home/stephen/Desktop/lizzztlib/node_modules/gemini/lib/browser/client-scripts/gemini.js.
✘ zzz-card zzz-card-480x320 [phantomjs]
Cannot launch browser phantomjs:
undefined while parsing file: /home/stephen/Desktop/lizzztlib/node_modules/gemini/lib/browser/client-scripts/gemini.js.
✘ zzz-card zzz-card-640x480 [phantomjs]
Cannot launch browser phantomjs:
undefined while parsing file: /home/stephen/Desktop/lizzztlib/node_modules/gemini/lib/browser/client-scripts/gemini.js.
Total: 4 Passed: 0 Failed: 4 Skipped: 0 Retries: 0

http-server and PhantomJS output from command line test:

Starting up http-server, serving ./
Available on:
  http://127.0.0.1:8080
  http://192.168.1.11:8080
Hit CTRL-C to stop the server
[INFO  - 2016-07-21T02:50:21.242Z] GhostDriver - Main - running on port 8910
[INFO  - 2016-07-21T02:50:25.145Z] Session [dfdd8070-4eed-11e6-84ec-817f1efe0ddc] - page.settings - {"XSSAuditingEnabled":false,"javascriptCanCloseWindows":true,"javascriptCanOpenWindows":true,"javascriptEnabled":true,"loadImages":true,"localToRemoteUrlAccessEnabled":false,"userAgent":"Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.1.1 Safari/538.1","webSecurityEnabled":true}
[INFO  - 2016-07-21T02:50:25.145Z] Session [dfdd8070-4eed-11e6-84ec-817f1efe0ddc] - page.customHeaders:  - {}
[INFO  - 2016-07-21T02:50:25.145Z] Session [dfdd8070-4eed-11e6-84ec-817f1efe0ddc] - Session.negotiatedCapabilities - {"browserName":"phantomjs","version":"2.1.1","driverName":"ghostdriver","driverVersion":"1.2.0","platform":"linux-unknown-64bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"}}
[INFO  - 2016-07-21T02:50:25.145Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: dfdd8070-4eed-11e6-84ec-817f1efe0ddc

GUI result for every test:

GeminiError: Cannot launch browser phantomjs:
undefined while parsing file: /home/stephen/Desktop/lizzztlib/node_modules/gemini/lib/browser/client-scripts/gemini.js.
    at exports.cloneError (/home/stephen/Desktop/lizzztlib/node_modules/gemini/lib/errors/utils.js:19:19)
    at _suite.states.map (/home/stephen/Desktop/lizzztlib/node_modules/gemini/lib/runner/suite-runner/regular-suite-runner.js:40:59)
    at Array.map (native)
    at inherit._passErrorToStates (/home/stephen/Desktop/lizzztlib/node_modules/gemini/lib/runner/suite-runner/regular-suite-runner.js:39:35)
    at _browserAgent.getBrowser.then.then.catch (/home/stephen/Desktop/lizzztlib/node_modules/gemini/lib/runner/suite-runner/regular-suite-runner.js:30:32)
    at _rejected (/home/stephen/Desktop/lizzztlib/node_modules/q/q.js:844:24)
    at /home/stephen/Desktop/lizzztlib/node_modules/q/q.js:870:30
    at Promise.when (/home/stephen/Desktop/lizzztlib/node_modules/q/q.js:1122:31)
    at Promise.promise.promiseDispatch (/home/stephen/Desktop/lizzztlib/node_modules/q/q.js:788:41)
    at /home/stephen/Desktop/lizzztlib/node_modules/q/q.js:604:44

Expected behaviour:
This worked properly in v4.4.1 but doesn't in v4.4.2.

@frux
Copy link

frux commented Jul 21, 2016

The same. Workaround is to fix v4.4.1.

UPD: I have this issue with: IE, Chrome, Firefox, Opera. I didn't try phantomjs but I sure it is the same.

@sipayRT
Copy link
Member

sipayRT commented Jul 21, 2016

hi. can you provide phantomjs version?

@sipayRT
Copy link
Member

sipayRT commented Jul 21, 2016

in my case with your config I got this report (firefox was added to compare results):
image

phantomjs version 2.1.1

@niedzielski
Copy link
Contributor Author

Hello! I'm using PhantomJS v2.1.7.

On Jul 21, 2016 5:59 AM, "sipayrt" notifications@github.com wrote:

in my case with your config I got this report (firefox was added to compare
results):
[image: image]
https://cloud.githubusercontent.com/assets/1658415/17021885/81b265ea-4f53-11e6-8734-c9529f9a71b7.png

phantomjs version 2.1.1


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#528 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABBavnwkA5JnbAIINmTeHTsIv-v-eepSks5qX18GgaJpZM4JRZeP
.

@sipayRT
Copy link
Member

sipayRT commented Jul 29, 2016

sorry for delay. Can you provide your node version. We can reproduce it on v6.x version, but gemini was tester only with v4.x

@niedzielski
Copy link
Contributor Author

o/ I'm on Node v6.3.0.

@sipayRT
Copy link
Member

sipayRT commented Aug 1, 2016

@niedzielski tnx, will be fixed - #537

@rostik404
Copy link
Contributor

rostik404 commented Aug 5, 2016

@niedzielski, try to update Node.js to 6.3.1 and reinstall gemini to a latest version, please.

@hojbota
Copy link

hojbota commented Aug 9, 2016

I have the same issue with gemini --version 4.5.0 and node v6.3.1, I get:
Cannot launch browser chrome:
undefined while parsing file: /Users/sergiuhojbota/new_framework/Yieldify-Testing/ruby/projects/yieldify_khaleesi_e2e/node_modules/gemini/lib/browser/client-scripts/gemini.js.

@hojbota
Copy link

hojbota commented Aug 9, 2016

Tried also node -v5.8.0, npm -v3.9.0,gemini@4.4.1 and got the same error, I don't think it is related to the versions

@niedzielski
Copy link
Contributor Author

@rostik404, thanks for working on this issue and sorry for the super delay! Ok, I downloaded Node v6.3.1 and upgraded Gemini to v4.5.0. I'm still seeing same issue from the command line and gemini-gui. Here's the GUI output for each test:

GeminiError: Cannot launch browser phantomjs:
undefined while parsing file: /home/stephen/dev/js/lizzzt/lizzztlib/node_modules/gemini/lib/browser/client-scripts/gemini.js.
    at initSession.then.then.then.then.then.then.catch (/home/stephen/dev/js/lizzzt/lizzztlib/node_modules/gemini/lib/browser/new-browser.js:124:31)
    at _rejected (/home/stephen/dev/js/lizzzt/lizzztlib/node_modules/q/q.js:844:24)
    at /home/stephen/dev/js/lizzzt/lizzztlib/node_modules/q/q.js:870:30
    at Promise.when (/home/stephen/dev/js/lizzzt/lizzztlib/node_modules/q/q.js:1122:31)
    at Promise.promise.promiseDispatch (/home/stephen/dev/js/lizzzt/lizzztlib/node_modules/q/q.js:788:41)
    at /home/stephen/dev/js/lizzzt/lizzztlib/node_modules/q/q.js:604:44
    at runSingle (/home/stephen/dev/js/lizzzt/lizzztlib/node_modules/q/q.js:137:13)
    at flush (/home/stephen/dev/js/lizzzt/lizzztlib/node_modules/q/q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

@PandaTheGrim
Copy link

Having same issues with selenium webdriver.
gemini@4.6.0 and node 6.4.0

@mickaelperrin
Copy link

mickaelperrin commented Aug 19, 2016

Can confirm that the problem is not related to PhantomJS (having troubles with Selenium also) but more with the version of node.

Using node in version 4 resolved the problem for me.

@weaintplastic
Copy link

I can tell that it is working with node 4.2.3 but not with 6.4.0.

@rostik404
Copy link
Contributor

The problem is related with version of uglify-js in uglifyify. There is a pull request in the uglifyify and you can thumb up a comment to quickly merge.
hughsk/uglifyify#55

@SevInf
Copy link
Contributor

SevInf commented Aug 24, 2016

@rostik404 uglifyify has the dependency on uglify 2.x.x which allows 2.7.x to be installed, and that is exactly what happens on the fresh installation.

@rostik404
Copy link
Contributor

@SevInf, but if you use npm v3, which has a flat node_modules structure, uglifyify will be using uglify-js 2.3.6 from the node_modules root.

@SevInf
Copy link
Contributor

SevInf commented Aug 24, 2016

@rostik404 no, it won't:

>cat ./node_modules/uglify-js/package.json | grep version
  "version": "2.7.3",

@rostik404
Copy link
Contributor

@SevInf, but I'm getting this:

>cat gemini/node_modules/uglify-js/package.json | grep version
  "version": "2.3.6"

@SevInf
Copy link
Contributor

SevInf commented Aug 24, 2016

@rostik404, ok, I think I see why we have different results.

I run npm install in gemini directory itself, which means dev dependencies will also be installed. gemini have dev dependency on uglify@^2.7.0, so this is the one I get on a top level.

You installation did not include dev dependencies, which means uglify 2.3.6 is a bubbled up dependecy of some other library.

Which, in turn means that if we want uglifyify to use uglify 2.7 we just need to move it to dependencies instead of devDependencies and there is no need to nag maintainers of other projects.

hannesj added a commit to HSLdevcom/digitransit-ui that referenced this issue Aug 24, 2016
@rostik404
Copy link
Contributor

rostik404 commented Aug 24, 2016

@SevInf, I think, that more correct would be to fix dependencies in uglifyify, because we don't need uglify-js in gemini dependencies.

cc @j0tunn, @sipayRT

@SevInf
Copy link
Contributor

SevInf commented Aug 24, 2016

@rostik404 yes, we need it. The tool is broken without it. And there is nothing to fix in uglifyify, because its version range allows installation of 2.7.0. There is nothing in uglifyify, which requires 2.7.0.

@j0tunn
Copy link
Contributor

j0tunn commented Aug 24, 2016

There is nothing in uglifyify, which requires 2.7.0.

We are using uglifyify and it fails. Why the hell there is nothing in uglifyify, which requires 2.7.0?

Lets wait for a few more days. If it will not be fixed than we'll add it to our dependencies

@SevInf
Copy link
Contributor

SevInf commented Aug 24, 2016

We are using uglifyify and it fails. Why the hell there is nothing in uglifyify, which requires 2.7.0?

Because uglifyify job is to run whichever version of uglify you provide during browserify build. We don't provide any and it uses what it could find.

@j0tunn
Copy link
Contributor

j0tunn commented Aug 24, 2016

Ok. You've convinced me. Lets add it.

@sipayRT
Copy link
Member

sipayRT commented Aug 26, 2016

check it with gemini v4.7.2 pls

@SevInf
Copy link
Contributor

SevInf commented Aug 26, 2016

@sipayRT for us it is fixed.

@sipayRT
Copy link
Member

sipayRT commented Aug 26, 2016

tnx

@sipayRT sipayRT closed this as completed Aug 26, 2016
@niedzielski
Copy link
Contributor Author

Yay!! I'm looking forward to testing it! I seem to be blocked by a different issue (#569) at the moment but will follow up here as soon as it's fixed!

@niedzielski
Copy link
Contributor Author

#569 closed. This works too! 👍

@Demven
Copy link

Demven commented Sep 7, 2016

Thanks a lot for this fix!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests