chore: refactor edit account test a bit
This commit is contained in:
parent
a45de2c28e
commit
4f73e0eb52
|
@ -53,10 +53,17 @@ class UserCanvas(QObject):
|
|||
self._automatic_button.click()
|
||||
self.wait_until_hidden()
|
||||
|
||||
@allure.step('Open Profile popup')
|
||||
def open_profile_popup(self) -> ProfilePopup:
|
||||
@allure.step('Open Profile popup from online identifier')
|
||||
def open_profile_popup_from_online_identifier(self, attempts: int =2) -> ProfilePopup:
|
||||
self._view_my_profile_button.click()
|
||||
return ProfilePopup().wait_until_appears()
|
||||
time.sleep(0.5)
|
||||
try:
|
||||
return ProfilePopup()
|
||||
except Exception as ex:
|
||||
if attempts:
|
||||
self.open_profile_popup_from_online_identifier(attempts - 1)
|
||||
else:
|
||||
raise ex
|
||||
|
||||
@allure.step('Verify: User image contains text')
|
||||
def is_user_image_contains(self, text: str):
|
||||
|
|
|
@ -48,7 +48,12 @@ class LeftPanel(QObject):
|
|||
community_names = []
|
||||
for obj in driver.findAllObjects(self._community_template_button.real_name):
|
||||
community_names.append(obj.name)
|
||||
return community_names
|
||||
|
||||
if len(community_names) == 0:
|
||||
raise LookupError(
|
||||
'Communities not found')
|
||||
else:
|
||||
return community_names
|
||||
|
||||
@property
|
||||
@allure.step('Get user badge color')
|
||||
|
@ -60,14 +65,21 @@ class LeftPanel(QObject):
|
|||
self._messages_button.click()
|
||||
return MessagesScreen().wait_until_appears()
|
||||
|
||||
@allure.step('Open user canvas')
|
||||
def open_user_canvas(self) -> UserCanvas:
|
||||
@allure.step('Open user online identifier')
|
||||
def open_user_online_identifier(self, attempts: int = 2) -> UserCanvas:
|
||||
time.sleep(0.5)
|
||||
self._profile_button.click()
|
||||
return UserCanvas().wait_until_appears()
|
||||
try:
|
||||
return UserCanvas()
|
||||
except Exception as ex:
|
||||
if attempts:
|
||||
self.open_user_online_identifier(attempts - 1)
|
||||
else:
|
||||
raise ex
|
||||
|
||||
@allure.step('Set user to online')
|
||||
def set_user_to_online(self):
|
||||
self.open_user_canvas().set_user_state_online()
|
||||
self.open_user_online_identifier().set_user_state_online()
|
||||
|
||||
@allure.step('Verify: User is online')
|
||||
def user_is_online(self) -> bool:
|
||||
|
@ -75,7 +87,7 @@ class LeftPanel(QObject):
|
|||
|
||||
@allure.step('Set user to offline')
|
||||
def set_user_to_offline(self):
|
||||
self.open_user_canvas().set_user_state_offline()
|
||||
self.open_user_online_identifier().set_user_state_offline()
|
||||
|
||||
@allure.step('Verify: User is offline')
|
||||
def user_is_offline(self):
|
||||
|
@ -83,7 +95,7 @@ class LeftPanel(QObject):
|
|||
|
||||
@allure.step('Set user to automatic')
|
||||
def set_user_to_automatic(self):
|
||||
self.open_user_canvas().set_user_automatic_state()
|
||||
self.open_user_online_identifier().set_user_automatic_state()
|
||||
|
||||
@allure.step('Verify: User is set to automatic')
|
||||
def user_is_set_to_automatic(self):
|
||||
|
|
|
@ -50,9 +50,16 @@ class LeftPanel(QObject):
|
|||
raise ex
|
||||
|
||||
@allure.step('Open wallet settings')
|
||||
def open_wallet_settings(self) -> WalletSettingsView:
|
||||
def open_wallet_settings(self, attempts: int = 2) -> WalletSettingsView:
|
||||
self._open_settings('4-AppMenuItem')
|
||||
return WalletSettingsView().wait_until_appears()
|
||||
time.sleep(0.5)
|
||||
try:
|
||||
return WalletSettingsView()
|
||||
except Exception as ex:
|
||||
if attempts:
|
||||
self.open_wallet_settings(attempts-1)
|
||||
else:
|
||||
raise ex
|
||||
|
||||
@allure.step('Open profile settings')
|
||||
def open_profile_settings(self) -> ProfileSettingsView:
|
||||
|
|
|
@ -63,8 +63,14 @@ class WalletSettingsView(QObject):
|
|||
|
||||
@allure.step('Get keypair names')
|
||||
def get_keypairs_names(self):
|
||||
return [str(getattr(item, 'title', '')) for item in
|
||||
driver.findAllObjects(self._wallet_settings_keypair_item.real_name)]
|
||||
keypair_names = []
|
||||
for item in driver.findAllObjects(self._wallet_settings_keypair_item.real_name):
|
||||
keypair_names.append(str(getattr(item, 'title', '')))
|
||||
if keypair_names == 0:
|
||||
raise LookupError(
|
||||
'No keypairs found on the wallet settings screen')
|
||||
else:
|
||||
return keypair_names
|
||||
|
||||
@allure.step('Open account view in wallet settings by name')
|
||||
def open_account_in_settings(self, name):
|
||||
|
@ -252,7 +258,7 @@ class EditNetworkSettings(WalletSettingsView):
|
|||
self._test_network_tab.click()
|
||||
|
||||
@allure.step('Click Revert to default button and redirect to Networks screen')
|
||||
def click_revert_to_default_and_go_to_networks_main_screen(self, attempts: int=2):
|
||||
def click_revert_to_default_and_go_to_networks_main_screen(self, attempts: int = 2):
|
||||
self._network_edit_scroll.vertical_down_to(self._network_revert_to_default)
|
||||
self._network_revert_to_default.click()
|
||||
try:
|
||||
|
|
|
@ -35,7 +35,7 @@ def test_join_community_via_owner_invite(multiple_instance, user_data_one, user_
|
|||
with step(f'User {user_two.name}, get chat key'):
|
||||
aut_two.attach()
|
||||
main_window.prepare()
|
||||
profile_popup = main_window.left_panel.open_user_canvas().open_profile_popup()
|
||||
profile_popup = main_window.left_panel.open_user_online_identifier().open_profile_popup_from_online_identifier()
|
||||
chat_key = profile_popup.chat_key
|
||||
profile_popup.close()
|
||||
main_window.hide()
|
||||
|
|
|
@ -36,7 +36,7 @@ def test_group_chat(multiple_instance, user_data_one, user_data_two, user_data_t
|
|||
with step(f'User {user_two.name}, get chat key'):
|
||||
aut_two.attach()
|
||||
main_window.prepare()
|
||||
profile_popup = main_window.left_panel.open_user_canvas().open_profile_popup()
|
||||
profile_popup = main_window.left_panel.open_user_online_identifier().open_profile_popup_from_online_identifier()
|
||||
chat_key = profile_popup.chat_key
|
||||
profile_popup.close()
|
||||
main_window.hide()
|
||||
|
@ -63,7 +63,7 @@ def test_group_chat(multiple_instance, user_data_one, user_data_two, user_data_t
|
|||
with step(f'User {user_three.name}, get chat key'):
|
||||
aut_three.attach()
|
||||
main_window.prepare()
|
||||
profile_popup = main_window.left_panel.open_user_canvas().open_profile_popup()
|
||||
profile_popup = main_window.left_panel.open_user_online_identifier().open_profile_popup_from_online_identifier()
|
||||
chat_key = profile_popup.chat_key
|
||||
profile_popup.close()
|
||||
main_window.hide()
|
||||
|
|
|
@ -84,7 +84,7 @@ def test_generate_new_keys(main_window, keys_screen, user_name: str, password, u
|
|||
|
||||
with step('Open User Canvas and verify user info'):
|
||||
|
||||
user_canvas = main_window.left_panel.open_user_canvas()
|
||||
user_canvas = main_window.left_panel.open_user_online_identifier()
|
||||
assert user_canvas.user_name == user_name
|
||||
# TODO: temp removing tesseract usage because it is not stable
|
||||
# if user_image is None:
|
||||
|
@ -95,7 +95,7 @@ def test_generate_new_keys(main_window, keys_screen, user_name: str, password, u
|
|||
|
||||
with step('Open Profile popup and verify user info'):
|
||||
|
||||
profile_popup = user_canvas.open_profile_popup()
|
||||
profile_popup = user_canvas.open_profile_popup_from_online_identifier()
|
||||
assert profile_popup.user_name == user_name
|
||||
assert profile_popup.chat_key == chat_key
|
||||
assert profile_popup.emoji_hash.compare(emoji_hash.view, threshold=0.9)
|
||||
|
|
|
@ -58,7 +58,7 @@ def test_import_seed_phrase(aut: AUT, keys_screen, main_window, user_account, au
|
|||
f"Recovered account should have address {user_account.status_address}, but has {address}"
|
||||
|
||||
with step('Verify that the user logged in via seed phrase correctly'):
|
||||
user_canvas = main_window.left_panel.open_user_canvas()
|
||||
profile_popup = user_canvas.open_profile_popup()
|
||||
user_canvas = main_window.left_panel.open_user_online_identifier()
|
||||
profile_popup = user_canvas.open_profile_popup_from_online_identifier()
|
||||
assert profile_popup.user_name == user_account.name
|
||||
|
||||
|
|
|
@ -50,8 +50,8 @@ def test_login_with_wrong_password(aut: AUT, keys_screen, main_window, error: st
|
|||
BetaConsentPopup().confirm()
|
||||
|
||||
with step('Verify that the user logged in correctly'):
|
||||
user_canvas = main_window.left_panel.open_user_canvas()
|
||||
profile_popup = user_canvas.open_profile_popup()
|
||||
user_canvas = main_window.left_panel.open_user_online_identifier()
|
||||
profile_popup = user_canvas.open_profile_popup_from_online_identifier()
|
||||
assert profile_popup.user_name == user_one.name
|
||||
|
||||
with step('Restart application and input wrong password'):
|
||||
|
|
|
@ -86,7 +86,7 @@ def test_sync_device_during_onboarding(multiple_instance, user_data):
|
|||
BetaConsentPopup().confirm()
|
||||
|
||||
with step('Verify user details are the same with user in first instance'):
|
||||
user_canvas = main_window.left_panel.open_user_canvas()
|
||||
user_canvas = main_window.left_panel.open_user_online_identifier()
|
||||
user_canvas_name = user_canvas.user_name
|
||||
assert user_canvas_name == user.name
|
||||
# TODO: temp removing tesseract usage because it is not stable
|
||||
|
|
|
@ -16,15 +16,15 @@ pytestmark = allure.suite("Settings")
|
|||
@pytest.mark.parametrize('new_name', [pytest.param('NewUserName')])
|
||||
def test_change_own_display_name(main_screen: MainWindow, user_account, new_name):
|
||||
with step('Open own profile popup and check name of user is correct'):
|
||||
profile = main_screen.left_panel.open_user_canvas()
|
||||
profile_popup = profile.open_profile_popup()
|
||||
profile = main_screen.left_panel.open_user_online_identifier()
|
||||
profile_popup = profile.open_profile_popup_from_online_identifier()
|
||||
assert profile_popup.user_name == user_account.name
|
||||
|
||||
with step('Go to edit profile settings and change the name of the user'):
|
||||
profile_popup.edit_profile().set_name(new_name)
|
||||
|
||||
with step('Open own profile popup and check name of user is correct'):
|
||||
assert main_screen.left_panel.open_user_canvas().open_profile_popup().user_name == new_name
|
||||
assert main_screen.left_panel.open_user_online_identifier().open_profile_popup_from_online_identifier().user_name == new_name
|
||||
|
||||
|
||||
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703002', 'Switch state to offline')
|
||||
|
|
|
@ -31,7 +31,7 @@ def test_messaging_settings_accepting_request(multiple_instance, user_data_one,
|
|||
with step(f'User {user_two.name}, get chat key'):
|
||||
aut_two.attach()
|
||||
main_window.prepare()
|
||||
profile_popup = main_window.left_panel.open_user_canvas().open_profile_popup()
|
||||
profile_popup = main_window.left_panel.open_user_online_identifier().open_profile_popup_from_online_identifier()
|
||||
chat_key = profile_popup.chat_key
|
||||
profile_popup.close()
|
||||
main_window.hide()
|
||||
|
@ -63,13 +63,12 @@ def test_messaging_settings_accepting_request(multiple_instance, user_data_one,
|
|||
assert user_one.name == contacts_settings.contact_items[0].contact
|
||||
assert len(contacts_settings.contact_items) == 1
|
||||
|
||||
# TODO: https://github.com/status-im/desktop-qa-automation/issues/346
|
||||
# with step('Verify toast message about new contact request received'):
|
||||
# assert len(ToastMessage().get_toast_messages) == 1, \
|
||||
# f"Multiple toast messages appeared"
|
||||
# message = ToastMessage().get_toast_messages[0]
|
||||
# assert message == Messaging.NEW_CONTACT_REQUEST.value, \
|
||||
# f"Toast message is incorrect, current message is {message}"
|
||||
with step('Verify toast message about new contact request received'):
|
||||
assert len(ToastMessage().get_toast_messages) == 1, \
|
||||
f"Multiple toast messages appeared"
|
||||
message = ToastMessage().get_toast_messages[0]
|
||||
assert message == Messaging.NEW_CONTACT_REQUEST.value, \
|
||||
f"Toast message is incorrect, current message is {message}"
|
||||
|
||||
with step(f'User {user_two.name}, accept contact request from {user_one.name}'):
|
||||
contacts_settings.accept_contact_request(user_one.name)
|
||||
|
@ -90,65 +89,3 @@ def test_messaging_settings_accepting_request(multiple_instance, user_data_one,
|
|||
assert contacts_settings.contacts_list_title == 'Contacts'
|
||||
assert user_two.name == contacts_settings.contact_items[0].contact
|
||||
assert len(contacts_settings.contact_items) == 1
|
||||
|
||||
|
||||
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704610', 'Reject a contact request with a chat key')
|
||||
@pytest.mark.case(704610)
|
||||
@pytest.mark.parametrize('user_data_one, user_data_two', [
|
||||
(configs.testpath.TEST_USER_DATA / 'user_account_one', configs.testpath.TEST_USER_DATA / 'user_account_two')
|
||||
])
|
||||
def test_messaging_settings_rejecting_request(multiple_instance, user_data_one, user_data_two):
|
||||
user_one: UserAccount = constants.user_account_one
|
||||
user_two: UserAccount = constants.user_account_two
|
||||
main_window = MainWindow()
|
||||
|
||||
with multiple_instance() as aut_one, multiple_instance() as aut_two:
|
||||
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], [user_one, user_two]):
|
||||
aut.attach()
|
||||
main_window.wait_until_appears(configs.timeouts.APP_LOAD_TIMEOUT_MSEC).prepare()
|
||||
main_window.authorize_user(account)
|
||||
main_window.hide()
|
||||
|
||||
with step(f'User {user_two.name}, get chat key'):
|
||||
aut_two.attach()
|
||||
main_window.prepare()
|
||||
profile_popup = main_window.left_panel.open_user_canvas().open_profile_popup()
|
||||
chat_key = profile_popup.chat_key
|
||||
profile_popup.close()
|
||||
main_window.hide()
|
||||
|
||||
with step(f'User {user_one.name}, send contact request to {user_two.name}'):
|
||||
aut_one.attach()
|
||||
main_window.prepare()
|
||||
settings = main_window.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_window.hide()
|
||||
|
||||
with step(f'Verify that contact request from user {user_two.name} was received and reject contact request'):
|
||||
aut_two.attach()
|
||||
main_window.prepare()
|
||||
settings = main_window.left_panel.open_settings()
|
||||
messaging_settings = settings.left_panel.open_messaging_settings()
|
||||
contacts_settings = messaging_settings.open_contacts_settings()
|
||||
contacts_settings.open_pending_requests()
|
||||
contacts_settings.reject_contact_request(user_one.name)
|
||||
|
||||
with step(f'Verify that contacts list of {user_two.name} is empty in messaging settings'):
|
||||
contacts_settings = main_window.left_panel.open_settings().left_panel.open_messaging_settings().open_contacts_settings()
|
||||
contacts_settings.open_contacts()
|
||||
assert contacts_settings.no_friends_item_text == Messaging.NO_FRIENDS_ITEM.value
|
||||
assert contacts_settings.is_invite_friends_button_visible
|
||||
main_window.hide()
|
||||
|
||||
with step(f'Verify that contacts list of {user_one.name} is empty in messaging settings'):
|
||||
aut_one.attach()
|
||||
main_window.prepare()
|
||||
contacts_settings = main_window.left_panel.open_settings().left_panel.open_messaging_settings().open_contacts_settings()
|
||||
contacts_settings.open_contacts()
|
||||
assert contacts_settings.no_friends_item_text == Messaging.NO_FRIENDS_ITEM.value
|
||||
assert contacts_settings.is_invite_friends_button_visible
|
|
@ -32,7 +32,7 @@ def test_messaging_settings_identity_verification(multiple_instance, user_data_o
|
|||
with step(f'User {user_two.name}, get chat key'):
|
||||
aut_two.attach()
|
||||
main_window.prepare()
|
||||
profile_popup = main_window.left_panel.open_user_canvas().open_profile_popup()
|
||||
profile_popup = main_window.left_panel.open_user_online_identifier().open_profile_popup_from_online_identifier()
|
||||
chat_key = profile_popup.chat_key
|
||||
profile_popup.close()
|
||||
main_window.hide()
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
import allure
|
||||
import configs.testpath
|
||||
import configs.timeouts
|
||||
import constants
|
||||
import pytest
|
||||
from allure_commons._allure import step
|
||||
from constants import UserAccount
|
||||
from constants.messaging import Messaging
|
||||
from gui.main_window import MainWindow
|
||||
|
||||
|
||||
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704610', 'Reject a contact request with a chat key')
|
||||
@pytest.mark.case(704610)
|
||||
@pytest.mark.parametrize('user_data_one, user_data_two', [
|
||||
(configs.testpath.TEST_USER_DATA / 'user_account_one', configs.testpath.TEST_USER_DATA / 'user_account_two')
|
||||
])
|
||||
def test_messaging_settings_rejecting_request(multiple_instance, user_data_one, user_data_two):
|
||||
user_one: UserAccount = constants.user_account_one
|
||||
user_two: UserAccount = constants.user_account_two
|
||||
main_window = MainWindow()
|
||||
|
||||
with multiple_instance() as aut_one, multiple_instance() as aut_two:
|
||||
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], [user_one, user_two]):
|
||||
aut.attach()
|
||||
main_window.wait_until_appears(configs.timeouts.APP_LOAD_TIMEOUT_MSEC).prepare()
|
||||
main_window.authorize_user(account)
|
||||
main_window.hide()
|
||||
|
||||
with step(f'User {user_two.name}, get chat key'):
|
||||
aut_two.attach()
|
||||
main_window.prepare()
|
||||
profile_popup = main_window.left_panel.open_user_online_identifier().open_profile_popup_from_online_identifier()
|
||||
chat_key = profile_popup.chat_key
|
||||
profile_popup.close()
|
||||
main_window.hide()
|
||||
|
||||
with step(f'User {user_one.name}, send contact request to {user_two.name}'):
|
||||
aut_one.attach()
|
||||
main_window.prepare()
|
||||
settings = main_window.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_window.hide()
|
||||
|
||||
with step(f'Verify that contact request from user {user_two.name} was received and reject contact request'):
|
||||
aut_two.attach()
|
||||
main_window.prepare()
|
||||
settings = main_window.left_panel.open_settings()
|
||||
messaging_settings = settings.left_panel.open_messaging_settings()
|
||||
contacts_settings = messaging_settings.open_contacts_settings()
|
||||
contacts_settings.open_pending_requests()
|
||||
contacts_settings.reject_contact_request(user_one.name)
|
||||
|
||||
with step(f'Verify that contacts list of {user_two.name} is empty in messaging settings'):
|
||||
contacts_settings = main_window.left_panel.open_settings().left_panel.open_messaging_settings().open_contacts_settings()
|
||||
contacts_settings.open_contacts()
|
||||
assert contacts_settings.no_friends_item_text == Messaging.NO_FRIENDS_ITEM.value
|
||||
assert contacts_settings.is_invite_friends_button_visible
|
||||
main_window.hide()
|
||||
|
||||
with step(f'Verify that contacts list of {user_one.name} is empty in messaging settings'):
|
||||
aut_one.attach()
|
||||
main_window.prepare()
|
||||
contacts_settings = main_window.left_panel.open_settings().left_panel.open_messaging_settings().open_contacts_settings()
|
||||
contacts_settings.open_contacts()
|
||||
assert contacts_settings.no_friends_item_text == Messaging.NO_FRIENDS_ITEM.value
|
||||
assert contacts_settings.is_invite_friends_button_visible
|
|
@ -24,6 +24,6 @@ def test_change_password_and_login(aut: AUT, main_screen: MainWindow, user_accou
|
|||
main_screen.authorize_user(user_account_changed_password)
|
||||
|
||||
with step('Verify that the user logged in correctly'):
|
||||
user_canvas = main_screen.left_panel.open_user_canvas()
|
||||
profile_popup = user_canvas.open_profile_popup()
|
||||
user_canvas = main_screen.left_panel.open_user_online_identifier()
|
||||
profile_popup = user_canvas.open_profile_popup_from_online_identifier()
|
||||
assert profile_popup.user_name == user_account.name
|
||||
|
|
|
@ -18,16 +18,20 @@ from gui.screens.settings import SettingsScreen
|
|||
string.digits, k=40)))
|
||||
])
|
||||
def test_settings_edit_status_account(main_screen: MainWindow, new_name):
|
||||
with step('Open profile and wallet setting and check that display name equals to Status keypair name'):
|
||||
status_keypair_title = \
|
||||
main_screen.left_panel.open_settings().left_panel.open_wallet_settings().get_keypairs_names()[0]
|
||||
with step('Open profile and wallet setting and check the keypairs list is not empty'):
|
||||
settings = main_screen.left_panel.open_settings().left_panel.open_wallet_settings()
|
||||
assert settings.get_keypairs_names !=0, f'Keypairs are not displayed'
|
||||
|
||||
with step('Verify Status keypair title'):
|
||||
status_keypair_title = settings.get_keypairs_names()[0]
|
||||
profile_display_name = main_screen.left_panel.open_settings().left_panel.open_profile_settings().display_name
|
||||
assert profile_display_name in status_keypair_title, \
|
||||
f"Status keypair name should be equal to display name but currently it is {status_keypair_title}, \
|
||||
when display name is {profile_display_name}"
|
||||
|
||||
status_acc_view = (
|
||||
SettingsScreen().left_panel.open_wallet_settings().open_status_account_in_settings())
|
||||
with step('Open Status account view in wallet settings'):
|
||||
status_acc_view = (
|
||||
SettingsScreen().left_panel.open_wallet_settings().open_status_account_in_settings())
|
||||
|
||||
with step('Check the default values on the account details view for Status account'):
|
||||
assert status_acc_view.get_account_name_value() == WalletNetworkSettings.STATUS_ACCOUNT_DEFAULT_NAME.value, \
|
||||
|
|
Loading…
Reference in New Issue