diff --git a/plugins/chat/spec/system/navigation_spec.rb b/plugins/chat/spec/system/navigation_spec.rb index 31b5630f260..312c7c2f029 100644 --- a/plugins/chat/spec/system/navigation_spec.rb +++ b/plugins/chat/spec/system/navigation_spec.rb @@ -171,7 +171,7 @@ RSpec.describe "Navigation", type: :system do context "when opening a thread from the thread list" do xit "goes back to the thread list when clicking the back button" do - skip("Flaky on CI") if ENV["CI"] + skip_on_ci! visit("/chat") chat_page.visit_channel(category_channel) @@ -187,7 +187,7 @@ RSpec.describe "Navigation", type: :system do context "for mobile" do it "goes back to the thread list when clicking the back button", mobile: true do - skip("Flaky on CI") if ENV["CI"] + skip_on_ci! visit("/chat") chat_page.visit_channel(category_channel) @@ -207,7 +207,7 @@ RSpec.describe "Navigation", type: :system do before { Fabricate(:chat_message, thread: thread_2, use_service: true) } it "goes back to the thread list when clicking the back button", mobile: true do - skip("Flaky on CI") if ENV["CI"] + skip_on_ci! chat_page.visit_channel(category_channel) channel_page.message_thread_indicator(thread.original_message).click @@ -227,7 +227,7 @@ RSpec.describe "Navigation", type: :system do context "when opening a thread from indicator" do it "goes back to the thread list when clicking the back button" do - skip("Flaky on CI") if ENV["CI"] + skip_on_ci! visit("/chat") chat_page.visit_channel(category_channel) @@ -242,7 +242,7 @@ RSpec.describe "Navigation", type: :system do context "for mobile" do it "closes the thread and goes back to the channel when clicking the back button", mobile: true do - skip("Flaky on CI") if ENV["CI"] + skip_on_ci! visit("/chat") chat_page.visit_channel(category_channel) diff --git a/plugins/chat/spec/system/uploads_spec.rb b/plugins/chat/spec/system/uploads_spec.rb index a8736e6b9b7..8ccf3cc0690 100644 --- a/plugins/chat/spec/system/uploads_spec.rb +++ b/plugins/chat/spec/system/uploads_spec.rb @@ -83,7 +83,7 @@ describe "Uploading files in chat messages", type: :system do end it "allows uploading multiple files" do - skip("This test is flaky on CI") if ENV["CI"] + skip_on_ci! chat.visit_channel(channel_1) @@ -108,7 +108,7 @@ describe "Uploading files in chat messages", type: :system do end it "allows uploading a huge image file with preprocessing" do - skip("This test is flaky on CI") if ENV["CI"] + skip_on_ci! SiteSetting.composer_media_optimization_image_bytes_optimization_threshold = 200.kilobytes chat.visit_channel(channel_1) diff --git a/spec/support/system_helpers.rb b/spec/support/system_helpers.rb index 77f97740ee5..850862b7f71 100644 --- a/spec/support/system_helpers.rb +++ b/spec/support/system_helpers.rb @@ -157,4 +157,8 @@ module SystemHelpers ) end end + + def skip_on_ci!(message = "Flaky on CI") + skip(message) if ENV["CI"] + end end diff --git a/spec/system/network_disconnected_spec.rb b/spec/system/network_disconnected_spec.rb index aaeb883c894..a6454065dc1 100644 --- a/spec/system/network_disconnected_spec.rb +++ b/spec/system/network_disconnected_spec.rb @@ -4,7 +4,7 @@ RSpec.describe "Network Disconnected", type: :system do let(:cdp) { PageObjects::CDP.new } it "NetworkConnectivity service adds class to DOM and displays offline indicator" do - skip(<<~TEXT) if ENV["CI"] + skip_on_ci!(<<~TEXT) In CI this test will randomly flake - timing issue with the offline indicator not being rendered soon enough after network conditions change TEXT diff --git a/spec/system/private_message_map_spec.rb b/spec/system/private_message_map_spec.rb index 876499e7913..f5fe76ea0eb 100644 --- a/spec/system/private_message_map_spec.rb +++ b/spec/system/private_message_map_spec.rb @@ -39,6 +39,10 @@ describe "Topic Map - Private Message", type: :system do end it "updates the various topic stats, avatars" do + skip_on_ci!( + "This is flaky because it relies a lot on messagebus events and the counts don't always update in time", + ) + freeze_time sign_in(user) topic_page.visit_topic(topic) @@ -77,12 +81,11 @@ describe "Topic Map - Private Message", type: :system do expect(expanded_avatars.length).to eq 7 # views count - # TODO (martin) Investigate flakiness - # sign_in(other_user) - # topic_page.visit_topic(topic) - # try_until_success { expect(TopicViewItem.count).to eq(2) } - # page.refresh - # expect(topic_map.views_count).to eq(2) + sign_in(other_user_1) + topic_page.visit_topic(topic) + try_until_success { expect(TopicViewItem.count).to eq(2) } + page.refresh + expect(topic_map.views_count).to eq(2) # likes count expect(topic_map).to have_no_likes