test: replaced old test of sending request to send/accept/decline request and remove contact

This commit is contained in:
Valentina Novgorodtceva 2024-06-24 15:36:26 +07:00 committed by Anastasiya
parent 50553f623a
commit afde836517
8 changed files with 168 additions and 158 deletions

View File

@ -5,6 +5,8 @@ import configs
import constants import constants
import driver import driver
from gui.components.base_popup import BasePopup from gui.components.base_popup import BasePopup
from gui.components.context_menu import ContextMenu
from gui.components.settings.review_contact_request_popup import AcceptRequestFromProfile
from gui.components.settings.send_contact_request_popup import SendContactRequestFromProfile from gui.components.settings.send_contact_request_popup import SendContactRequestFromProfile
from gui.elements.button import Button from gui.elements.button import Button
from gui.elements.object import QObject from gui.elements.object import QObject
@ -94,13 +96,33 @@ class ProfilePopupFromMembers(ProfilePopup):
def __init__(self): def __init__(self):
super(ProfilePopupFromMembers, self).__init__() super(ProfilePopupFromMembers, self).__init__()
self._send_request_button = Button(names.send_contact_request_StatusButton) self._send_request_button = Button(names.send_contact_request_StatusButton)
self._request_id_request_button = Button(names.request_ID_verification_StatusFlatButton) self._review_request_button = Button(names.review_contact_request_StatusButton)
self._send_message_button = Button(names.send_Message_StatusButton)
self._menu_button = Button(names.menuButton_StatusFlatButton)
@allure.step('Click send request button') @allure.step('Click send request button')
def send_request(self): def send_request(self):
self._send_request_button.click() self._send_request_button.click()
return SendContactRequestFromProfile().wait_until_appears() return SendContactRequestFromProfile().wait_until_appears()
@allure.step('Get request id button visibility state') @allure.step('Get send request button visibilty state')
def is_request_id_button_visible(self): def is_send_request_button_visible(self):
return self._request_id_request_button.is_visible return self._send_request_button.is_visible
@allure.step('Click review contact request button')
def review_contact_request(self):
self._review_request_button.click()
return AcceptRequestFromProfile().wait_until_appears()
@allure.step('Get send message button visibility state')
def is_send_message_button_visible(self):
return self._send_message_button.is_visible
@allure.step('Click menu button')
def click_menu_button(self):
self._menu_button.click()
@allure.step('Choose option from context menu')
def choose_context_menu_option(self, value: str):
self.click_menu_button()
ContextMenu().select(value)

View File

@ -0,0 +1,22 @@
import allure
import configs
from gui.components.base_popup import BasePopup
from gui.elements.button import Button
from gui.objects_map import names
class RemoveContactPopup(BasePopup):
def __init__(self):
super().__init__()
self._remove_contact_button = Button(names.remove_contact_StatusButton)
@allure.step('Wait until appears {0}')
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
self._remove_contact_button.wait_until_appears(timeout_msec)
return self
@allure.step('Remove contact')
def remove(self):
self._remove_contact_button.click()

View File

@ -0,0 +1,27 @@
import allure
import configs
from gui.components.base_popup import BasePopup
from gui.elements.button import Button
from gui.objects_map import names
class AcceptRequestFromProfile(BasePopup):
def __init__(self):
super().__init__()
self._accept_button = Button(names.accept_StatusButton)
self._ignore_button = Button(names.ignore_StatusFlatButton)
@allure.step('Wait until appears {0}')
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
self._accept_button.wait_until_appears(timeout_msec)
return self
@allure.step('Accept contact request')
def accept(self):
self._accept_button.click()
@allure.step('Decline contact request')
def decline(self):
self._ignore_button.click()

View File

@ -99,7 +99,11 @@ edit_TextEdit = {"container": ProfileContentItem, "id": "edit", "type": "TextEdi
https_status_app_StatusBaseText = {"container": edit_TextEdit, "type": "StatusBaseText", "unnamed": 1, "visible": True} https_status_app_StatusBaseText = {"container": edit_TextEdit, "type": "StatusBaseText", "unnamed": 1, "visible": True}
copy_icon_CopyButton = {"container": ProfileContentItem, "objectName": "copy-icon", "type": "CopyButton", "visible": True} copy_icon_CopyButton = {"container": ProfileContentItem, "objectName": "copy-icon", "type": "CopyButton", "visible": True}
request_ID_verification_StatusFlatButton = {"checkable": False, "container": ProfileContentItem, "objectName": "requestIDVerification_StatusItem", "type": "StatusFlatButton", "visible": True} request_ID_verification_StatusFlatButton = {"checkable": False, "container": ProfileContentItem, "objectName": "requestIDVerification_StatusItem", "type": "StatusFlatButton", "visible": True}
send_Message_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "sendMessageButton", "type": "StatusButton", "visible": True}
send_contact_request_StatusButton = {"checkable": False, "container": ProfileContentItem, "objectName": "profileDialog_sendContactRequestButton", "type": "StatusButton", "visible": True} send_contact_request_StatusButton = {"checkable": False, "container": ProfileContentItem, "objectName": "profileDialog_sendContactRequestButton", "type": "StatusButton", "visible": True}
review_contact_request_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "profileDialog_reviewContactRequestButton", "type": "StatusButton", "visible": True}
profileDialogView_ContentItem = {"container": statusDesktop_mainWindow_overlay, "objectName": "ProfileDialogView", "type": "ContentItem", "visible": True}
menuButton_StatusFlatButton = {"checkable": False, "container": profileDialogView_ContentItem, "id": "menuButton", "type": "StatusFlatButton", "unnamed": 1, "visible": True}
# Welcome Status Popup # Welcome Status Popup
betaConsent_StatusModal = {"container": statusDesktop_mainWindow_overlay, "objectName": "desktopBetaStatusModal", "type": "StatusModal", "visible": True} betaConsent_StatusModal = {"container": statusDesktop_mainWindow_overlay, "objectName": "desktopBetaStatusModal", "type": "StatusModal", "visible": True}
@ -189,6 +193,13 @@ send_Contact_Request_StatusButton = {"container": statusDesktop_mainWindow_overl
send_contact_request_StatusButton_2 = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "ProfileSendContactRequestModal_sendContactRequestButton", "type": "StatusButton", "visible": True} send_contact_request_StatusButton_2 = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "ProfileSendContactRequestModal_sendContactRequestButton", "type": "StatusButton", "visible": True}
profileSendContactRequestModal_sayWhoYouAreInput_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "ProfileSendContactRequestModal_sayWhoYouAreInput", "type": "TextEdit", "visible": True} profileSendContactRequestModal_sayWhoYouAreInput_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "ProfileSendContactRequestModal_sayWhoYouAreInput", "type": "TextEdit", "visible": True}
# Review Contact Request
ignore_StatusFlatButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "ignoreButton", "type": "StatusFlatButton", "visible": True}
accept_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "acceptButton", "type": "StatusButton", "visible": True}
# RemoveContactPopup
remove_contact_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "removeContactButton", "type": "StatusButton", "visible": True}
""" Common """ """ Common """
edit_TextEdit = {"container": statusDesktop_mainWindow_overlay, "type": "TextEdit", "unnamed": 1, "visible": True} edit_TextEdit = {"container": statusDesktop_mainWindow_overlay, "type": "TextEdit", "unnamed": 1, "visible": True}

View File

@ -1,154 +0,0 @@
from copy import deepcopy
from datetime import datetime
import allure
import pytest
from allure_commons._allure import step
import driver
from gui.components.profile_popup import ProfilePopupFromMembers
from gui.main_window import MainWindow
from . import marks
import configs
import constants
from constants import UserAccount
pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/736170',
"Add a contact from community's member list")
@pytest.mark.case(736170)
def test_add_a_contact_from_community_member_list(multiple_instances):
user_one: UserAccount = constants.user_account_one
user_two: UserAccount = constants.user_account_two
user_three: UserAccount = constants.user_account_three
community_params = deepcopy(constants.community_params)
community_params['name'] = f'{datetime.now():%d%m%Y_%H%M%S}'
main_screen = MainWindow()
with multiple_instances() as aut_one, multiple_instances() as aut_two, multiple_instances() as aut_three:
with step(f'Launch multiple instances with authorized users {user_one.name} and {user_two.name}'):
for aut, account in zip([aut_one, aut_two, aut_three], [user_one, user_two, user_three]):
aut.attach()
main_screen.wait_until_appears(configs.timeouts.APP_LOAD_TIMEOUT_MSEC).prepare()
main_screen.authorize_user(account)
main_screen.hide()
with step(f'User {user_two.name}, get chat key'):
aut_two.attach()
main_screen.prepare()
profile_popup = main_screen.left_panel.open_online_identifier().open_profile_popup_from_online_identifier()
chat_key = profile_popup.copy_chat_key
profile_popup.close()
main_screen.hide()
with step(f'User {user_one.name}, send contact request to {user_two.name}'):
aut_one.attach()
main_screen.prepare()
settings = main_screen.left_panel.open_settings()
messaging_settings = settings.left_panel.open_messaging_settings()
contacts_settings = messaging_settings.open_contacts_settings()
contact_request_popup = contacts_settings.open_contact_request_form()
contact_request_popup.send(chat_key, f'Hello {user_two.name}')
main_screen.hide()
with step(f'User {user_two.name}, accept contact request from {user_one.name}'):
aut_two.attach()
main_screen.prepare()
settings = main_screen.left_panel.open_settings()
messaging_settings = settings.left_panel.open_messaging_settings()
contacts_settings = messaging_settings.open_contacts_settings()
contacts_settings.accept_contact_request(user_one.name)
main_screen.hide()
with step(f'User {user_three.name}, get chat key'):
aut_three.attach()
main_screen.prepare()
profile_popup = main_screen.left_panel.open_online_identifier().open_profile_popup_from_online_identifier()
chat_key = profile_popup.copy_chat_key
profile_popup.close()
main_screen.hide()
with step(f'User {user_two.name}, send contact request to {user_three.name}'):
aut_two.attach()
main_screen.prepare()
settings = main_screen.left_panel.open_settings()
messaging_settings = settings.left_panel.open_messaging_settings()
contacts_settings = messaging_settings.open_contacts_settings()
contact_request_popup = contacts_settings.open_contact_request_form()
contact_request_popup.send(chat_key, f'Hello {user_three.name}')
main_screen.hide()
with step(f'User {user_three.name}, accept contact request from {user_two.name}'):
aut_three.attach()
main_screen.prepare()
settings = main_screen.left_panel.open_settings()
messaging_settings = settings.left_panel.open_messaging_settings()
contacts_settings = messaging_settings.open_contacts_settings()
contacts_settings.accept_contact_request(user_two.name)
main_screen.hide()
with step(f'User {user_two.name}, create community and invite {user_one.name} and {user_three.name}'):
aut_two.attach()
main_screen.prepare()
with step('Enable creation of community option'):
settings = main_screen.left_panel.open_settings()
settings.left_panel.open_advanced_settings().enable_creation_of_communities()
community = main_screen.create_community(community_params['name'], community_params['description'],
community_params['intro'], community_params['outro'],
community_params['logo']['fp'], community_params['banner']['fp'])
community.left_panel.invite_people_to_community([user_one.name], 'Message')
community.left_panel.invite_people_to_community([user_three.name], 'Message')
main_screen.hide()
with step(f'User {user_three.name}, accept invitation from {user_two.name}'):
aut_three.attach()
main_screen.prepare()
messages_view = main_screen.left_panel.open_messages_screen()
chat = messages_view.left_panel.click_chat_by_name(user_two.name)
community_screen = chat.accept_community_invite(community_params['name'], 0)
with step(f'User {user_three.name}, verify welcome community popup'):
welcome_popup = community_screen.left_panel.open_welcome_community_popup()
assert community_params['name'] in welcome_popup.title
assert community_params['intro'] == welcome_popup.intro
welcome_popup.join().authenticate(user_three.password)
assert driver.waitFor(lambda: not community_screen.left_panel.is_join_community_visible,
10000), 'Join community button not hidden'
main_screen.hide()
with step(f'User {user_one.name}, accept invitation from {user_two.name}'):
aut_one.attach()
main_screen.prepare()
messages_view = main_screen.left_panel.open_messages_screen()
chat = messages_view.left_panel.click_chat_by_name(user_two.name)
community_screen = chat.accept_community_invite(community_params['name'], 0)
with step(f'User {user_one.name}, verify welcome community popup'):
welcome_popup = community_screen.left_panel.open_welcome_community_popup()
assert community_params['name'] in welcome_popup.title
assert community_params['intro'] == welcome_popup.intro
welcome_popup.join().authenticate(user_one.password)
assert driver.waitFor(lambda: not community_screen.left_panel.is_join_community_visible,
10000), 'Join community button not hidden'
with step(f'User {user_one.name}, send contact request to {user_three.name} from channel'):
profile_popup = community_screen.right_panel.click_member(user_three.name)
profile_popup.send_request().send(f'Hello {user_three.name}')
ProfilePopupFromMembers().wait_until_appears()
main_screen.hide()
with step(f'User {user_three.name}, accept contact request from {user_one.name}'):
aut_three.attach()
main_screen.prepare()
settings = main_screen.left_panel.open_settings()
messaging_settings = settings.left_panel.open_messaging_settings()
contacts_settings = messaging_settings.open_contacts_settings()
contacts_settings.accept_contact_request(user_one.name)
main_screen.hide()
with step(f'User {user_one.name} verify that request ID button appeared in send request popup'):
aut_one.attach()
main_screen.prepare()
profile_popup.is_request_id_button_visible()

View File

@ -0,0 +1,80 @@
import allure
import pytest
from allure_commons._allure import step
import driver
from gui.components.profile_popup import ProfilePopupFromMembers
from gui.components.remove_contact_popup import RemoveContactPopup
from gui.main_window import MainWindow
from . import marks
import configs
import constants
from constants import UserAccount
pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/736170',
"Add a contact from community's member list")
@pytest.mark.case(736170)
@pytest.mark.parametrize('user_data_one, user_data_two, user_data_three', [
(configs.testpath.TEST_USER_DATA / 'squisher', configs.testpath.TEST_USER_DATA / 'athletic',
configs.testpath.TEST_USER_DATA / 'nervous')
])
def test_communities_send_accept_decline_request_remove_contact_from_profile(multiple_instances, user_data_one,
user_data_two, user_data_three):
user_one: UserAccount = constants.user_account_one
user_two: UserAccount = constants.user_account_two
user_three: UserAccount = constants.user_account_three
timeout = configs.timeouts.UI_LOAD_TIMEOUT_MSEC
main_screen = MainWindow()
with multiple_instances(user_data=user_data_one) as aut_one, multiple_instances(
user_data=user_data_two) as aut_two, multiple_instances(user_data=user_data_three) as aut_three:
with step(f'Launch multiple instances with authorized users {user_one.name}, {user_two.name}, {user_three}'):
for aut, account in zip([aut_one, aut_two, aut_three], [user_one, user_two, user_three]):
aut.attach()
main_screen.wait_until_appears(configs.timeouts.APP_LOAD_TIMEOUT_MSEC).prepare()
main_screen.authorize_user(account)
main_screen.hide()
with step(f'User {user_one.name}, send contact request to {user_three.name} from user profile'):
aut_one.attach()
main_screen.prepare()
community_screen = main_screen.left_panel.select_community('Community with 2 users')
profile_popup = community_screen.right_panel.click_member(user_three.name)
profile_popup.send_request().send(f'Hello {user_three.name}')
ProfilePopupFromMembers().wait_until_appears()
main_screen.hide()
with step(f'User {user_three.name}, accept contact request from {user_one.name} from user profile'):
aut_three.attach()
main_screen.prepare()
community_screen = main_screen.left_panel.select_community('Community with 2 users')
profile_popup = community_screen.right_panel.click_member(user_one.name)
profile_popup.review_contact_request().accept()
main_screen.hide()
with step(f'User {user_one.name} verify that send message button appeared in profile popup'):
aut_one.attach()
main_screen.prepare()
assert driver.waitFor(lambda: profile_popup.is_send_message_button_visible(),
timeout), f'Send message button is not visible'
with step(f'User {user_one.name} remove {user_three.name} from contacts from user profile'):
profile_popup.choose_context_menu_option('Remove contact')
RemoveContactPopup().wait_until_appears().remove()
with step(f'User {user_one.name}, send contact request to {user_three.name} from user profile again'):
profile_popup.send_request().send(f'Hello {user_three.name}')
ProfilePopupFromMembers().wait_until_appears()
main_screen.hide()
with step(f'User {user_three.name}, decline contact request from user profile {user_one.name}'):
aut_three.attach()
main_screen.prepare()
profile_popup.review_contact_request().decline()
with step(f'User {user_three.name} verify that send request button is available again in profile popup'):
assert driver.waitFor(lambda: profile_popup.is_send_request_button_visible,
timeout), f'Send request button is not visible'

View File

@ -52,6 +52,7 @@ CommonContactDialog {
StatusButton { StatusButton {
type: StatusBaseButton.Type.Danger type: StatusBaseButton.Type.Danger
text: qsTr("Remove contact") text: qsTr("Remove contact")
objectName: "removeContactButton"
onClicked: root.accepted() onClicked: root.accepted()
} }
} }

View File

@ -122,6 +122,7 @@ Pane {
StatusButton { StatusButton {
size: StatusButton.Size.Small size: StatusButton.Size.Small
text: qsTr("Send Message") text: qsTr("Send Message")
objectName: "sendMessageButton"
onClicked: { onClicked: {
root.contactsStore.joinPrivateChat(root.publicKey) root.contactsStore.joinPrivateChat(root.publicKey)
root.closeRequested() root.closeRequested()