Skip to content

Instantly share code, notes, and snippets.

@karthiks
Created August 25, 2012 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karthiks/3467739 to your computer and use it in GitHub Desktop.
Save karthiks/3467739 to your computer and use it in GitHub Desktop.
Expect for right elements in page
#my_target_page.rb
def add_and_save_notes notes
fill_in("my_target_text_box", :with => notes)
click_button "Save" # This makes an AJAX request and adds new row to the table upon successfully saving
wait_until { has_link?("Edit note") } #<-- This is BAD, esp. when the note to be added is yet another row in a table having "Edit note" link for every corresponding row in that table
#wait_until { has_text?(notes) } #<-- This is GOOD practice that enables test stability and hence faith in test results
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment