diff --git a/spec/features/notes_spec.rb b/spec/features/notes_spec.rb index 952d7f01b..72f49d218 100644 --- a/spec/features/notes_spec.rb +++ b/spec/features/notes_spec.rb @@ -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 @@ -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 diff --git a/spec/support/integration_helpers.rb b/spec/support/integration_helpers.rb index 54dd6e171..fcd9a47b9 100644 --- a/spec/support/integration_helpers.rb +++ b/spec/support/integration_helpers.rb @@ -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