Rails 4.2, rspec 3.3, capybara 2.4 gives f.QueryInterface is not a function?

I want to run feature specs on my rails app which runs on ubuntu.

I have bumped into this error:

f.QueryInterface is not a function

I list below the steps to reproduce this problem:

Install ubuntu
Install ruby 2.2.2p95
gem install rails -v 4.2.1

cd /tmp/
rails new myapp

vi Gemfile so I have this:

ruby "2.2.2"
source 'https://rubygems.org'

gem 'thin'          ,'1.6.3'
gem 'rails_12factor','0.0.3'
gem 'haml',          '4.0.6'
gem 'haml-rails',    '0.9.0'
gem 'pg',            '0.18.1'

gem 'rails', '4.2.1'

gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'

gem 'turbolinks'

gem 'jbuilder', '~> 2.0'

group :development, :test do
  gem 'websocket'         ,'1.2.2'
  gem 'ffi'               ,'1.9.8'
  gem 'childprocess'      ,'0.5.6'
  gem 'rubyzip'           ,'1.1.7'
  gem 'selenium-webdriver','2.46.2'
  gem 'xpath'             ,'2.0.0'
  gem 'capybara'          ,'2.4.4'
  gem 'rspec-support'     ,'3.3.0'
  gem 'diff-lcs'          ,'1.2.5'
  gem 'rspec-mocks'       ,'3.3.0'
  gem 'rspec-expectations','3.3.0'
  gem 'rspec-core'        ,'3.3.1'
  gem 'rspec-rails'       ,'3.3.2'
  gem 'therubyracer', platforms: :ruby

  gem 'byebug'

  gem 'web-console', '~> 2.0'

Then do this:

cd /tmp/myapp/
bundle install
bin/rails g rspec:install
echo "require 'capybara/rspec'" >> spec/spec_helper.rb
mkdir spec/features/

Then do this:

vi spec/features/myfeature_spec.rb

so I have this syntax:

describe 'some stuff which requires js', :js => true, :type => :feature do
  it 'does something' do
    visit '/hi/index'

Then do this:

bin/rails g controller hi index

bundle exec rspec spec/features/myfeature_spec.rb

screen dump of what I see:

dan@ann15:/tmp/myapp $ bundle exec rspec spec/features/myfeature_spec.rb


  1) some stuff which requires js does something
     Failure/Error: visit '/hi/index'
       f.QueryInterface is not a function
     # [remote server] file:///tmp/webdriver-profile20150621-14411-2ycb1y/extensions/fxdriver@googlecode.com/components/driver-component.js:10160:in `FirefoxDriver.prototype.get'
     # [remote server] file:///tmp/webdriver-profile20150621-14411-2ycb1y/extensions/fxdriver@googlecode.com/components/command-processor.js:12282:in `DelayedCommand.prototype.executeInternal_/h'
     # [remote server] file:///tmp/webdriver-profile20150621-14411-2ycb1y/extensions/fxdriver@googlecode.com/components/command-processor.js:12287:in `DelayedCommand.prototype.executeInternal_'
     # [remote server] file:///tmp/webdriver-profile20150621-14411-2ycb1y/extensions/fxdriver@googlecode.com/components/command-processor.js:12229:in `DelayedCommand.prototype.execute/<'
     # ./spec/features/myfeature_spec.rb:4:in `block (2 levels) in <top (required)>'

Finished in 7 seconds (files took 0.35894 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/features/myfeature_spec.rb:3 # some stuff which requires js does something

dan@ann15:/tmp/myapp $ 
dan@ann15:/tmp/myapp $ 
dan@ann15:/tmp/myapp $

I think this should not issue an error.

I am following the instructions I see at this URL:

I suspect a documentation bug.
I doubt I got all the steps I need to follow.

What are the steps I need to follow to get this to work?

Source: ruby

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.