test(chat): add test to mark as read

Fixes #6671
This commit is contained in:
Jonathan Rainville 2022-07-28 16:14:29 -04:00
parent ed1f189a69
commit b43d773a57
6 changed files with 32 additions and 2 deletions

View File

@ -73,6 +73,14 @@ def click_obj(obj):
except LookupError:
return False
# It executes the right-click action into the given object:
def right_click_obj(obj):
try:
squish.mouseClick(obj, squish.Qt.RightButton)
return True
except LookupError:
return False
def get_obj(objName: str):
obj = squish.findObject(getattr(names, objName))
return obj

View File

@ -23,6 +23,7 @@ class MainScreenComponents(Enum):
WALLET_BUTTON = "wallet_navbar_wallet_icon_StatusIcon"
START_CHAT_BTN = "mainWindow_startChat"
CHAT_LIST = "chatList_Repeater"
MARK_AS_READ_BUTTON = "mark_as_Read_StatusMenuItemDelegate"
class ChatNamePopUp(Enum):
CHAT_NAME_TEXT = "chat_name_PlaceholderText"
@ -54,7 +55,7 @@ class StatusMainScreen:
[loaded, chat_button] = self._find_chat(chatName)
if loaded:
click_obj(chat_button)
verify(loaded, "Trying to get chat: " + chatName)
verify(loaded, "Trying to get chat: " + chatName)
def _find_chat(self, chatName: str):
[loaded, chat_lists] = is_loaded(MainScreenComponents.CHAT_LIST.value)
@ -65,3 +66,9 @@ class StatusMainScreen:
return True, chat
return False, None
def mark_as_read(self, chatName: str):
[loaded, chat_button] = self._find_chat(chatName)
if loaded:
right_click_obj(chat_button)
click_obj_by_name(MainScreenComponents.MARK_AS_READ_BUTTON.value)

View File

@ -213,6 +213,8 @@ accountsView_accountListPanel = {"container": statusDesktop_mainWindow, "type":
# Main Window - chat related:
chatList_Repeater = {"container": statusDesktop_mainWindow, "objectName": "chatListItems", "type": "Repeater"}
mark_as_Read_StatusMenuItemDelegate = {"container": statusDesktop_mainWindow_overlay, "objectName": "chatMarkAsReadMenuItem", "type": "StatusMenuItemDelegate", "visible": True}
# Join chat popup:
startChat_Btn = {"container": statusDesktop_mainWindow_overlay, "objectName": "startChatButton", "type": "StatusButton"}

View File

@ -52,4 +52,8 @@ def step(context, 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)
_statusChat.verify_last_message_sent(message)
@Then("the user can mark the channel |any| as read")
def step(context, channel):
_statusMain.mark_as_read(channel)

View File

@ -22,6 +22,7 @@ Feature: Status Desktop Chat
| 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
@ -29,7 +30,14 @@ Feature: Status Desktop Chat
| 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"
Scenario: User joins a room and marks it as read
When user joins chat room test
Then the user can mark the channel test as read
# TODO find a way to validate that it worked

View File

@ -117,6 +117,7 @@ StatusPopupMenu {
}
StatusMenuItem {
objectName: "chatMarkAsReadMenuItem"
text: qsTr("Mark as Read")
icon.name: "checkmark-circle"
onTriggered: {