0

I was playing around with selenium via rspec but was dissatisfied and I saw recommendations for poltergeist. When I try to run it with my tests, it seems like the poltergeist driver doesn't show up where it should. I was a little confused where rack test fits in with poltergeist but I tried many different things. I then found this simple example and tried to get that to work but still no luck. I am using jruby on windows.

I am using the example found here: https://gist.github.com/pzol/1607842 I moved all my code into one file, there is no spec helper for this case

I did install phantomjs and ran a little hello world example for phantomjs and it is in my path

require 'rspec'
require 'capybara/rspec'
require 'capybara/poltergeist'

Capybara.javascript_driver = :poltergeist

Capybara.register_driver :poltergeist do |app|
  Capybara::Poltergeist::Driver.new(app, debug: true)
end

describe 'poltergeist', :type => :request, :js => true do

  it 'should find github poltergeist in google' do
    visit 'http://www.google.com/'
    fill_in "q", :with => "github poltergeist"
    click_button "btnK"
    page.should have_content 'jonleighton/poltergeist'
  end
end

jruby -S rspec poltergeist-test2.rb F

Failures:

1) poltergeist should find github poltergeist in google Failure/Error: visit 'http://www.google.com/' NoMethodError: undefined method visit' for #<RSpec::Core::ExampleGroup::Nested_1:0x4324 4fd9> # ./poltergeist-test2.rb:18:in(root)'

Finished in 0.01 seconds 1 example, 1 failure

Failed examples:

rspec ./poltergeist-test2.rb:17 # poltergeist should find github poltergeist in google

user1456508
  • 3,761
  • 2
  • 15
  • 11

1 Answers1

1

hmmm, well I was looking at capybara docs some more and I changed this line:

describe 'poltergeist', :type => :request, :js => true do

to this line, where I made :type to be :feature and now it seems to be ok ..

describe 'poltergeist', :type => :feature, :js => true do

Seems in my google searches the other day I saw something on that but wasn't sure and at the moment I am not clear what the difference is but I am making progress it appears

user1456508
  • 3,761
  • 2
  • 15
  • 11