From f189c20578ac67e6736ed89bd929d35a34ea984e Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Wed, 31 May 2023 15:04:34 +0200 Subject: [PATCH] DEV: ensures thread list has finished loading (#21855) This should fix this failure: ``` Failures: 1) Thread list in side panel | full page when there are no threads that the user is participating in shows a message Failure/Error: measurement = Benchmark.measure { example.run } expected to find text "You are not participating in any threads in this channel." in "Community\nEverything\nMy Posts\nMore\nMessages\nInbox\nChannels\nRandom 25\nPersonal chat\nRandom 25\nShowing all messages\nOngoing discussions" ``` The screenshot failure was clearly showing the spinner still being present. --- .../system/page_objects/chat/chat_channel.rb | 1 + .../chat/components/thread_list.rb | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 plugins/chat/spec/system/page_objects/chat/components/thread_list.rb diff --git a/plugins/chat/spec/system/page_objects/chat/chat_channel.rb b/plugins/chat/spec/system/page_objects/chat/chat_channel.rb index 79f5b229b80..5a9834cb01d 100644 --- a/plugins/chat/spec/system/page_objects/chat/chat_channel.rb +++ b/plugins/chat/spec/system/page_objects/chat/chat_channel.rb @@ -225,6 +225,7 @@ module PageObjects def open_thread_list find(thread_list_button_selector).click + PageObjects::Components::Chat::ThreadList.new.has_loaded? end def has_unread_thread_indicator?(count:) diff --git a/plugins/chat/spec/system/page_objects/chat/components/thread_list.rb b/plugins/chat/spec/system/page_objects/chat/components/thread_list.rb new file mode 100644 index 00000000000..270aa789112 --- /dev/null +++ b/plugins/chat/spec/system/page_objects/chat/components/thread_list.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module PageObjects + module Components + module Chat + class ThreadList < PageObjects::Components::Base + SELECTOR = ".chat-thread-list" + + def component + find(SELECTOR) + end + + def has_loaded? + component.has_css?(".spinner", wait: 0) + component.has_no_css?(".spinner") + end + end + end + end +end