Tuesday, 6 August 2013

Issues when testing javascript with Cucember, Capybara, Poltergeist

Issues when testing javascript with Cucember, Capybara, Poltergeist

I have a step definition to create and login a user. Without javascript it
runs fine. If you add the javascript tag to the Scenario I get some weird
behaviour. If I print out page.source or page.html or page.body I get the
html I expect but if I try page.find("anything") it can't find anything.
The only tags I can find are html, body, and head and they seem to be
empty. I have tried save_and_open_page and the page it opens displays
correctly minus the css and js files which it can't find. I have also
tried page.driver.render('screenshot.png', full: true) and it gives me the
following:
My guess is that this is the issue but I have no idea what is happening.
There seems to be an issue with my load path though. The following are
relevant files.
steps.rb
Given(/^I am an authenticated user$/) do
@user = FactoryGirl.create(:user)
visit "/users/sign_in"
puts "==============================================="
puts page.source
puts "==============================================="
puts page.find("input"
puts "==============================================="
save_and_open_page
#page.driver.render('_screenshot.png', :full => true)
fill_in "user_email", :with => @user.email
fill_in "user_password", :with => @user.password
click_button "Sign In"
end
login.feature
@javascript
Scenario: Login
Given I am an authenticated user
font-awesome.scss:25-26
..
..
..
@import "compass/css3/font-face";
$fontAwesomePath:
font-path("hummingbird_site_manager/fontawesome-webfont") !default;
..
..
..

No comments:

Post a Comment