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 c763d37
Show file tree
Hide file tree
Showing 3 changed files with 16 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
2 changes: 2 additions & 0 deletions spec/features/stories_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
click_on 'Save'
end

wait_for_ajax

# Estimate the story
within('#chilly_bin .story') do
click_on '1'
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 c763d37

Please sign in to comment.