FIX: targeting chat-message-text is more reliable (#24245)

This commit is contained in:
Joffrey JAFFEUX 2023-11-07 00:05:53 +01:00 committed by GitHub
parent e2f094dd05
commit 2bd4cf69d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 6 deletions

View File

@ -60,12 +60,11 @@ module PageObjects
text = args[:text]
text = I18n.t("js.chat.deleted", count: args[:deleted]) if args[:deleted]
if text
@component =
find(context).find("#{selector} .chat-message-text", text: /#{Regexp.escape(text)}/)
else
@component = page.find(context).find(selector)
end
@component =
page.find(
"#{context} #{selector} .chat-message-text",
text: text ? /#{Regexp.escape(text)}/ : nil,
)
self
end