[ARVADOS] updated: ba764a7a0878b9cf0dd8d22ad4e12774d8e5f550

git at public.curoverse.com git at public.curoverse.com
Tue May 6 18:27:14 EDT 2014


Summary of changes:
 apps/workbench/test/integration/folders_test.rb |    4 ++--
 apps/workbench/test/integration_helper.rb       |   14 ++++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

       via  ba764a7a0878b9cf0dd8d22ad4e12774d8e5f550 (commit)
      from  67b4630e47e0f70e3cdbcaa8a7d039543e3c6a34 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit ba764a7a0878b9cf0dd8d22ad4e12774d8e5f550
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue May 6 18:27:01 2014 -0400

    Add wait_for_ajax after using x-editable in tests.

diff --git a/apps/workbench/test/integration/folders_test.rb b/apps/workbench/test/integration/folders_test.rb
index 8752dad..dc51b77 100644
--- a/apps/workbench/test/integration/folders_test.rb
+++ b/apps/workbench/test/integration/folders_test.rb
@@ -16,8 +16,7 @@ class FoldersTest < ActionDispatch::IntegrationTest
       find('.btn', text: 'Edit description').click
       find('.editable-input textarea').set('I just edited this.')
       find('.editable-submit').click
-      # Wait for editable popup to go away
-      page.assert_no_selector '.editable-submit'
+      wait_for_ajax
     end
     visit current_path
     assert(find?('.panel', text: 'I just edited this.'),
@@ -36,6 +35,7 @@ class FoldersTest < ActionDispatch::IntegrationTest
       find('.editable', text: 'Now I have a name.').click
       find('.editable-input input').set('Now I have a new name.')
       find('.glyphicon-ok').click
+      wait_for_ajax
       find('.editable', text: 'Now I have a new name.')
     end
     visit current_path
diff --git a/apps/workbench/test/integration_helper.rb b/apps/workbench/test/integration_helper.rb
index 1784779..a8788ce 100644
--- a/apps/workbench/test/integration_helper.rb
+++ b/apps/workbench/test/integration_helper.rb
@@ -4,10 +4,24 @@ require 'capybara/poltergeist'
 require 'uri'
 require 'yaml'
 
+module WaitForAjax
+  Capybara.default_wait_time = 5
+  def wait_for_ajax
+    Timeout.timeout(Capybara.default_wait_time) do
+      loop until finished_all_ajax_requests?
+    end
+  end
+
+  def finished_all_ajax_requests?
+    page.evaluate_script('jQuery.active').zero?
+  end
+end
+
 class ActionDispatch::IntegrationTest
   # Make the Capybara DSL available in all integration tests
   include Capybara::DSL
   include ApiFixtureLoader
+  include WaitForAjax
 
   @@API_AUTHS = self.api_fixture('api_client_authorizations')
 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list