Watircuke¶ ↑
Webrat & Watir Family common (and some cool) steps as a gem.
Install¶ ↑
- Cucumber
- Watir ~ Firewatir ~ Safariwatir
Use¶ ↑
-
Remove step_definitions/webrat_steps.rb if you have it.
-
In the scenarios you want to run watir, just add the @watir tag before.
-
Run ‘cucumber` for webrat and `cucumber -p watir` for some Watir =D
Rails Sample¶ ↑
cucumber.yml
default: CUC_ENV=webrat -r features/support/env.rb features -t ~watir watir: CUC_ENV=watir -r features/support/env.rb features -t watir
support/env.rb
ENV["RAILS_ENV"] ||= "cucumber"
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
require 'cucumber/rails/world'
require 'cucumber/formatter/unicode' # Comment out this line if you don't want Cucumber Unicode support
Cucumber::Rails.use_transactional_fixtures
Cucumber::Rails.bypass_rescue # Comment out this line if you want Rails own error handling
if ENV['CUC_ENV'] == 'watir'
require 'watircuke'
Before do
@environment = "http://localhost:3000/
sleep 1
end
# optional
# at_exit do
# @browser.close
# end
else
require 'webrat'
Webrat.configure do |config|
config.mode = :rails
end
require 'cucumber/rails/rspec'
require 'webrat/core/matchers'
require 'webratcuke'
end
ABOUT¶ ↑
**cukewatir maximizes the Gherkin speak and minimizes the Watir code.