I keep getting an error with PhantomJS finding jQuery. Seems like on circle it can’t load the javascript. Perhaps its looking in the wrong location? I ma using a CDN (allows both HTTP and HTTPS). This is working locally.
I don’t know how to see the locations of assets files PhantomJS is trying to load on circle. Here is the error message:
Capybara::Poltergeist::JavascriptError:
One or more errors were raised in the Javascript code on the page. If you don't care about these errors, you can ignore them by setting js_errors: false in your Poltergeist configuration (see documentation for details).
ReferenceError: Can't find variable: jQuery
ReferenceError: Can't find variable: jQuery
at http://127.0.0.1:56449/dashboard/247:46 in global code
# /home/ubuntu/.rvm/gems/ruby-2.2.2/gems/poltergeist-1.8.1/lib/capybara/poltergeist/browser.rb:347:in `command'
# /home/ubuntu/.rvm/gems/ruby-2.2.2/gems/poltergeist-1.8.1/lib/capybara/poltergeist/browser.rb:34:in `visit'
# /home/ubuntu/.rvm/gems/ruby-2.2.2/gems/poltergeist-1.8.1/lib/capybara/poltergeist/driver.rb:95:in `visit'
# /home/ubuntu/.rvm/gems/ruby-2.2.2/gems/capybara-2.5.0/lib/capybara/session.rb:232:in `visit'
# /home/ubuntu/.rvm/gems/ruby-2.2.2/gems/capybara-2.5.0/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>'
# ./spec/features/dashboard_controller_feature_spec.rb:21:in `block (3 levels) in <top (required)>'
circle.yml:
database:
override:
- foreman run rake db:create db:schema:load
dependencies:
pre:
- sudo apt-get update; sudo apt-get install libicu52
- curl --output /home/ubuntu/bin/phantomjs-2.0.1-linux-x86_64-dynamic https://s3.amazonaws.com/circle-support-bucket/phantomjs/phantomjs-2.0.1-linux-x86_64-dynamic
- chmod a+x /home/ubuntu/bin/phantomjs-2.0.1-linux-x86_64-dynamic
- sudo ln -s --force /home/ubuntu/bin/phantomjs-2.0.1-linux-x86_64-dynamic /usr/local/bin/phantomjs
In spec_helper.rb
require ‘capybara/poltergeist’
…
Capybara.javascript_driver = :poltergeist