set configurations for using cucumber and selenium

if you want to run it, update your database.yml to include cucumber and selenium environments (like in the .tmpl) and run

RAILS_ENV=selenium cucumber -p selenium
This commit is contained in:
Reinier Balt 2010-02-02 22:52:32 +01:00
parent 502e60c9a1
commit 8f349d3b6b
9 changed files with 60 additions and 20 deletions

View file

@ -31,7 +31,7 @@ Feature: View, add, remove notes
When I go to the notes page
And I delete the first note
Then the first note should disappear
Then the badge should show 1
And the badge should show 1
@selenium
Scenario: Link to note

View file

@ -1,9 +1,9 @@
Given /^I have logged in as "(.*)" with password "(.*)"$/ do |username, password|
visit login_path
fill_in "login", :with => username
fill_in "password", :with => password
click_button "Sign in"
response.body.should =~ /Login successful/m
fill_in "Login", :with => username
fill_in "Password", :with => password
click_button
response.should contain(/Login successful/)
@current_user = User.find_by_login(username)
end
@ -11,4 +11,4 @@ When /^I submit the login form as user "([^\"]*)" with password "([^\"]*)"$/ do
fill_in 'Login', :with => username
fill_in 'Password', :with => password
click_button
end
end

View file

@ -38,14 +38,18 @@ end
Given /^I have a project "([^\"]*)" with (.*) notes?$/ do |project_name, num|
project = @current_user.projects.create!(:name => project_name)
num.to_i.downto 0 do |i|
project.notes.create!(:user_id => @current_user.id, :body => "A note #{i}")
0.upto num.to_i do |i|
project.notes.create!(:user_id => @current_user.id, :body => "A note #{i+1}")
end
end
When /^I delete the first note$/ do
# need selenium for this to check on the js
pending
click_link "delete note"
end
Then /^the first note should disappear$/ do
# the first note contains "A note 1"
Then "I should not see \"A note 1\""
end
Given /^I have one project "([^\"]*)" with 1 note$/ do |arg1|
@ -99,12 +103,6 @@ visits '/notes'
should_see "new exam note"
end
Then "the first note should disappear" do
wait_for_ajax_and_effects
should_not_see 'exam note 1'
end
Then "he should see the note text" do
should_see 'exam note 1'
end

View file

@ -0,0 +1,6 @@
Webrat.configure do |config|
config.mode = :selenium
config.application_environment = :selenium
end
Cucumber::Rails::World.use_transactional_fixtures = false