test(community): re-add mark as read test in community tests

Fixes #9250
This commit is contained in:
Jonathan Rainville 2023-01-26 14:36:36 -05:00
parent 2f3d1fcf46
commit 7a3144ebfc
9 changed files with 35 additions and 20 deletions

View File

@ -52,7 +52,7 @@ class ChatComponents(Enum):
MENTION_PROFILE_VIEW = "chatView_userMentioned_ProfileView"
CHAT_INPUT_EMOJI_BUTTON = "chatInput_Emoji_Button"
EMOJI_POPUP_EMOJI_PLACEHOLDER = "emojiPopup_Emoji_Button_Placeholder"
CHAT_LIST = "chatList_Repeater"
CHAT_LIST = "chatList_ListView"
MORE_OPTIONS_BUTTON = "chatView_ChatToolbarMoreOptionsButton"
CLEAR_HISTORY_MENUITEM = "clearHistoryMenuItem"
EDIT_MESSAGE_INPUT = "chatView_editMessageInputComponent"
@ -229,7 +229,7 @@ class StatusChatScreen:
chat_lists = get_obj(ChatComponents.CHAT_LIST.value)
verify(chat_lists.count > 0, "At least one chat exists")
for i in range(chat_lists.count):
chat = chat_lists.itemAt(i)
chat = chat_lists.itemAtIndex(i)
chat_list_items = get_children_with_object_name(chat, "chatItem")
verify(len(chat_list_items) > 0, "StatusChatListItem exists")
if str(chat_list_items[0].name) == chatName:
@ -465,7 +465,7 @@ class StatusChatScreen:
def verify_chat_order(self, index: int, chatName: str):
chat_lists = get_obj(ChatComponents.CHAT_LIST.value)
chat = chat_lists.itemAt(index)
chat = chat_lists.itemAtIndex(index)
verify(not is_null(chat), "Chat ({}) at index {} exists".format(chatName, index))
chat_list_items = get_children_with_object_name(chat, "chatItem")
verify(len(chat_list_items) > 0, "StatusChatListItem exists")

View File

@ -19,6 +19,7 @@ from drivers.SDKeyboardCommands import *
from .StatusMainScreen import StatusMainScreen
from utils.FileManager import *
from screens.StatusChatScreen import MessageContentType
from utils.ObjectAccess import *
class CommunityCreateMethods(Enum):
BOTTOM_MENU = "bottom_menu"
@ -45,6 +46,8 @@ class CommunityScreenComponents(Enum):
CHAT_INPUT_ROOT = "chatInput_Root"
TOGGLE_PIN_MESSAGE_BUTTON = "chatView_TogglePinMessageButton"
REPLY_TO_MESSAGE_BUTTON = "chatView_ReplyToMessageButton"
CHAT_LIST = "chatList_ListView"
MARK_AS_READ_BUTTON = "mark_as_Read_StatusMenuItem"
PIN_TEXT = "chatInfoButton_Pin_Text"
ADD_MEMBERS_BUTTON = "community_AddMembers_Button"
@ -409,3 +412,21 @@ class StatusCommunityScreen:
def toggle_reply_message_at_index(self, message_index: int):
self._click_msg_action_button(message_index, CommunityScreenComponents.REPLY_TO_MESSAGE_BUTTON.value)
def mark_as_read(self, chatName: str):
chat_lists = get_obj(CommunityScreenComponents.CHAT_LIST.value)
found = False
verify(chat_lists.count > 0, "At least one chat exists")
for i in range(chat_lists.count):
chat = chat_lists.itemAtIndex(i)
chat_list_items = get_children_with_object_name(chat, "chatItem")
verify(len(chat_list_items) > 0, "StatusChatListItem exists")
if str(chat_list_items[0].name) == chatName:
right_click_obj(chat)
found = True
break
if not found:
test.fail("Chat is not loaded")
click_obj_by_name(CommunityScreenComponents.MARK_AS_READ_BUTTON.value)

View File

@ -26,7 +26,6 @@ class MainScreenComponents(Enum):
WALLET_BUTTON = "wallet_navbar_wallet_icon_StatusIcon"
START_CHAT_BTN = "mainWindow_startChat"
CHAT_LIST = "chatList"
MARK_AS_READ_BUTTON = "mark_as_Read_StatusMenuItem"
COMMUNITY_NAVBAR_BUTTONS = "navBarListView_All_Community_Buttons"
PROFILE_SETTINGS_VIEW = "mainWindow_ProfileSettingsView"
PROFILE_NAVBAR_BUTTON = "mainWindow_ProfileNavBarButton"
@ -95,20 +94,11 @@ class StatusMainScreen:
[loaded, chat_lists] = is_loaded(MainScreenComponents.CHAT_LIST.value)
if loaded:
for index in range(chat_lists.statusChatListItems.count):
chat = chat_lists.statusChatListItems.itemAt(index)
chat = chat_lists.statusChatListItems.itemAtIndex(index)
if(chat.objectName == chatName):
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)
else:
test.fail("Chat is not loaded")
click_obj_by_name(MainScreenComponents.MARK_AS_READ_BUTTON.value)
def open_wallet(self):
click_obj_by_name(MainScreenComponents.WALLET_BUTTON.value)

