Skip to content

Commit

Permalink
chore(@e2e): replace clicking listItem with checking checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
anastasiyaig committed Nov 5, 2024
1 parent 1b2f4f3 commit e6a7af8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
13 changes: 8 additions & 5 deletions test/e2e/gui/components/community/invite_contacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import driver
from gui.components.base_popup import BasePopup
from gui.elements.button import Button
from gui.elements.check_box import CheckBox
from gui.elements.object import QObject
from gui.elements.text_edit import TextEdit
from gui.objects_map import names
Expand All @@ -17,6 +18,7 @@ class InviteContactsPopup(BasePopup):
def __init__(self):
super().__init__()
self._member_item = QObject(names.o_StatusMemberListItem)
self.member_checkbox = CheckBox(names.memberListCheckbox)
self._next_button = Button(names.next_StatusButton)
self._message_text_edit = TextEdit(names.communityProfilePopupInviteMessagePanel_MessageInput_TextEdit)
self._invited_member_item = QObject(names.o_StatusMemberListItem_2)
Expand All @@ -39,12 +41,13 @@ def invite(self, contacts: typing.List[str], message: str):
f'Contact: {contact} not found in {self.contacts}'

selected = []
for member in driver.findAllObjects(self._member_item.real_name):
if str(getattr(member, 'userName', '')) in contacts:
driver.mouseClick(member)
selected.append(member.userName)
for member in driver.findAllObjects(self.member_checkbox.real_name):
if str(getattr(member, 'objectName', '')).split('-')[1] in contacts:
CheckBox(member).set(True)
assert member.checkState != 0, f"Member item checkbox is not checked"
selected.append(str(getattr(member, 'objectName', '')).split('-')[1])

assert len(contacts) == len(selected), f'Selected contacts: {selected}, expected: {contacts}'
assert set(contacts) == set(selected), f'Selected contacts: {selected}, expected: {contacts}'

self._next_button.click()
self._message_text_edit.text = message
Expand Down
9 changes: 5 additions & 4 deletions test/e2e/gui/objects_map/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,12 @@
# Invite Contacts Popup
communityProfilePopupInviteFrindsPanel = {"container": statusDesktop_mainWindow_overlay, "objectName": "CommunityProfilePopupInviteFrindsPanel_ColumnLayout", "type": "ProfilePopupInviteFriendsPanel", "visible": True}
communityProfilePopupInviteMessagePanel = {"container": statusDesktop_mainWindow_overlay, "objectName": "CommunityProfilePopupInviteMessagePanel_ColumnLayout", "type": "ProfilePopupInviteMessagePanel", "visible": True}
o_StatusMemberListItem = {"container": communityProfilePopupInviteFrindsPanel, "type": "StatusMemberListItem", "unnamed": 1, "visible": True}
next_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "InviteFriendsToCommunityPopup_NextButton", "text": "Next", "type": "StatusButton", "visible": True}
o_StatusMemberListItem = {"container": statusDesktop_mainWindow_overlay, "objectName": RegularExpression("statusMemberListItem*"), "type": "StatusMemberListItem", "visible": True}
memberListCheckbox = {"checkable": True, "container": statusDesktop_mainWindow_overlay, "objectName": RegularExpression("contactCheckbox-*"), "type": "StatusCheckBox", "visible": True}
next_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "InviteFriendsToCommunityPopup_NextButton", "type": "StatusButton", "visible": True}
communityProfilePopupInviteMessagePanel_MessageInput_TextEdit = {"container": communityProfilePopupInviteMessagePanel, "objectName": "CommunityProfilePopupInviteMessagePanel_MessageInput", "type": "TextEdit", "visible": True}
send_1_invite_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "InviteFriendsToCommunityPopup_SendButton", "text": "Send 1 invite", "type": "StatusButton", "visible": True}
o_StatusMemberListItem_2 = {"container": communityProfilePopupInviteMessagePanel, "type": "StatusMemberListItem", "unnamed": 1, "visible": True}
send_1_invite_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "InviteFriendsToCommunityPopup_SendButton", "type": "StatusButton", "visible": True}
o_StatusMemberListItem_2 = {"container": communityProfilePopupInviteMessagePanel, "objectName": RegularExpression("statusMemberListItem*"), "type": "StatusMemberListItem", "visible": True}
copy_icon_StatusIcon = {"container": statusDesktop_mainWindow_overlay, "objectName": "copy-icon", "type": "StatusIcon", "visible": True}

# Welcome community
Expand Down

0 comments on commit e6a7af8

Please sign in to comment.