Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Commit

Permalink
Added wait_for_ajax_method
Browse files Browse the repository at this point in the history
Sometimes Capybara.default_wait_time is not enough and build fails.
  • Loading branch information
Valery Kalashnikov committed Apr 22, 2015
1 parent a4c2c24 commit 706e077
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions spec/features/notes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
click_on 'Add note'
end

wait_for_ajax

find('#in_progress .story .notelist .note').should have_content('Adding a new note')

end
Expand All @@ -54,6 +56,9 @@
click_on 'Delete'
end
end

wait_for_ajax

find('#in_progress .story .notelist').should_not have_content('Delete me please')
end

Expand Down
9 changes: 9 additions & 0 deletions spec/support/integration_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,13 @@ def get_confirmation_token_from_mail(email)
token
end

def wait_for_ajax
Timeout.timeout(Capybara.default_wait_time) do
active = page.evaluate_script('jQuery.active')
until active == 0
active = page.evaluate_script('jQuery.active')
end
end
end

end

0 comments on commit 706e077

Please sign in to comment.