Skip to content

A platform for community discussion. Free, open, simple.

DEV: Restore and fix skipped chat drawer thread indicator specs (#39545)

Jarek Radosz04c043234145
diff --git a/plugins/chat/spec/system/thread_tracking/drawer_spec.rb b/plugins/chat/spec/system/thread_tracking/drawer_spec.rb
index 88f1a7a5861..a3a383d3003 100644
--- a/plugins/chat/spec/system/thread_tracking/drawer_spec.rb
+++ b/plugins/chat/spec/system/thread_tracking/drawer_spec.rb
@@ -57,8 +57,6 @@ describe "Thread tracking state | drawer" do
end
it "marks the thread as read and removes both indicators when the user opens it" do
- skip("Flaky on CI") if ENV["CI"]
-
visit("/")
chat_page.open_from_header
drawer_page.open_channel(channel)
@@ -67,25 +65,26 @@ describe "Thread tracking state | drawer" do
expect(drawer_page).to have_no_unread_thread_indicator
- # this is a hack to ensure we don't destroy the component as it's doing the mark as read request
- sleep 1
+ try_until_success(reason: "Waiting for the debounced mark-as-read request to land") do
+ expect(thread.membership_for(current_user).reload.last_read_message_id).to eq(message_2.id)
+ end
drawer_page.back
expect(thread_list_page).to have_no_unread_item(thread.id)
end
- xit "shows unread indicators for the header icon and the list when a new unread arrives" do
+ it "shows unread indicators for the header icon and the list when a new unread arrives" do
thread.membership_for(current_user).update!(last_read_message_id: message_2.id)
visit("/")
chat_page.open_from_header
drawer_page.open_channel(channel)
drawer_page.open_thread_list
- expect(drawer_page).to have_no_unread_thread_indicator
+ expect(page).to have_no_css(".chat-header-icon .chat-channel-unread-indicator")
expect(thread_list_page).to have_no_unread_item(thread.id)
travel_to(1.minute.from_now)
Fabricate(:chat_message, thread: thread, user: other_user, use_service: true)
- expect(drawer_page).to have_unread_thread_indicator(count: 1)
+ expect(page).to have_css(".chat-header-icon .chat-channel-unread-indicator")
expect(thread_list_page).to have_unread_item(thread.id)
end