* switching to webkit for cucumber. I want to make selenium an option again, and also stop spiting out the console logs to the stdout; but for now this is very useful as we debug what is going on
This commit is contained in:
parent
912b4e76d8
commit
875090ed1d
1
Gemfile
1
Gemfile
|
|
@ -67,6 +67,7 @@ end
|
|||
|
||||
group :test, :cucumber do
|
||||
gem 'capybara'
|
||||
gem "capybara-webkit"
|
||||
gem 'capybara-screenshot'
|
||||
gem 'cucumber-rails' #, '1.3.0', :require => false
|
||||
gem 'factory_girl_rails', '4.1.0'
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<!-- modeled after dialog in original client -->
|
||||
<table style="background: #262626; color: #000000; font-family: Raleway, Arial, Helvetica, sans-serif;">
|
||||
<table style="background: #262626; color: white; font-family: Raleway, Arial, Helvetica, sans-serif;">
|
||||
<tr>
|
||||
<td width=70><%= image_tag "logo.png" %></td>
|
||||
<td><h1>New version available</h1>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
Given /^I am on the home page$/ do
|
||||
@home_page_session = Capybara::Session.new(Capybara.current_driver, Capybara.app)
|
||||
@home_page_session.visit root_path
|
||||
$home_page_session = Capybara::Session.new(Capybara.current_driver, Capybara.app)
|
||||
$home_page_session.driver.resize_window(1600, 1200)
|
||||
$home_page_session.visit root_path
|
||||
end
|
||||
|
||||
Then /^I should see "(.*?)"$/ do |content|
|
||||
@home_page_session .find("div.content-head h1").should have_content content
|
||||
$home_page_session.find("div.content-head h1").should have_content content
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ class BeforeCucumber
|
|||
|
||||
# put ActionMailer into test mode
|
||||
ActionMailer::Base.delivery_method = :test
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
if ENV['SHOW_JS_ERRORS'] == "1"
|
||||
|
|
|
|||
|
|
@ -12,7 +12,37 @@ require File.expand_path('../before_cucumber', __FILE__)
|
|||
BeforeCucumber.new
|
||||
|
||||
require 'cucumber/rails'
|
||||
require 'capybara-screenshot/cucumber' # https://github.com/mattheworiordan/capybara-screenshot
|
||||
#require 'capybara-screenshot/cucumber' # https://github.com/mattheworiordan/capybara-screenshot
|
||||
require 'capybara-webkit'
|
||||
|
||||
Capybara.register_driver :webkit do |app|
|
||||
file = File.open(Rails.root.join("log/javascript_console.log"), "w")
|
||||
Capybara::Webkit::Driver.new(app, :stdout => file)
|
||||
end
|
||||
|
||||
|
||||
After do |scenario|
|
||||
puts "tnhaounth:oantuhnaosh"
|
||||
$stdout.puts page.driver.to_s
|
||||
if page.driver.to_s.match("Webkit")
|
||||
$stdout.puts "==============================="
|
||||
$stdout.puts "= primary session console out ="
|
||||
$stdout.puts "==============================="
|
||||
$stdout.puts page.driver.console_messages
|
||||
$stdout.puts "==============================="
|
||||
$stdout.puts "= primary session error ="
|
||||
$stdout.puts "==============================="
|
||||
$stdout.puts page.driver.error_messages
|
||||
$stdout.puts "==============================="
|
||||
$stdout.puts "= second session console out ="
|
||||
$stdout.puts "==============================="
|
||||
$stdout.puts @second_session.driver.console_messages
|
||||
$stdout.puts "==============================="
|
||||
$stdout.puts "= sceond session error ="
|
||||
$stdout.puts "==============================="
|
||||
$stdout.puts @second_session.driver.error_messages
|
||||
end
|
||||
end
|
||||
|
||||
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
|
||||
# order to ease the transition to Capybara we set the default here. If you'd
|
||||
|
|
@ -62,7 +92,8 @@ end
|
|||
# end
|
||||
#
|
||||
|
||||
Capybara.javascript_driver = :selenium
|
||||
Capybara.current_driver = :webkit
|
||||
Capybara.javascript_driver = :webkit
|
||||
|
||||
# Possible values are :truncation and :transaction
|
||||
# The :transaction strategy is faster, but might give you threading problems.
|
||||
|
|
|
|||
Loading…
Reference in New Issue