From 0806d657d3c772e159f0ed4c5949b6d955446b56 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Mon, 24 Oct 2022 14:53:42 -0400 Subject: [PATCH] fix(community-tests): fix a couple community tests --- .../src/screens/StatusCommunityScreen.py | 19 +++++++++++++------ .../global_shared/scripts/global_names.py | 1 + .../shared/scripts/community_names.py | 3 +++ .../tst_communityFlows/test.feature | 6 +++--- .../tst_communityMessageFlows/test.feature | 8 +------- .../shared/scripts/chat_names.py | 1 - .../Chat/views/ChatHeaderContentView.qml | 4 +++- 7 files changed, 24 insertions(+), 18 deletions(-) diff --git a/test/ui-test/src/screens/StatusCommunityScreen.py b/test/ui-test/src/screens/StatusCommunityScreen.py index e24eb951d6..ed8a552428 100644 --- a/test/ui-test/src/screens/StatusCommunityScreen.py +++ b/test/ui-test/src/screens/StatusCommunityScreen.py @@ -77,11 +77,12 @@ class CreateOrEditCommunityChannelPopup(Enum): COMMUNITY_CHANNEL_SAVE_OR_CREATE_BUTTON: str = "createOrEditCommunityChannelBtn_StatusButton" EMOJI_BUTTON: str = "createOrEditCommunityChannel_EmojiButton" EMOJI_SEARCH_TEXT_INPUT: str = "statusDesktop_mainWindow_AppMain_EmojiPopup_SearchTextInput" - EMOJI_POPUP_EMOJI_PLACEHOLDER = "emojiPopup_Emoji_Button_Placeholder" + EMOJI_POPUP_EMOJI_PLACEHOLDER = "createOrEditCommunityChannel_Emoji_Button_Placeholder" class CreateOrEditCommunityCategoryPopup(Enum): COMMUNITY_CATEGORY_NAME_INPUT: str = "createOrEditCommunityCategoryNameInput_TextEdit" COMMUNITY_CATEGORY_LIST: str = "createOrEditCommunityCategoryChannelList_ListView" + COMMUNITY_CATEGORY_LIST_ITEM_PLACEHOLDER: str = "createOrEditCommunityCategoryChannelList_ListItem_Placeholder" COMMUNITY_CATEGORY_BUTTON: str = "createOrEditCommunityCategoryBtn_StatusButton" class StatusCommunityScreen: @@ -116,14 +117,20 @@ class StatusCommunityScreen: else: verify_failure("Can't find channel " + channel_name) - def _get_checked_channel_names_in_category_popup(self): - listView = get_obj(CreateOrEditCommunityCategoryPopup.COMMUNITY_CATEGORY_LIST.value) + def _get_checked_channel_names_in_category_popup(self, channel_name = ""): + listView = wait_and_get_obj(CreateOrEditCommunityCategoryPopup.COMMUNITY_CATEGORY_LIST.value) + + if (channel_name != ""): + # Wait for the list item to be loaded + wait_by_wildcards(CreateOrEditCommunityCategoryPopup.COMMUNITY_CATEGORY_LIST_ITEM_PLACEHOLDER.value, "%NAME%", channel_name) + result = [] for index in range(listView.count): listItem = listView.itemAtIndex(index) if (listItem.checked): result.append(listItem.objectName.toLower()) + return result def _open_edit_channel_popup(self): @@ -210,7 +217,7 @@ class StatusCommunityScreen: self._open_category_edit_popup(category) - checked_channel_names = self._get_checked_channel_names_in_category_popup() + checked_channel_names = self._get_checked_channel_names_in_category_popup(community_channel_names[0]) split = community_channel_names.split(", ") for channel_name in split: if channel_name in checked_channel_names: @@ -276,7 +283,7 @@ class StatusCommunityScreen: def check_community_channel_emoji(self, emojiStr: str): obj = wait_and_get_obj(CommunityScreenComponents.CHAT_IDENTIFIER_CHANNEL_ICON.value) - expect_true(str(obj.icon.emoji).find(emojiStr) >= 0, "Same emoji check") + expect_true(str(obj.emojiIcon).find(emojiStr) >= 0, "Same emoji check") def _verify_image_sent(self, message_index: int): image_obj = get_obj(CommunityScreenComponents.CHAT_LOG.value).itemAtIndex(message_index) @@ -330,7 +337,7 @@ class StatusCommunityScreen: def check_pin_count(self, wanted_pin_count: int): pin_text_obj = wait_and_get_obj(CommunityScreenComponents.PIN_TEXT.value) - verify_equals(pin_text_obj.text, wanted_pin_count) + verify_equals(str(pin_text_obj.text), str(wanted_pin_count)) def invite_user_to_community(self, user_name: str, message: str): click_obj_by_name(CommunityScreenComponents.ADD_MEMBERS_BUTTON.value) diff --git a/test/ui-test/testSuites/global_shared/scripts/global_names.py b/test/ui-test/testSuites/global_shared/scripts/global_names.py index 57b8607252..781b68d304 100644 --- a/test/ui-test/testSuites/global_shared/scripts/global_names.py +++ b/test/ui-test/testSuites/global_shared/scripts/global_names.py @@ -31,6 +31,7 @@ modal_Close_Button = {"container": statusDesktop_mainWindow_overlay, "objectName delete_Channel_ConfirmationDialog_DeleteButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "deleteChatConfirmationDialogDeleteButton", "type": "StatusButton"} # Main Window - chat related: +navBarListView_Chat_navbar_StatusNavBarTabButton = {"checkable": True, "container": mainWindow_navBarListView_ListView, "objectName": "Chat-navbar", "type": "StatusNavBarTabButton", "visible": True} mainWindow_public_chat_icon_StatusIcon = {"container": statusDesktop_mainWindow, "objectName": "public-chat-icon", "source": "qrc:/StatusQ/src/assets/img/icons/public-chat.svg", "type": "StatusIcon", "visible": True} chatList_Repeater = {"container": statusDesktop_mainWindow, "objectName": "chatListItems", "type": "Repeater"} chatList = {"container": statusDesktop_mainWindow, "objectName": "ContactsColumnView_chatList", "type": "StatusChatList"} diff --git a/test/ui-test/testSuites/suite_communities/shared/scripts/community_names.py b/test/ui-test/testSuites/suite_communities/shared/scripts/community_names.py index 6df15f2b79..586cc9f6b6 100644 --- a/test/ui-test/testSuites/suite_communities/shared/scripts/community_names.py +++ b/test/ui-test/testSuites/suite_communities/shared/scripts/community_names.py @@ -29,6 +29,7 @@ communitySettings_Members_NavigationListItem = {"container": statusDesktop_mainW communitySettings_MembersTab_Members_ListView = {"container": statusDesktop_mainWindow, "objectName": "CommunityMembersTabPanel_MembersListViews", "type": "ListView", "visible": True} communitySettings_MembersTab_Member_Kick_Button = {"container": communitySettings_MembersTab_Members_ListView, "objectName": "MemberListIten_KickButton", "type": "StatusButton", "visible": True} communitySettings_KickModal_Kick_Button = {"container": statusDesktop_mainWindow_overlay, "objectName": "CommunityMembers_KickModal_KickButton", "type": "StatusButton", "visible": True} +chatView_TogglePinMessageButton = {"container": chatView_log, "objectName": "MessageView_toggleMessagePin", "type": "StatusFlatRoundButton", "visible": True} # Community channel popup: @@ -36,10 +37,12 @@ createOrEditCommunityChannelNameInput_TextEdit = {"container": statusDesktop_mai createOrEditCommunityChannelDescriptionInput_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "createOrEditCommunityChannelDescriptionInput", "type": "TextEdit", "visible": True} createOrEditCommunityChannelBtn_StatusButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "createOrEditCommunityChannelBtn", "type": "StatusButton", "visible": True} createOrEditCommunityChannel_EmojiButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "StatusChannelPopup_emojiButton", "type": "StatusRoundButton", "visible": True} +createOrEditCommunityChannel_Emoji_Button_Placeholder = {"container": statusDesktop_mainWindow, "objectName": "statusEmoji_%NAME%", "type": "StatusEmoji", "visible": True} # Community category popup: createOrEditCommunityCategoryNameInput_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "createOrEditCommunityCategoryNameInput", "type": "TextEdit", "visible": True} createOrEditCommunityCategoryChannelList_ListView = {"container": statusDesktop_mainWindow_overlay, "objectName": "createOrEditCommunityCategoryChannelList", "type": "StatusListView", "visible": True} +createOrEditCommunityCategoryChannelList_ListItem_Placeholder = {"container": createOrEditCommunityCategoryChannelList_ListView, "objectName": "%NAME%", "type": "StatusListItem", "visible": True} createOrEditCommunityCategoryBtn_StatusButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "createOrEditCommunityCategoryBtn", "type": "StatusButton", "visible": True} # Community settings diff --git a/test/ui-test/testSuites/suite_communities/tst_communityFlows/test.feature b/test/ui-test/testSuites/suite_communities/tst_communityFlows/test.feature index 1f214c3396..d2c989d7e7 100644 --- a/test/ui-test/testSuites/suite_communities/tst_communityFlows/test.feature +++ b/test/ui-test/testSuites/suite_communities/tst_communityFlows/test.feature @@ -46,7 +46,7 @@ Feature: Status Desktop community | test-channel | Community channel description tested 1 | new-test-channel | @mayfail - # TODO: Weak. Sometimes passes sometimes fails (standalone or as part of the sequence). To anaylize. + # TODO: Weak. Sometimes passes sometimes fails (standalone or as part of the sequence). To analyze. Scenario: The admin deletes a community channel Given the admin creates a community channel named "test-channel2", with description "My description", with the method "bottom_menu" And the channel named "test-channel2" is open @@ -55,7 +55,7 @@ Feature: Status Desktop community Then the channel count is 1 @mayfail - # TODO: Weak. Sometimes passes sometimes fails (standalone or as part of the sequence). To anaylize. + # TODO: Weak. Sometimes passes sometimes fails (standalone or as part of the sequence). To analyze. Scenario Outline: The admin creates a community category Given the admin creates a community channel named "", with description "Some description", with the method "" When the admin creates a community category named "", with channels "" and with the method "" @@ -85,7 +85,7 @@ Feature: Status Desktop community Then the category named "test-category" is missing @mayfail - # TODO: Weak. Sometimes passes sometimes fails (standalone or as part of the sequence). To anaylize. + # TODO: Weak. Sometimes passes sometimes fails (standalone or as part of the sequence). To analyze. # Also TODO: Missing validation of description changed and color changed. Now validation only checks the new community name. Scenario Outline: The admin edits a community When the admin renames the community to "" and description to "" and color to "" diff --git a/test/ui-test/testSuites/suite_communities/tst_communityMessageFlows/test.feature b/test/ui-test/testSuites/suite_communities/tst_communityMessageFlows/test.feature index 9b87ce134f..aa8b6d323c 100644 --- a/test/ui-test/testSuites/suite_communities/tst_communityMessageFlows/test.feature +++ b/test/ui-test/testSuites/suite_communities/tst_communityMessageFlows/test.feature @@ -24,28 +24,22 @@ Feature: Status Desktop community messages And the user creates a community named "test_community", with description "Community description", intro "community intro" and outro "commmunity outro" Then the user lands on the community named "test_community" - @mayfail - # TODO: Verification is broken. Scenario: The user sends a test image When the user sends a test image in the current channel Then the last chat message contains the test image - @mayfail - # TODO: Verification is broken. Scenario: The user sends a test image with a message When the user sends a test image in the current channel with message "Message" with an image Then the test image is displayed just before the last message And the last chat message contains "Message" @mayfail - # TODO: Verification is broken and the action of multiple images doesn't work. It is only sent one. + # TODO: The action of sending multiple images doesn't work. It is only sent one. Scenario: The user sends multiple test images with a message When the user sends multiple test images in the current channel with message "Message" with an image again Then the test images are displayed just before the last message And the last chat message contains "Message" - @mayfail - # TODO: The action is broken. Review it. Scenario: The user pins and unpins messages # This one wont work until #6554 is fixed # And the amount of pinned messages is 0 diff --git a/test/ui-test/testSuites/suite_messaging/shared/scripts/chat_names.py b/test/ui-test/testSuites/suite_messaging/shared/scripts/chat_names.py index 5e76d11f58..1e10093da8 100644 --- a/test/ui-test/testSuites/suite_messaging/shared/scripts/chat_names.py +++ b/test/ui-test/testSuites/suite_messaging/shared/scripts/chat_names.py @@ -9,7 +9,6 @@ chatView_editMessageButton = {"container": chatView_log, "objectName": "editMess chatView_editMessageInputComponent = {"container": statusDesktop_mainWindow, "objectName": "editMessageInput", "type": "StatusChatInput", "visible": True} chatView_editMessageInputTextArea = {"container": chatView_editMessageInputComponent, "objectName": "messageInputField", "type": "TextArea", "visible": True} chatView_DeleteMessageButton = {"container": chatView_log, "objectName": "chatDeleteMessageButton", "type": "StatusFlatRoundButton"} -chatView_TogglePinMessageButton = {"container": chatView_log, "objectName": "MessageView_toggleMessagePin", "type": "StatusFlatRoundButton", "visible": True} chatButtonsPanelConfirmDeleteMessageButton_StatusButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "chatButtonsPanelConfirmDeleteMessageButton", "type": "StatusButton"} mark_as_Read_StatusMenuItemDelegate = {"container": statusDesktop_mainWindow_overlay, "objectName": "chatMarkAsReadMenuItem", "type": "StatusMenuItemDelegate", "visible": True} chat_Input_Stickers_Button = {"container": statusDesktop_mainWindow, "objectName": "statusChatInputStickersButton", "type": "StatusFlatRoundButton", "visible": True} diff --git a/ui/app/AppLayouts/Chat/views/ChatHeaderContentView.qml b/ui/app/AppLayouts/Chat/views/ChatHeaderContentView.qml index 28c78bec68..2f30e03f0d 100644 --- a/ui/app/AppLayouts/Chat/views/ChatHeaderContentView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatHeaderContentView.qml @@ -264,6 +264,8 @@ Item { id: statusChatInfoButton StatusChatInfoButton { + readonly property string emojiIcon: chatContentModule? chatContentModule.chatDetails.emoji : "" // Needed for test + objectName: "chatInfoBtnInHeader" title: { const module = root.rootStore.currentChatContentModule() @@ -305,7 +307,7 @@ Item { Utils.colorForPubkey(chatContentModule.chatDetails.id) : chatContentModule.chatDetails.color : "" - asset.emoji: chatContentModule? chatContentModule.chatDetails.emoji : "" + asset.emoji: emojiIcon asset.emojiSize: "24x24" type: chatContentModule? chatContentModule.chatDetails.type : Constants.chatType.unknown pinnedMessagesCount: chatContentModule? chatContentModule.pinnedMessagesModel.count : 0