REFACTOR: composer/thread (#21910)

This commit contains multiple changes to improve the composer behavior especially in the context of a thread:

- Generally rename anything of the form `chatChannelThread...` to `chatThread...``
- Moves the textarea interactor instance inside the composer server
- Improves the focus state and closing of panel related to the use of the Escape shortcut
- Creates `Chat::ThreadList` as a component instead of having `Chat::Thread::ListItem` and others which could imply they were children of a the `Chat::Thread` component
This commit is contained in:
Joffrey JAFFEUX
2023-06-07 21:49:15 +02:00
committed by GitHub
parent 5fc1586abf
commit e6c6c342d9
53 changed files with 730 additions and 508 deletions

View File

@ -122,7 +122,7 @@ module PageObjects
def edit_message(message, text = nil)
open_edit_message(message)
send_message(text) if text
send_message(message.message + text) if text
end
def send_message(text = nil)

View File

@ -122,6 +122,17 @@ module PageObjects
text: I18n.t("js.chat.deleted", count: count),
)
end
def open_edit_message(message)
hover_message(message)
click_more_button
find("[data-value='edit']").click
end
def edit_message(message, text = nil)
open_edit_message(message)
send_message(message.message + text) if text
end
end
end
end

View File

@ -58,6 +58,10 @@ module PageObjects
input.send_keys([MODIFIER, "i"])
end
def cancel_shortcut
input.send_keys(:escape)
end
def indented_text_shortcut
input.send_keys([MODIFIER, "e"])
end
@ -70,9 +74,25 @@ module PageObjects
find(context).find(SELECTOR).find(".chat-composer-button.-emoji").click
end
def cancel_editing
component.click_button(class: "cancel-message-action")
end
def editing_message?(message)
value == message.message && message_details.editing?(message)
end
def editing_no_message?
value == "" && message_details.has_no_message?
end
def focus
component.click
end
def focused?
component.has_css?(".chat-composer.is-focused")
end
end
end
end

View File

@ -21,8 +21,17 @@ module PageObjects
selectors += "[data-id=\"#{args[:id]}\"]" if args[:id]
selectors += "[data-action=\"#{args[:action]}\"]" if args[:action]
selector_method = args[:does_not_exist] ? :has_no_selector? : :has_selector?
predicate = component.send(selector_method, selectors)
component.send(selector_method, selectors)
text_options = {}
text_options[:text] = args[:text] if args[:text]
text_options[:exact_text] = args[:exact_text] if args[:exact_text]
if text_options.present?
predicate &&=
component.send(selector_method, "#{selectors} .chat-reply__excerpt", **text_options)
end
predicate
end
def has_no_message?(**args)