test(chat): add test to reply a message

Fixes #6670
This commit is contained in:
Jonathan Rainville 2022-07-28 14:58:19 -04:00
parent cbb6cd70a8
commit ed1f189a69
6 changed files with 33 additions and 1 deletions

View File

@ -82,12 +82,18 @@ def get_obj(objName: str):
def click_obj_by_name(objName: str):
obj = squish.waitForObject(getattr(names, objName))
squish.mouseClick(obj, squish.Qt.LeftButton)
# It executes the right-click action into object with given object name:
def right_click_obj_by_name(objName: str):
obj = squish.waitForObject(getattr(names, objName))
squish.mouseClick(obj, squish.Qt.RightButton)
# It moves the mouse over an object
def hover_obj(obj):
squish.mouseMove(obj)
def scroll_obj_by_name(objName: str):
obj = squish.waitForObject(getattr(names, objName))
squish.mouseWheel(obj, 206, 35, 0, -1, squish.Qt.ControlModifier)

View File

@ -21,6 +21,7 @@ class ChatComponents(Enum):
CHAT_LOG = "chatView_log"
LAST_MESSAGE_TEXT = "chatView_lastChatText_Text"
MEMBERS_LISTVIEW = "chatView_chatMembers_ListView"
REPLY_TO_MESSAGE_BUTTON = "chatView_replyToMessageButton"
class ChatMessagesHistory(Enum):
CHAT_CREATED_TEXT = 1
@ -74,6 +75,12 @@ class StatusChatScreen:
def verify_chat_created_message_is_displayed_in_history(self, createdTxt: str):
chat_createChat_text_obj = get_obj(ChatComponents.CHAT_LOG.value).itemAtIndex(ChatMessagesHistory.CHAT_CREATED_TEXT.value)
verify_text_contains(str(chat_createChat_text_obj.message), createdTxt)
def reply_to_message_at_index(self, index: int, message: str):
message_object_to_reply_to = get_obj(ChatComponents.CHAT_LOG.value).itemAtIndex(int(index))
hover_obj(message_object_to_reply_to)
click_obj_by_name(ChatComponents.REPLY_TO_MESSAGE_BUTTON.value)
self.send_message(message)
# TODO: Find ADMIN
def find_member_in_panel(self, member: str):

View File

@ -225,6 +225,7 @@ createChatView_confirmBtn = {"container": statusDesktop_mainWindow, "objectName"
chatView_log = {"container": statusDesktop_mainWindow, "objectName": "chatLogView", "type": "StatusListView", "visible": True}
chatView_StatusChatInfoButton = {"container": statusDesktop_mainWindow, "objectName": "chatInfoBtnInHeader", "type": "StatusChatInfoButton"}
chatView_messageInput = {"container": statusDesktop_mainWindow, "objectName": "messageInputField", "type": "TextArea", "visible": True}
chatView_replyToMessageButton = {"container": chatView_log, "objectName": "replyToMessageButton", "type": "StatusFlatRoundButton", "visible": True}
# Community chat region
mainWindow_communityHeader_StatusChatInfoButton = {"container": statusDesktop_mainWindow, "objectName": "communityHeaderButton", "type": "StatusChatInfoButton", "visible": True}

View File

@ -47,4 +47,9 @@ def step(context):
@Then("the group chat is up to chat sending \"|any|\" message")
def step(context, message):
_statusChat.send_message(message)
_statusChat.verify_last_message_sent(message)
@Then("the user can reply to the message at index |any| with \"|any|\"")
def step(context, message_index, message):
_statusChat.reply_to_message_at_index(message_index, message)
_statusChat.verify_last_message_sent(message)

View File

@ -21,3 +21,15 @@ Feature: Status Desktop Chat
| How are you |
| I am from status |
| tell me how you do? |
Scenario: User can reply to their own message
When user joins chat room test
Then user is able to send chat message
| message |
| Reply to this |
Then the user can reply to the message at index 0 with "This is a reply"
# TODO This test has a chance to fail since it relies on the mailserver. Until we host a local mailserver for the tests, this test is at risk
Scenario: User can reply to another user's message
When user joins chat room test
Then the user can reply to the message at index 0 with "This is a reply to another user"

View File

@ -99,6 +99,7 @@ Rectangle {
active: !buttonsContainer.isInPinnedPopup
sourceComponent: StatusFlatRoundButton {
id: replyBtn
objectName: "replyToMessageButton"
width: 32
height: 32
icon.name: "reply"