chore(@e2e): replace clicking listItem with checking checkbox

This commit is contained in:
Anastasiya Semenkevich 2024-11-05 11:44:18 +03:00 committed by Anastasiya
parent 1b2f4f3c94
commit e6a7af8708
2 changed files with 13 additions and 9 deletions

View File

@ -7,6 +7,7 @@ import configs.timeouts
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
@ -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)
@ -39,12 +41,13 @@ class InviteContactsPopup(BasePopup):
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

View File

@ -179,11 +179,12 @@ save_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_o
# 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