-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
npm run test:*
fails with error: "Unable to find path to phantomjs"
#566
Comments
Heads-up: |
Unfortunately, I believe that the symlink fix is not portable (notably on MS Windows): |
So, |
I updated the grunt-selenium-webdriver dependency to match the tip of their GitHub master branch: |
Yes, I've been using WebDriver.io for writing tests against our ReadiumJS build, and so far have been happy with it. It has an optional test runner that is synchronous by default, which I find convenient for writing tests. I also like to use real browsers, too, as opposed to PhantomJS and the like. Thanks for following up. |
The automated Selenium tests do not work in current
develop
andmaster
branches of new clones of the repo. Clones made before Feb 18, 2016 might not have this bug, even if fast-forwarded to current branch heads. The bug only manifests ifnode_modules/
contains only dependencies in currentpackage.json
.This issue is a Bug
Related issue(s) and/or pull request(s)
See #567.
Expected Behaviour
Run tests successfully.
Observed behaviour
Instead, running the tests fails with error:
Steps to reproduce
Make a new clone of
readium-js-viewer
and check out eitherdevelop
ormaster
branches. If using an old clone made before Feb 18, 2016, fast forward to currentdevelop
ormaster
, deletenode_modules/
, and recreate it so that it matchespackage.json
dependencies exactly.Then run any of the following (might need to do
npm run dist
first?):npm run test
npm run test:chrome
npm run test:firefox
Product
The automated test suite that comes with the
readium-js-viewer
repo.Additional information
Why it's happening:
Line 42 of
build-config/selenium_webdriver.js
:...is slurping in this version of grunt-selenium-webdriver's node_modules/grunt-selenium-webdriver/tasks/selenium_webdriver.js, which is part of version 0.2.482 packaged for NPM. Lines 56-72 of this file:
Note that because this file is being slurped in and
eval
-ed bybuild-config/selenium_webdriver.js
, thatphantomLoc
is assignedbuild-config/
(by__dirname
). Hence, thisgrunt-selenium-webdriver
task is looking forphantomjs
in the mainnode_modules/
forreadium-js-viewer
, which is in fact not there anymore, as it was replaced byphantomjs-prebuilt
in the mainpackage.json
here: 2dc9bb0ee2d22f7644e60ff291afe221c576b136.A recent commit to
grunt-selenium-webdriver
seems to fix this problem:e9f63af80c8e6738b00812370c6f1ba13c5dc817. This commit is for version 0.2.530, though, and the NPM repository has only the 0.2.482 package. It is unclear when the 0.2.530 NPM release will happen: Github issue #29: Please release 0.2.530.
Temporary workaround options:
npm prepare
that creates a symlinknode_modules/grunt-selenium-webdriver/node_modules/phantomjs
->node_modules/phantomjs
:This will match this
grunt-selenium-webdriver
condition:grunt-selenium-webdriver
dependency inpackage.json
from this:...to this:
I've tested both these workarounds, and will submit a PR for the first, as that seems to be the more appropriate solution.
Even after using these workarounds, I was unable to get tests working. Please note that there is currently a problem of integration between Selenium and Firefox:
The solution at the moment seems to be either to use Firefox 47.0.1 (not 47.0 or 48.0), or to use the new, in-development GeckoDriver a.k.a. Marionette. At the time I did research on this driver, it didn't seem like it was robust enough for serious use.
I've been using a parallel Firefox 47.0.1 with success with Selenium scripts for other projects. However, because the Readium tests use
grunt-selenium-webdriver
, I was unable to figure out a way to specify an alternative Firefox or Selenium.The Chrome tests also seem to be failing. As I looked over the
tests/
directory I noticed that things seemed to be in flux, so decided not to pursue this any farther for the time being.The text was updated successfully, but these errors were encountered: