A platform for community discussion. Free, open, simple.
DEV: Fix/skip various flaky specs (#37762)
Jarek Radosz0a203f28f330
diff --git a/plugins/chat/spec/system/chat_new_message_spec.rb b/plugins/chat/spec/system/chat_new_message_spec.rbindex 07c9b565a70..8a16c381aa4 100644--- a/plugins/chat/spec/system/chat_new_message_spec.rb+++ b/plugins/chat/spec/system/chat_new_message_spec.rb@@ -58,7 +58,7 @@ RSpec.describe "Chat New Message from params", type: :system dochat_page.visit_new_message([user_1, user_3])- expect(Chat::Channel.count - original_channel_count).to eq(1)+ try_until_success { expect(Chat::Channel.count - original_channel_count).to eq(1) }expect(page).to have_current_path(%r{/chat/c/#{group_slug([user_1, user_3])}/#{Chat::Channel.last.id}},diff --git a/plugins/chat/spec/system/page_objects/chat/chat.rb b/plugins/chat/spec/system/page_objects/chat/chat.rbindex 04269ef23dd..40fd0fcdc24 100644--- a/plugins/chat/spec/system/page_objects/chat/chat.rb+++ b/plugins/chat/spec/system/page_objects/chat/chat.rb@@ -52,6 +52,7 @@ module PageObjectsenddef open_new_message(ensure_open: true)+ expect(self).to have_css("#site-logo")send_keys([PLATFORM_KEY_MODIFIER, "k"])find(".chat-modal-new-message") if ensure_openenddiff --git a/plugins/chat/spec/system/shortcuts/drawer_spec.rb b/plugins/chat/spec/system/shortcuts/drawer_spec.rbindex cbf3bf31f7c..08733b2f7b0 100644--- a/plugins/chat/spec/system/shortcuts/drawer_spec.rb+++ b/plugins/chat/spec/system/shortcuts/drawer_spec.rb@@ -20,6 +20,7 @@ RSpec.describe "Shortcuts | drawer", type: :system docontext "when pressing dash" doit "opens the drawer" do+ expect(chat_page).to have_css("#site-logo")page.send_keys("-")expect(chat_page).to have_drawerdiff --git a/plugins/discourse-adplugin/spec/system/ad_impression_spec.rb b/plugins/discourse-adplugin/spec/system/ad_impression_spec.rbindex 76fd57e1358..7aaf634d856 100644--- a/plugins/discourse-adplugin/spec/system/ad_impression_spec.rb+++ b/plugins/discourse-adplugin/spec/system/ad_impression_spec.rb@@ -22,9 +22,11 @@ describe "AdPlugin::AdImpression", type: :system doit "records the impression appropriately" dovisit "/latest"- impression = AdPlugin::AdImpression.last-- expect(impression.house_ad).to eq(house_ad)+ try_until_success do+ impression = AdPlugin::AdImpression.last+ expect(impression).to_not be_nil+ expect(impression.house_ad).to eq(house_ad)+ endendend@@ -50,11 +52,12 @@ describe "AdPlugin::AdImpression", type: :system doit "does not record impression before scrolling into view" dovisit "/latest"+ expect(page).to have_css("#site-logo")expect(AdPlugin::AdImpression.count).to eq(0)page.execute_script("window.scrollTo(0, document.body.scrollHeight);")- wait_for { AdPlugin::AdImpression.count == 1 }+ try_until_success { expect(AdPlugin::AdImpression.count).to eq(1) }impression = AdPlugin::AdImpression.lastexpect(impression.house_ad).to eq(house_ad)diff --git a/plugins/discourse-adplugin/spec/system/dfp_ads_spec.rb b/plugins/discourse-adplugin/spec/system/dfp_ads_spec.rbindex 3198482f2c4..09e79f14db3 100644--- a/plugins/discourse-adplugin/spec/system/dfp_ads_spec.rb+++ b/plugins/discourse-adplugin/spec/system/dfp_ads_spec.rb@@ -26,19 +26,15 @@ describe "DFP External Ads", type: :system doit "records impression when DFP ad is viewed" dosign_in(user)- expect { visit "/latest" }.to change { AdPlugin::AdImpression.count }.by(1)+ count = AdPlugin::AdImpression.count++ visit "/latest"+ try_until_success { expect(AdPlugin::AdImpression.count).to eq(count + 1) }impression = AdPlugin::AdImpression.lastexpect(impression.ad_type).to eq("dfp")expect(impression.house_ad).to be_nilexpect(impression.placement).to eq("topic-list-top")end-- it "does not record impression if tracking is disabled" do- SiteSetting.ad_plugin_enable_tracking = false- sign_in(user)-- expect { visit "/latest" }.not_to change { AdPlugin::AdImpression.count }- endendenddiff --git a/plugins/discourse-ai/spec/system/ai_helper/ai_post_helper_spec.rb b/plugins/discourse-ai/spec/system/ai_helper/ai_post_helper_spec.rbindex c2e93b7dc89..9d63bfceaba 100644--- a/plugins/discourse-ai/spec/system/ai_helper/ai_post_helper_spec.rb+++ b/plugins/discourse-ai/spec/system/ai_helper/ai_post_helper_spec.rb@@ -37,6 +37,7 @@ RSpec.describe "AI Post helper", type: :system dodef select_post_text(selected_post)topic_page.visit_topic(topic)+ expect(page).to have_css("#site-logo")page.execute_script("var element = document.querySelector('#{topic_page.post_by_number_selector(selected_post.post_number)} .cooked p'); " +"var range = document.createRange(); " + "range.selectNodeContents(element); " +diff --git a/plugins/discourse-calendar/spec/system/page_objects/discourse_calendar/post_event.rb b/plugins/discourse-calendar/spec/system/page_objects/discourse_calendar/post_event.rbindex fe26dbfa2b8..fb41d24c518 100644--- a/plugins/discourse-calendar/spec/system/page_objects/discourse_calendar/post_event.rb+++ b/plugins/discourse-calendar/spec/system/page_objects/discourse_calendar/post_event.rb@@ -5,6 +5,7 @@ module PageObjectsmodule DiscourseCalendarclass PostEvent < PageObjects::Pages::BaseTRIGGER_MENU_SELECTOR = ".discourse-post-event-more-menu-trigger"+def open_more_menufind(TRIGGER_MENU_SELECTOR).clickselfdiff --git a/plugins/discourse-calendar/spec/system/post_event_spec.rb b/plugins/discourse-calendar/spec/system/post_event_spec.rbindex 4a0c3ad7f9a..fbb80a5c580 100644--- a/plugins/discourse-calendar/spec/system/post_event_spec.rb+++ b/plugins/discourse-calendar/spec/system/post_event_spec.rb@@ -77,7 +77,9 @@ describe "Post event", type: :system doendcontext "with max attendees" do- it "updates the going button label from Full after toggling" do+ # FIXME: flaky because `post_event_page.going` sometimes runs before+ # the post component re-renders+ xit "updates the going button label from Full after toggling" dotitle = "My test meetup event"raw = "[event status='public' start='2222-02-22 14:22' max-attendees='1']\n[/event]"post = PostCreator.create(admin, title:, raw:)@@ -162,7 +164,9 @@ describe "Post event", type: :system doexpect(page).to have_css(".event-info .name", text: "<script>alert(1);</script>")end- it "can create, close, and open an event" do+ # FIXME: flaky because `post_event_page.going`/`open_more_menu`+ # sometimes run before the post component re-renders+ xit "can create, close, and open an event" dovisit "/new-topic"title = "My upcoming l33t event"tomorrow = (1.day.from_now).strftime("%Y-%m-%d")@@ -189,7 +193,9 @@ describe "Post event", type: :system doexpect(event.invitees.count).to eq(2)end- it "does not show participants button when event is standalone" do+ # FIXME: flaky because `post_event_page.open_more_menu` sometimes runs+ # before the post component re-renders+ xit "does not show participants button when event is standalone" dotitle = "My standalone event"raw = "[event name='standalone-event' status='standalone' start='2222-02-22 00:00']\n[/event]"post = PostCreator.create(admin, title:, raw:)@@ -200,7 +206,9 @@ describe "Post event", type: :system doexpect(page).to have_no_css(".show-all-participants")end- it "does not show 'send pm' button to the user who created the event" do+ # FIXME: flaky because `post_event_page.open_more_menu` sometimes runs+ # before the post component re-renders+ xit "does not show 'send pm' button to the user who created the event" dotitle = "My test meetup event"raw = "[event name='cool-event' status='public' start='2222-02-22 00:00']\n[/event]"post = PostCreator.create(admin, title:, raw:)