View File

@ -34,7 +34,7 @@ closeButton_StatusHeaderAction = {"container": statusDesktop_mainWindow_overlay,
# Main Window - chat related:
mainWindow_statusChatNavBarListView_ListView = {"container": statusDesktop_mainWindow, "objectName": "statusChatNavBarListView", "type": "ListView", "visible": True}
navBarListView_Chat_navbar_StatusNavBarTabButton = {"checkable": True, "container": mainWindow_statusChatNavBarListView_ListView, "objectName": "Messages-navbar", "type": "StatusNavBarTabButton", "visible": True}
chatList_Repeater = {"container": statusDesktop_mainWindow, "objectName": "chatListItems", "type": "Repeater", "visible": True}
chatList_ListView = {"container": statusDesktop_mainWindow, "objectName": "chatListItems", "type": "StatusListView", "visible": True}
chatList = {"container": statusDesktop_mainWindow, "objectName": "ContactsColumnView_chatList", "type": "StatusChatList"}
mainWindow_startChat = {"checkable": True, "container": statusDesktop_mainWindow, "objectName": "startChatButton", "type": "StatusIconTabButton"}
chatView_messageInput = {"container": statusDesktop_mainWindow, "objectName": "messageInputField", "type": "TextArea", "visible": True}

View File

@ -40,6 +40,7 @@ chatView_unfurledImageComponent_linkImage = {"container": chatView_log, "objectN
emojiSuggestions_first_inputListRectangle ={"container": statusDesktop_mainWindow_overlay, "objectName": "inputListRectangle_0", "type": "Rectangle"}
chatInput_Emoji_Button = {"container": statusDesktop_mainWindow, "objectName": "statusChatInputEmojiButton", "type": "StatusFlatRoundButton", "visible": True}
chat_Input_Stickers_Button = {"container": statusDesktop_mainWindow, "objectName": "statusChatInputStickersButton", "type": "StatusFlatRoundButton", "visible": True}
mark_as_Read_StatusMenuItem = {"container": statusDesktop_mainWindow_overlay, "objectName": "chatMarkAsReadMenuItem", "type": "StatusMenuItem", "visible": True}
# Stickers Popup
chat_StickersPopup_GetStickers_Button = {"container": statusDesktop_mainWindow_overlay, "objectName": "stickersPopupGetStickersButton", "type": "StatusButton", "visible": True}

View File

@ -150,6 +150,10 @@ def step(context, user_name):
def step(context: any):
init_steps.the_user_opens_the_community_portal_section()
@When("the user marks the channel \"|any|\" as read")
def step(context, channel):
_statusCommunityScreen.mark_as_read(channel)
#########################
### VERIFICATIONS region:
#########################

View File

@ -166,3 +166,7 @@ Feature: Status Desktop community messages
Given the user installs the sticker pack at position 4
When the user sends the sticker at position 2 in the list
Then the last chat message is a sticker
Scenario: The user marks a channel as read
When the user marks the channel "general" as read
# TODO find a way to validate that it worked

View File

@ -2,7 +2,6 @@ from scripts.global_names import *
# Chat view:
mainWindow_scrollView_ScrollView = {"container": statusDesktop_mainWindow, "id": "scrollView", "type": "StatusScrollView", "unnamed": 1, "visible": True}
mark_as_Read_StatusMenuItem = {"container": statusDesktop_mainWindow_overlay, "objectName": "chatMarkAsReadMenuItem", "type": "StatusMenuItem", "visible": True}
chatView_unfurledLinkComponent_linkImage = {"container": chatView_log, "objectName": "LinksMessageView_unfurledLinkComponent_linkImage", "type": "StatusChatImageLoader", "visible": True}
chatView_LinksMessageView_enableBtn = {"container": chatView_log, "objectName": "LinksMessageView_enableBtn", "type": "StatusFlatButton", "visible": True}

View File

@ -109,10 +109,6 @@ def step(context, message_index):
def step(context, message_index, message):
_statusChat.edit_message_at_index(message_index, message)
@When("the user marks the channel \"|any|\" as read")
def step(context, channel):
_statusMain.mark_as_read(channel)
@When("the user deletes the message at index |any|")
def step(context, message_index):
_statusChat.delete_message_at_index(message_index)