test(chat): add test that sends a message with an emoji

Fixes #6881
This commit is contained in:
Jonathan Rainville 2022-08-12 14:42:06 -04:00
parent 50b49446f0
commit 016e3927f2
7 changed files with 48 additions and 4 deletions

View File

@ -116,6 +116,10 @@ def click_obj_by_name(objName: str):
obj = squish.waitForObject(getattr(names, objName))
squish.mouseClick(obj, squish.Qt.LeftButton)
def click_obj_by_attr(attr: str):
obj = squish.waitForObject(attr)
squish.mouseClick(obj, squish.Qt.LeftButton)
def click_obj_by_wildcards_name(objName: str, wildcardString: str):
wildcardRealName = copy.deepcopy(getattr(names, objName))
wildcardRealName["objectName"] = Wildcard(wildcardString)

View File

@ -10,6 +10,7 @@
import re
import copy
from enum import Enum
from drivers.SquishDriver import *
from drivers.SquishDriverVerification import *
@ -31,6 +32,8 @@ class ChatComponents(Enum):
SUGGESTIONS_BOX = "chatView_SuggestionBoxPanel"
SUGGESTIONS_LIST = "chatView_suggestion_ListView"
MENTION_PROFILE_VIEW = "chatView_userMentioned_ProfileView"
CHAT_INPUT_EMOJI_BUTTON = "chatInput_Emoji_Button"
EMOJI_POPUP_EMOJI_PLACEHOLDER = "emojiPopup_Emoji_Button_Placeholder"
class ChatMessagesHistory(Enum):
@ -180,3 +183,15 @@ class StatusChatScreen:
break
verify(found, "Checking if the following display name is in the mention's list: " + displayName)
def send_emoji(self, emoji_short_name: str, message: str):
if (message != ""):
type(ChatComponents.MESSAGE_INPUT.value, 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)

View File

@ -21,8 +21,8 @@ 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"}
# This will conflict with Jo's PR. Resolve it on rebase.
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}
# Join chat popup:
startChat_Btn = {"container": statusDesktop_mainWindow_overlay, "objectName": "startChatButton", "type": "StatusButton"}

View File

@ -1,4 +1,5 @@
from random import randint
from drivers.SquishDriver import *
from screens.StatusMainScreen import StatusMainScreen
@ -89,7 +90,23 @@ def step(context, message):
@Then("the last message is not the random message")
def step(context):
_statusChat.verify_last_message_sent_is_not(context.userData["randomMessage"])
@When("user sends the emoji |any| as a message")
def step(context, emoji_short_name):
_statusChat.send_emoji(emoji_short_name, "")
@When("user sends the emoji |any| with message |any|")
def step(context, emoji_short_name, message):
_statusChat.send_emoji(emoji_short_name, message)
@Then("the emoji |any| is displayed in the last message")
def step(context, emoji):
_statusChat.verify_last_message_sent(emoji)
@Then("the message |any| is displayed in the last message")
def step(context, message):
_statusChat.verify_last_message_sent(message)
@Then("the user cannot input a mention to a not existing user |any|")
def step(context, displayName):
_statusChat.cannot_do_mention(displayName)

View File

@ -74,4 +74,12 @@ Feature: Status Desktop Chat
Examples:
| displayName |
| notExistingAccount |
| asdfgNoNo |
| asdfgNoNo |
Scenario: User can send an emoji in a message
When user joins chat room automation-test
When user sends the emoji heart_eyes as a message
Then the emoji 😍 is displayed in the last message
When user sends the emoji sunglasses with message wow I'm so cool
Then the emoji 😎 is displayed in the last message
And the message wow I'm so cool is displayed in the last message

View File

@ -1210,6 +1210,7 @@ Rectangle {
StatusQ.StatusFlatRoundButton {
id: emojiBtn
objectName: "statusChatInputEmojiButton"
enabled: !control.emojiPopupOpened
implicitHeight: 32
implicitWidth: 32

View File

@ -89,7 +89,6 @@ Item {
anchors.leftMargin: emojiSection.imageMargin
StatusEmoji {
// TODO: this will conflict with Jo's PR, fix it on rebase
objectName: "statusEmoji_" + modelData.shortname.replace(/:/g, "")
width: emojiSection.imageWidth