mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-09 00:54:21 +01:00
add scenario to show bug #972
took me a while to figure out that drag_and_drop does not wait for ajax to finish
This commit is contained in:
parent
8191268821
commit
c0db9b41b9
5 changed files with 88 additions and 41 deletions
|
|
@ -1,3 +1,7 @@
|
|||
Given /^I have one project "([^\"]*)" with no notes$/ do |project_name|
|
||||
@current_user.projects.create!(:name => project_name)
|
||||
end
|
||||
|
||||
Given /^I have two projects with one note each$/ do
|
||||
project_a = @current_user.projects.create!(:name => 'project A')
|
||||
project_a.notes.create!(:user_id => @current_user.id, :body => 'note for project A')
|
||||
|
|
@ -5,26 +9,38 @@ Given /^I have two projects with one note each$/ do
|
|||
project_b.notes.create!(:user_id => @current_user.id, :body => 'note for project B')
|
||||
end
|
||||
|
||||
Then /^(.*) notes should be visible$/ do |number|
|
||||
# count number of project_notes
|
||||
count = 0
|
||||
response.should have_xpath("//div[@class='project_notes']") { |nodes| nodes.each { |n| count += 1 }}
|
||||
count.should == number.to_i
|
||||
Given /^I have a project "([^\"]*)" with (.*) notes?$/ do |project_name, num|
|
||||
project = @current_user.projects.create!(:name => project_name)
|
||||
1.upto num.to_i do |i|
|
||||
project.notes.create!(:user_id => @current_user.id, :body => "A note #{i}. This is the very long body of note #{i} where you should not see the last part of the note after 50 characters")
|
||||
end
|
||||
end
|
||||
|
||||
When /^I click Toggle Notes$/ do
|
||||
click_link 'Toggle notes'
|
||||
end
|
||||
|
||||
Given /^I have one project "([^\"]*)" with no notes$/ do |project_name|
|
||||
@current_user.projects.create!(:name => project_name)
|
||||
end
|
||||
|
||||
When /^I add note "([^\"]*)" from the "([^\"]*)" project page$/ do |note, project|
|
||||
project = Project.find_by_name(project)
|
||||
project.notes.create!(:user_id => @current_user.id, :body => note)
|
||||
end
|
||||
|
||||
When /^I delete the first note$/ do
|
||||
click_link "delete note"
|
||||
selenium.get_confirmation.should == "Are you sure that you want to delete the note '1'?"
|
||||
end
|
||||
|
||||
When /^I click the icon next to the note$/ do
|
||||
click_link "Show note"
|
||||
end
|
||||
|
||||
Then /^(.*) notes should be visible$/ do |number|
|
||||
# count number of project_notes
|
||||
count = 0
|
||||
response.should have_xpath("//div[@class='project_notes']") { |nodes| nodes.each { |n| count += 1 }}
|
||||
count.should == number.to_i
|
||||
end
|
||||
|
||||
Then /^I should see note "([^\"]*)" on the "([^\"]*)" project page$/ do |note, project|
|
||||
project = Project.find_by_name(project)
|
||||
visit project_path(project)
|
||||
|
|
@ -36,26 +52,11 @@ Then /^I should see note "([^\"]*)" on the notes page$/ do |note|
|
|||
Then "I should see \"#{note}\""
|
||||
end
|
||||
|
||||
Given /^I have a project "([^\"]*)" with (.*) notes?$/ do |project_name, num|
|
||||
project = @current_user.projects.create!(:name => project_name)
|
||||
1.upto num.to_i do |i|
|
||||
project.notes.create!(:user_id => @current_user.id, :body => "A note #{i}. This is the very long body of note #{i} where you should not see the last part of the note after 50 characters")
|
||||
end
|
||||
end
|
||||
|
||||
When /^I delete the first note$/ do
|
||||
click_link "delete note"
|
||||
selenium.get_confirmation.should == "Are you sure that you want to delete the note '1'?"
|
||||
end
|
||||
|
||||
Then /^the first note should disappear$/ do
|
||||
# the first note contains "A note 1", generated by the Given def above
|
||||
Then "I should not see \"A note 1\""
|
||||
end
|
||||
|
||||
When /^I click the icon next to the note$/ do
|
||||
click_link "Show note"
|
||||
end
|
||||
|
||||
Then /^I should see the note text$/ do
|
||||
Then "I should see \"after 50 characters\""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue