Skip to content

Commit

Permalink
Attempt another fix for image test
Browse files Browse the repository at this point in the history
  • Loading branch information
krschacht committed Dec 4, 2024
1 parent 285a80b commit c14ff71
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/system/conversations/messages/images_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,7 @@ class TestCase
fixtures :all
end
end

class ActionDispatch::SystemTestCase
parallelize(workers: Etc.nprocessors/2)
end

0 comments on commit c14ff71

Please sign in to comment.