mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-30 13:58: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
|
|
@ -6,17 +6,12 @@
|
|||
|
||||
<div class="note_footer">
|
||||
<%= link_to_remote(
|
||||
image_tag("blank.png",
|
||||
:title =>"Delete this note",
|
||||
:class=>"delete_item",
|
||||
:id => "delete_note_"+note.id.to_s),
|
||||
{:update => dom_id(note),
|
||||
:loading => visual_effect(:fade, dom_id(note, 'container')),
|
||||
:complete => "$('#{dom_id(note, 'container')}').remove();",
|
||||
:url => note_path(note),
|
||||
image_tag("blank.png", :title =>"Delete this note", :class=>"delete_item", :id => "delete_note_"+note.id.to_s),
|
||||
:url => note_path(note),
|
||||
:html => {:class => 'delete_note', :title => "delete note"},
|
||||
:method => :delete,
|
||||
:confirm => "Are you sure that you want to delete the note \'#{note.id.to_s}\'?" },
|
||||
{ :class => 'delete_note', :title => "delete note" }) -%>
|
||||
:confirm => "Are you sure that you want to delete the note \'#{note.id.to_s}\'?",
|
||||
:before => visual_effect(:fade, dom_id(note, 'container'))) -%>
|
||||
<%= link_to_function(image_tag( "blank.png", :title => "Edit item", :class=>"edit_item"),
|
||||
"$('##{dom_id(note)}').toggle(); $('##{dom_id(note, 'edit')}').show(); $('##{dom_id(note, 'edit_form')} textarea').focus();" ) + " | " %>
|
||||
<%= link_to("In: " + note.project.name, project_path(note.project), :class=>"footer_link" ) %> |
|
||||
|
|
@ -38,3 +33,4 @@
|
|||
</div>
|
||||
</div>
|
||||
<% note = nil -%>
|
||||
|
||||
|
|
|
|||
|
|
@ -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