fix(EmojiPopup): Fix emoji suggestions and add tests for it
Closes: #7020
This commit is contained in:
parent
04ce8df483
commit
02b9ceff78
|
@ -66,6 +66,9 @@ class ChatMessagesHistory(Enum):
|
|||
CHAT_CREATED_TEXT = 1
|
||||
HAS_ADDED_TEXT = 0
|
||||
|
||||
class Emoji(Enum):
|
||||
EMOJI_SUGGESTIONS_FIRST_ELEMENT = "emojiSuggestions_first_inputListRectangle"
|
||||
|
||||
|
||||
class StatusChatScreen:
|
||||
|
||||
|
@ -77,10 +80,16 @@ class StatusChatScreen:
|
|||
verify(is_displayed(ChatComponents.LAST_MESSAGE_TEXT.value), "Checking chat is loaded by looking if last message is displayed.")
|
||||
|
||||
# Screen actions region:
|
||||
def send_message(self, message: str):
|
||||
def type_message_in_chat_input(self, message: str):
|
||||
type(ChatComponents.MESSAGE_INPUT.value, message)
|
||||
|
||||
def press_enter_in_chat_input(self):
|
||||
press_enter(ChatComponents.MESSAGE_INPUT.value)
|
||||
|
||||
def send_message(self, message: str):
|
||||
self.type_message_in_chat_input(message)
|
||||
self.press_enter_in_chat_input()
|
||||
|
||||
def clear_history(self):
|
||||
click_obj_by_name(ChatComponents.MORE_OPTIONS_BUTTON.value)
|
||||
click_obj_by_name(ChatComponents.CLEAR_HISTORY_MENUITEM.value)
|
||||
|
@ -96,6 +105,9 @@ class StatusChatScreen:
|
|||
click_obj_by_name(ChatComponents.GIF_MOUSEAREA.value)
|
||||
press_enter(ChatComponents.MESSAGE_INPUT.value)
|
||||
|
||||
def select_the_emoji_in_suggestion_list(self):
|
||||
click_obj_by_name(Emoji.EMOJI_SUGGESTIONS_FIRST_ELEMENT.value)
|
||||
|
||||
# Verifications region:
|
||||
def verify_last_message_sent(self, message: str):
|
||||
[loaded, last_message_obj] = is_loaded_visible_and_enabled(ChatComponents.LAST_MESSAGE_TEXT.value)
|
||||
|
@ -212,13 +224,13 @@ class StatusChatScreen:
|
|||
|
||||
def cannot_do_mention(self, displayName: str):
|
||||
self.chat_loaded()
|
||||
type(ChatComponents.MESSAGE_INPUT.value, _MENTION_SYMBOL + displayName)
|
||||
self.type_message_in_chat_input(_MENTION_SYMBOL + displayName)
|
||||
displayed = is_displayed(ChatComponents.SUGGESTIONS_BOX.value)
|
||||
verify(displayed == False , "Checking suggestion box is not displayed when trying to mention a non existing user.")
|
||||
|
||||
def do_mention(self, displayName: str):
|
||||
self.chat_loaded()
|
||||
type(ChatComponents.MESSAGE_INPUT.value, _MENTION_SYMBOL + displayName)
|
||||
self.type_message_in_chat_input(_MENTION_SYMBOL + displayName)
|
||||
displayed = is_displayed(ChatComponents.SUGGESTIONS_BOX.value)
|
||||
verify(displayed, "Checking suggestion box displayed when trying to do a mention")
|
||||
[loaded, suggestions_list] = is_loaded_visible_and_enabled(ChatComponents.SUGGESTIONS_LIST.value)
|
||||
|
@ -236,14 +248,13 @@ class StatusChatScreen:
|
|||
|
||||
def send_emoji(self, emoji_short_name: str, message: str):
|
||||
if (message != ""):
|
||||
type(ChatComponents.MESSAGE_INPUT.value, message)
|
||||
self.type_message_in_chat_input(message)
|
||||
|
||||
click_obj_by_name(ChatComponents.CHAT_INPUT_EMOJI_BUTTON.value)
|
||||
emojiAttr = copy.deepcopy(getattr(names, ChatComponents.EMOJI_POPUP_EMOJI_PLACEHOLDER.value))
|
||||
emojiAttr["objectName"] = emojiAttr["objectName"].replace("%NAME%", emoji_short_name)
|
||||
click_obj_by_attr(emojiAttr)
|
||||
|
||||
press_enter(ChatComponents.MESSAGE_INPUT.value)
|
||||
self.press_enter_in_chat_input()
|
||||
|
||||
def verify_chat_order(self, index: int, chatName: str):
|
||||
chat_lists = get_obj(ChatComponents.CHAT_LIST.value)
|
||||
|
@ -264,3 +275,4 @@ class StatusChatScreen:
|
|||
click_obj(chat)
|
||||
return
|
||||
verify(False, "Chat switched")
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ mark_as_Read_StatusMenuItemDelegate = {"container": statusDesktop_mainWindow_ove
|
|||
chatView_SuggestionBoxPanel ={"container": statusDesktop_mainWindow, "objectName": "suggestionsBox", "type": "SuggestionBoxPanel"}
|
||||
chatView_suggestion_ListView ={"container": chatView_SuggestionBoxPanel, "objectName": "suggestionBoxList", "type": "StatusListView"}
|
||||
chatView_userMentioned_ProfileView ={"container": statusDesktop_mainWindow_overlay, "objectName": "profileView", "type": "ProfileView"}
|
||||
emojiSuggestions_first_inputListRectangle ={"container": statusDesktop_mainWindow_overlay, "objectName": "inputListRectangle_0", "type": "Rectangle"}
|
||||
emojiPopup_Emoji_Button_Placeholder = {"container": statusDesktop_mainWindow, "objectName": "statusEmoji_%NAME%", "type": "StatusEmoji", "visible": True}
|
||||
chatInput_Emoji_Button = {"container": statusDesktop_mainWindow, "objectName": "statusChatInputEmojiButton", "type": "StatusFlatRoundButton", "visible": True}
|
||||
chatView_ChatToolbarMoreOptionsButton = {"container": statusDesktop_mainWindow, "objectName": "chatToolbarMoreOptionsButton", "type": "StatusFlatRoundButton"}
|
||||
|
|
|
@ -37,6 +37,14 @@ def step(context,displayName,message):
|
|||
def step(context):
|
||||
_statusChat.clear_history()
|
||||
|
||||
@When("the user types \"|any|\"")
|
||||
def step(context, message):
|
||||
_statusChat.type_message_in_chat_input(message)
|
||||
|
||||
@When("the user pressed enter")
|
||||
def step(context):
|
||||
_statusChat.press_enter_in_chat_input()
|
||||
|
||||
@Then("user is able to send chat message")
|
||||
def step(context):
|
||||
table = context.table
|
||||
|
@ -49,6 +57,10 @@ def step(context):
|
|||
_statusChat.send_gif()
|
||||
_statusChat.verify_last_message_sent("tenor.gif")
|
||||
|
||||
@Then("the user selects emoji in the suggestion list")
|
||||
def step(contenxt):
|
||||
_statusChat.select_the_emoji_in_suggestion_list()
|
||||
|
||||
@Then("the user is able to send a random chat message")
|
||||
def step(context):
|
||||
random_int = randint(0, 10000)
|
||||
|
|
|
@ -77,6 +77,13 @@ Feature: Status Desktop Chat
|
|||
And user joins chat room automation-test
|
||||
Then The user is able to send a gif message
|
||||
|
||||
Scenario: The user is able to use emoji suggestions
|
||||
When user joins chat room automation-test
|
||||
When the user types "hello :thumbs"
|
||||
Then the user selects emoji in the suggestion list
|
||||
When the user pressed enter
|
||||
Then then the message 👍 is displayed in the last message
|
||||
|
||||
|
||||
@mayfail
|
||||
Scenario: User cannot delete another user's message
|
||||
|
|
|
@ -140,9 +140,10 @@ Popup {
|
|||
anchors.bottom: parent.bottom
|
||||
|
||||
delegate: Rectangle {
|
||||
id: rectangle
|
||||
objectName: "inputListRectangle_" + index
|
||||
property variant myData: typeof modelData === "undefined" ? model : modelData
|
||||
property string myText: popup.getText(myData)
|
||||
id: rectangle
|
||||
visible: searchBox.text === "" || myText.includes(searchBox.text)
|
||||
color: listView.currentIndex === index ? Style.current.backgroundHover : Style.current.transparent
|
||||
border.width: 0
|
||||
|
|
Loading…
Reference in New Issue