diff --git a/test/system/conversations/messages/images_test.rb b/test/system/conversations/messages/images_test.rb index af3f07d1..39eaeedc 100644 --- a/test/system/conversations/messages/images_test.rb +++ b/test/system/conversations/messages/images_test.rb @@ -97,13 +97,27 @@ class ConversationMessagesImagesTest < ApplicationSystemTestCase modal_loader = modal_container.find_role("image-loader") modal_img = modal_container.find("img", visible: :all) - assert_true "image loader should be visible", wait: 3 do + assert_true "image loader should be visible", wait: 0.6 do loader.visible? end refute img.visible? image_btn.click + retries = 0 + begin + 2.times do + sleep 0.1 + sleep 0.5 if !modal_loader.visible? + sleep 0.1 + image_btn.click if !modal_loader.visible? + end # TODO: sometimes modal has not popped up after clicking, why?? Try 2x times before failing the test. + rescue Selenium::WebDriver::Error::ElementClickInterceptedError => e + retires += 1 + retry if retries < 2 + raise e + end + assert_true "modal image loader should be visible", wait: 3 do modal_loader.visible? end diff --git a/test/test_helper.rb b/test/test_helper.rb index ad1acbf7..77a4884a 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -65,3 +65,7 @@ class TestCase fixtures :all end end + +class ActionDispatch::SystemTestCase + parallelize(workers: Etc.nprocessors/2) +end