FIX: show too long message error on client (#27794)

Prior to this fix we would show the message after a round trip to the server. If you had a too long message error, at this point your input would be empty and we would show an error in chat. It's important to have this server side safety net, but we can have a better UX by showing an error on the frontend before sending the message, that way you can correct your message before sending it and not lose it.
This commit is contained in:
Joffrey JAFFEUX
2024-07-09 18:34:35 +02:00
committed by GitHub
parent 866f6b910b
commit c080ac0094
7 changed files with 81 additions and 16 deletions

View File

@ -35,7 +35,9 @@ module PageObjects
end
def click_composer
find(".chat-channel .chat-composer__input").click # ensures autocomplete is closed and not masking anything
if has_no_css?(".dialog-overlay", wait: 0) # we can't click composer if a dialog is open, in case of error for exampel
find(".chat-channel .chat-composer__input").click # ensures autocomplete is closed and not masking anything
end
end
def click_send_message

View File

@ -94,7 +94,9 @@ module PageObjects
end
def click_composer
find(".chat-thread .chat-composer__input").click # ensures autocomplete is closed and not masking anything
if has_no_css?(".dialog-overlay", wait: 0) # we can't click composer if a dialog is open, in case of error for exampel
find(".chat-thread .chat-composer__input").click # ensures autocomplete is closed and not masking anything
end
end
def send_message(text = nil)

View File

@ -48,6 +48,10 @@ module PageObjects
input.value
end
def has_value?(expected)
value == expected
end
def reply_to_last_message_shortcut
input.click
input.send_keys(%i[shift arrow_up])