Skip to content

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

DEV: Fix "Composer Proofreading" and "Thread Indicator" flakes (#39368)

Jarek Radosz38864874be75
diff --git a/plugins/chat/spec/system/page_objects/chat/components/thread_indicator.rb b/plugins/chat/spec/system/page_objects/chat/components/thread_indicator.rb
index bea1ff5ab8b..31b9bd285cb 100644
--- a/plugins/chat/spec/system/page_objects/chat/components/thread_indicator.rb
+++ b/plugins/chat/spec/system/page_objects/chat/components/thread_indicator.rb
@@ -13,44 +13,44 @@ module PageObjects
end
def click
- find(@context).find(SELECTOR).click
+ find("#{@context} #{SELECTOR}").click
end
def exists?(**args)
- find(@context).has_css?(SELECTOR)
+ has_css?("#{@context} #{SELECTOR}")
end
def does_not_exist?(**args)
- find(@context).has_no_css?(SELECTOR)
+ has_no_css?("#{@context} #{SELECTOR}")
end
def has_reply_count?(count)
- find(@context).has_css?(
- "#{SELECTOR}__replies-count",
+ has_css?(
+ "#{@context} #{SELECTOR}__replies-count",
text: I18n.t("js.chat.thread.replies", count: count),
)
end
def has_participant?(user)
- find(@context).has_css?(
- ".chat-thread-participants__avatar-group .chat-user-avatar[data-username=\"#{user.username}\"] img",
+ has_css?(
+ "#{@context} .chat-thread-participants__avatar-group .chat-user-avatar[data-username=\"#{user.username}\"] img",
)
end
def has_no_participants?
- find(@context).has_no_css?(".chat-thread-participants")
+ has_no_css?("#{@context} .chat-thread-participants")
end
def has_excerpt?(text)
- find(@context).find("#{SELECTOR}__last-reply-excerpt", text: text)
+ has_css?("#{@context} #{SELECTOR}__last-reply-excerpt", text: text)
end
def has_user?(user)
- find(@context).find("#{SELECTOR}__last-reply-username", text: user.username)
+ has_css?("#{@context} #{SELECTOR}__last-reply-username", text: user.username)
end
def excerpt
- find(@context).find("#{SELECTOR}__last-reply-excerpt")
+ find("#{@context} #{SELECTOR}__last-reply-excerpt")
end
end
end
diff --git a/spec/system/page_objects/components/composer.rb b/spec/system/page_objects/components/composer.rb
index 549d168a710..ecd30b738b3 100644
--- a/spec/system/page_objects/components/composer.rb
+++ b/spec/system/page_objects/components/composer.rb
@@ -67,7 +67,7 @@ module PageObjects
end
def has_input_title?(value)
- expect(find("#{@composer_id} input#reply-title").value).to eq(value)
+ has_field?("reply-title", with: value)
end
def fill_content(content)
@@ -105,7 +105,13 @@ module PageObjects
end
def has_value?(value)
- expect(composer_input.value).to eq(value)
+ within(@composer_id) do
+ if value.nil?
+ has_no_field?(class: "d-editor-input")
+ else
+ has_field?(class: "d-editor-input", with: value)
+ end
+ end
end
def has_popup_content?(content)