3021: Wait for dialog to close before asserting page transition.
authorTom Clegg <tom@curoverse.com>
Tue, 6 Jan 2015 17:26:49 +0000 (12:26 -0500)
committerTom Clegg <tom@curoverse.com>
Tue, 6 Jan 2015 17:26:49 +0000 (12:26 -0500)
apps/workbench/test/integration/pipeline_instances_test.rb

index e16cf72d942179f6274da2522a8002a2702fb530..b0dddc70308d8c6fdd15248d28661d5471e6c55f 100644 (file)
@@ -313,15 +313,21 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest
         find('a,button', text: 'Re-run with latest').click
       end
 
-      # Verify that the newly created instance is created in the right project.
-      # In case of project_viewer user, since the use cannot write to the project,
-      # the pipeline should have been created in the user's Home project.
+      # Wait for the dialog to close. (Otherwise, the next assertion
+      # could fail while we're still looking at the source instance
+      # page, even if the correct behavior is about to happen.)
+      assert_no_selector 'body.modal-open'
+
+      # Verify that the newly created instance is created in the right
+      # project. In case of project_viewer user, since the user cannot
+      # write to the project, the pipeline should have been created in
+      # the user's Home project.
       assert_not_equal instance_path, current_path, 'Rerun instance path expected to be different'
-      assert page.has_text? 'Home'
+      assert_text 'Home'
       if in_aproject && (user != 'project_viewer')
-        assert page.has_text? 'A Project'
+        assert_text 'A Project'
       else
-        assert page.has_no_text? 'A Project'
+        assert_no_text? 'A Project'
       end
     end
   end