mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-27 04:18:49 +01:00
get all selenium features to run and fix the badge update for notes
This commit is contained in:
parent
c9566047fc
commit
e1c693dfdc
4 changed files with 21 additions and 71 deletions
|
|
@ -37,10 +37,3 @@ Feature: View, add, remove notes
|
|||
When I visit the "Pass Final Exam" project
|
||||
And I click the icon next to the note
|
||||
Then I should see the note text
|
||||
|
||||
@selenium
|
||||
Scenario: Toggle notes
|
||||
Given I have two projects with one note each
|
||||
When I go to the notes page
|
||||
And I click Toggle Notes
|
||||
Then I should see the body of the notes
|
||||
|
|
|
|||
|
|
@ -1,8 +1,16 @@
|
|||
Then /the badge should show (.*)/ do |number|
|
||||
# puts response.body.inspect
|
||||
badge = -1
|
||||
response.should have_xpath("//span[@id='badge_count']") do |node|
|
||||
badge = node.first.content.to_i
|
||||
xpath= "//span[@id='badge_count']"
|
||||
|
||||
if Rails.env == 'selenium'
|
||||
response.should have_xpath(xpath)
|
||||
badge = response.selenium.get_text("xpath=#{xpath}").to_i
|
||||
else
|
||||
response.should have_xpath(xpath) do |node|
|
||||
badge = node.first.content.to_i
|
||||
end
|
||||
end
|
||||
|
||||
badge.should == number.to_i
|
||||
end
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ end
|
|||
|
||||
Given /^I have a project "([^\"]*)" with (.*) notes?$/ do |project_name, num|
|
||||
project = @current_user.projects.create!(:name => project_name)
|
||||
0.upto num.to_i do |i|
|
||||
project.notes.create!(:user_id => @current_user.id, :body => "A note #{i+1}")
|
||||
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
|
||||
|
||||
|
|
@ -49,61 +49,14 @@ When /^I delete the first note$/ do
|
|||
end
|
||||
|
||||
Then /^the first note should disappear$/ do
|
||||
# the first note contains "A note 1"
|
||||
# the first note contains "A note 1", generated by the Given def above
|
||||
Then "I should not see \"A note 1\""
|
||||
end
|
||||
|
||||
Given /^I have one project "([^\"]*)" with 1 note$/ do |arg1|
|
||||
pending
|
||||
end
|
||||
|
||||
When /^I click the icon next to the note$/ do
|
||||
# need selenium for this to check on the js
|
||||
pending
|
||||
click_link "Show note"
|
||||
end
|
||||
|
||||
Then /^I should see the note text$/ do
|
||||
# need selenium for this to check on the js
|
||||
pending
|
||||
end
|
||||
|
||||
Then /^I should see the body of the notes$/ do
|
||||
pending
|
||||
end
|
||||
|
||||
|
||||
#------ left over from old stories. can be removed if pending stuff is done
|
||||
|
||||
When "Luis adds a note from the Pass Final Exam project page" do
|
||||
When "Luis visits the Pass Final Exam project page"
|
||||
clicks_link 'Add a note', :wait => :ajax
|
||||
fills_in 'new_note_body', :with => 'new exam note'
|
||||
clicks_button 'Add note', :wait => :ajax
|
||||
end
|
||||
|
||||
When "Luis deletes the first note" do
|
||||
selenium.click "css=a.delete_note"
|
||||
selenium.get_confirmation.should =~ /delete/
|
||||
end
|
||||
|
||||
When "clicks the icon next to the note" do
|
||||
selenium.click "css=a.link_to_notes"
|
||||
wait_for_page_to_load
|
||||
end
|
||||
|
||||
When "Luis clicks Toggle Notes" do
|
||||
clicks_link 'Toggle notes', :wait => :effects
|
||||
end
|
||||
|
||||
Then "Luis should see the note on the Pass Final Exam project page" do
|
||||
should_see "new exam note"
|
||||
end
|
||||
|
||||
Then "Luis should see the note on the notes page" do
|
||||
visits '/notes'
|
||||
should_see "new exam note"
|
||||
end
|
||||
|
||||
Then "he should see the note text" do
|
||||
should_see 'exam note 1'
|
||||
Then "I should see \"after 50 characters\""
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue