chore: fix tests

This commit is contained in:
Anastasiya Semenkevich 2024-10-10 13:26:23 +03:00 committed by Anastasiya
parent e99f817ccc
commit 65798a0046
31 changed files with 58 additions and 76 deletions

View File

@ -16,7 +16,7 @@ from gui.objects_map import names
class BackUpYourSeedPhrasePopUp(BasePopup):
def __init__(self):
super(BackUpYourSeedPhrasePopUp, self).__init__()
super().__init__()
self._scroll = Scroll(names.generalView_StatusScrollView)
self._i_have_a_pen_and_paper_check_box = CheckBox(names.i_have_a_pen_and_paper_StatusCheckBox)
self._i_know_where_i_ll_store_it_check_box = CheckBox(names.i_know_where_I_ll_store_it_StatusCheckBox)
@ -111,4 +111,4 @@ class BackUpYourSeedPhrasePopUp(BasePopup):
self.confirm_second_word(seed_phrases)
self.continue_seed_phrase()
self.set_acknowledge(True)
self.complete_and_delete_seed_phrase()
self.complete_and_delete_seed_phrase().wait_until_hidden()

View File

@ -8,7 +8,7 @@ from gui.objects_map import names
class BasePopup(QObject):
def __init__(self):
super(BasePopup, self).__init__(names.statusDesktop_mainWindow_overlay)
super(BasePopup, self).__init__(names.basePopup)
@allure.step('Close')
def close(self):

View File

@ -1,3 +1,5 @@
import time
import allure
import configs
@ -30,6 +32,7 @@ class CategoryPopup(BasePopup):
@allure.step('Click checkbox in edit category popup')
def click_checkbox_by_index(self, index: int):
time.sleep(1)
checkboxes = driver.findAllObjects(self._channel_item_checkbox.real_name)
if len(checkboxes) > 0:
for _index, item in enumerate(checkboxes):
@ -52,6 +55,7 @@ class NewCategoryPopup(CategoryPopup):
if checkbox_state:
self._channel_item_checkbox.click()
self._create_button.click()
self.wait_until_hidden()
class EditCategoryPopup(CategoryPopup):

View File

@ -238,4 +238,5 @@ class CreateCommunityPopup(BasePopup):
self.set_intro(intro)
self.set_outro(outro)
self._create_community_button.click()
self.wait_until_hidden()
return CommunityScreen().wait_until_appears()

View File

@ -54,7 +54,6 @@ class InviteContactsPopup(BasePopup):
f'Contact: {contact} not found in {self.invited_contacts}'
self._send_button.click()
self.wait_until_hidden()
@allure.step('Copy community link')
def copy_community_link(self):

View File

@ -9,7 +9,7 @@ from gui.objects_map import names
class EditGroupNameAndImagePopup(BasePopup):
def __init__(self):
super(EditGroupNameAndImagePopup, self).__init__()
super().__init__()
self._group_name_field = TextEdit(names.groupChatEdit_name_TextEdit)
self._save_changes_button = Button(names.save_changes_StatusButton)
@ -20,3 +20,4 @@ class EditGroupNameAndImagePopup(BasePopup):
@allure.step('Save changes')
def save_changes(self):
self._save_changes_button.click()
self.wait_until_hidden()

View File

@ -14,4 +14,5 @@ class LeaveGroupPopup(BasePopup):
@allure.step("Confirm leaving group")
def confirm_leaving(self):
self._leave_button.click()
self.wait_until_hidden()

View File

@ -10,7 +10,7 @@ from gui.objects_map import names
class BeforeStartedPopUp(BasePopup):
def __init__(self):
super(BeforeStartedPopUp, self).__init__()
super().__init__()
self._acknowledge_checkbox = CheckBox(names.acknowledge_checkbox)
self._terms_of_use_checkBox = CheckBox(names.termsOfUseCheckBox_StatusCheckBox)
self._acknowledgeIndicator = QObject(names.acknowledgeIndicator)

View File

@ -10,10 +10,10 @@ from gui.objects_map import names
class BetaConsentPopup(QObject):
def __init__(self):
super().__init__(names.betaConsent_StatusModal)
self._agree_to_use_checkbox = CheckBox(names.agreeToUse_StatusCheckBox)
self._ready_to_use_checkbox = CheckBox(names.readyToUse_StatusCheckBox)
self._ready_to_use_button = Button(names.i_m_ready_to_use_Status_Desktop_Beta_StatusButton)
super(BetaConsentPopup, self).__init__(names.betaConsent_StatusModal)
@allure.step('Confirm all')
def confirm(self):

View File

@ -8,11 +8,10 @@ from gui.objects_map import names
class ShareUsageDataPopup(BasePopup):
def __init__(self):
super().__init__()
self._not_now_button = Button(names.not_now_StatusButton )
self._share_usage_data_button = Button(names.share_usage_data_StatusButton)
super(ShareUsageDataPopup, self).__init__()
@allure.step('Click not now button')
def skip(self):
self._not_now_button.click()
self.wait_until_hidden()

View File

@ -15,12 +15,12 @@ class RenameKeypairPopup(BasePopup):
def __init__(self):
super(RenameKeypairPopup, self).__init__()
self._rename_text_edit = TextEdit(names.edit_TextEdit)
self._save_changes_button = Button(names.save_changes_rename_StatusButton)
self.save_changes_button = Button(names.save_changes_rename_StatusButton)
self._name_input = QObject(names.nameInput_StatusInput)
@allure.step('Wait until appears {0}')
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
driver.waitForObjectExists(self._save_changes_button.real_name, timeout_msec)
driver.waitForObjectExists(self.save_changes_button.real_name, timeout_msec)
return self
@allure.step('Rename keypair')
@ -31,11 +31,6 @@ class RenameKeypairPopup(BasePopup):
text_edit.text = name
break
@allure.step('Save changes')
def save_changes(self):
self._save_changes_button.click()
self.wait_until_hidden()
@allure.step('Get error message')
def get_error_message(self) -> str:
return str(self._name_input.object.errorMessageCmp.text)

View File

@ -20,6 +20,7 @@ class SendContactRequest(BasePopup):
self._chat_key_text_edit.text = chat_key
self._message_text_edit.text = message
self._send_button.click()
self.wait_until_hidden()
class SendContactRequestFromProfile(BasePopup):

View File

@ -37,6 +37,7 @@ class SyncNewDevicePopup(BasePopup):
@allure.step('Click done')
def done(self):
self._done_button.click()
self.wait_until_hidden()
@allure.step('Click close')
def close(self):

View File

@ -15,7 +15,7 @@ from gui.objects_map import names
class AddSavedAddressPopup(BasePopup):
def __init__(self):
super(AddSavedAddressPopup, self).__init__()
super().__init__()
self._name_text_edit = TextEdit(names.mainWallet_Saved_Addreses_Popup_Name_Input)
self._save_add_address_button = Button(names.mainWallet_Saved_Addreses_Popup_Address_Add_Button)
self._add_networks_selector = QObject(names.mainWallet_Saved_Addreses_Popup_Add_Network_Selector_Tag)
@ -90,6 +90,7 @@ class AddressPopup(AddSavedAddressPopup):
self.verify_otimism_mainnet_network_tag_present()
self.verify_arbitrum_mainnet_network_tag_present(),
self._save_add_address_button.click()
self.wait_until_hidden()
class EditSavedAddressPopup(AddSavedAddressPopup):

View File

@ -8,32 +8,9 @@ from gui.objects_map import names
class TestnetModePopup(BasePopup):
def __init__(self):
super(TestnetModePopup, self).__init__()
self._cancel_button = Button(names.testnet_mode_cancelButton)
self._close_cross_button = Button(names.closeCrossPopupButton)
self._turn_on_button = Button(names.turn_on_testnet_mode_StatusButton)
self._turn_off_button = Button(names.turn_off_testnet_mode_StatusButton)
self.cancel_button = Button(names.testnet_mode_cancelButton)
self.close_cross_button = Button(names.closeCrossPopupButton)
self.turn_on_button = Button(names.turn_on_testnet_mode_StatusButton)
self.turn_off_button = Button(names.turn_off_testnet_mode_StatusButton)
@allure.step('Close testnet mode modal with cross button')
def close_testnet_modal_with_cross_button(self, attempts: int = 2):
try:
self._close_cross_button.click()
except Exception as ec:
if attempts:
self.close_testnet_modal_with_cross_button(attempts - 1)
else:
raise ec
@allure.step('Confirm turning on in the testnet modal')
def turn_on_testnet_mode_in_testnet_modal(self):
self._turn_on_button.click()
self.wait_until_hidden()
@allure.step('Confirm turning off in the testnet modal')
def turn_off_testnet_mode_in_testnet_modal(self):
self._turn_off_button.click()
self.wait_until_hidden()
@allure.step('Cancel switching testnet mode in the testnet modal')
def click_cancel_button_in_testnet_modal(self):
self._cancel_button.click()
self.wait_until_hidden()

View File

@ -323,7 +323,7 @@ class AddNewAccountPopup(BasePopup):
class GeneratedAddressesList(QObject):
def __init__(self):
super(GeneratedAddressesList, self).__init__(names.statusDesktop_mainWindow_overlay_popup2)
super().__init__(names.basePopup)
self._address_list_item = QObject(names.addAccountPopup_GeneratedAddress)
self._paginator_page = QObject(names.page_StatusBaseButton)

View File

@ -5,10 +5,10 @@ import typing
import allure
import configs
import constants
import driver
from constants import UserAccount, RandomUser
from gui.components.community.invite_contacts import InviteContactsPopup
from gui.components.onboarding.share_usage_data_popup import ShareUsageDataPopup
from gui.components.context_menu import ContextMenu
from gui.components.onboarding.before_started_popup import BeforeStartedPopUp
from gui.components.onboarding.beta_consent_popup import BetaConsentPopup
@ -195,10 +195,13 @@ class MainWindow(Window):
@allure.step('Log in user')
def log_in(self, user_account: UserAccount):
share_updates_popup = ShareUsageDataPopup()
LoginView().log_in(user_account)
SplashScreen().wait_until_appears().wait_until_hidden()
if not configs.system.TEST_MODE and not configs._local.DEV_BUILD:
BetaConsentPopup().confirm()
if share_updates_popup.is_visible:
share_updates_popup.skip()
return self
@allure.step('Authorize user')

View File

@ -6,6 +6,7 @@ statusDesktop_mainWindow = {"name": "mainWindow", "type": "StatusWindow"}
mainWindow_StatusWindow = {"name": "mainWindow", "type": "StatusWindow", "visible": True}
statusDesktop_mainWindow_overlay = {"container": statusDesktop_mainWindow, "type": "Overlay", "unnamed": 1, "visible": True}
statusDesktop_mainWindow_overlay_popup2 = {"container": statusDesktop_mainWindow_overlay, "occurrence": 2, "type": "PopupItem", "unnamed": 1, "visible": True}
basePopup = {"container": statusDesktop_mainWindow_overlay, "type": "PopupItem", "unnamed": 1, "visible": True}
scrollView_StatusScrollView = {"container": statusDesktop_mainWindow_overlay, "id": "scrollView", "type": "StatusScrollView", "unnamed": 1, "visible": True}
splashScreen = {"container": statusDesktop_mainWindow, "objectName": "splashScreen", "type": "DidYouKnowSplashScreen"}
mainWindow_LoadingAnimation = {"container": statusDesktop_mainWindow, "objectName": "loadingAnimation", "type": "LoadingAnimation", "visible": True}

View File

@ -33,7 +33,7 @@ settings_StatusFlatButton = {"type": "StatusFlatButton", "unnamed": 1, "visible"
# Messaging View
mainWindow_MessagingView = {"container": statusDesktop_mainWindow, "type": "MessagingView", "unnamed": 1, "visible": True}
contactsListItem_btn_StatusContactRequestsIndicatorListItem = {"container": mainWindow_MessagingView, "objectName": "MessagingView_ContactsListItem_btn", "type": "StatusContactRequestsIndicatorListItem", "visible": True}
contactsListItem_btn_StatusContactRequestsIndicatorListItem = {"container": statusDesktop_mainWindow, "objectName": "MessagingView_ContactsListItem_btn", "type": "StatusContactRequestsIndicatorListItem"}
settingsContentBase_ScrollView = {"container": statusDesktop_mainWindow, "objectName": "settingsContentBaseScrollView", "type": "StatusScrollView", "visible": True}
always_ask_radioButton_StatusRadioButton = {"container": settingsContentBase_ScrollView, "objectName": "MessagingView_AlwaysAsk_RadioButton", "type": "SettingsRadioButton", "visible": True}
always_show_radioButton_StatusRadioButton = {"container": settingsContentBase_ScrollView, "objectName": "MessagingView_AlwaysShow_RadioButton", "type": "SettingsRadioButton", "visible": True}

View File

@ -82,8 +82,8 @@ class CommunityScreen(QObject):
@allure.step('Edit category')
def edit_category(self):
self.left_panel.open_more_options()
self.left_panel.open_edit_category_popup()
return EditCategoryPopup()
self.left_panel.edit_category_item.click()
return EditCategoryPopup().wait_until_appears()
@allure.step('Verify category in the list')
def verify_category(self, category_name: str):
@ -214,7 +214,7 @@ class LeftPanel(QObject):
self._category_list_item = QObject(communities_names.categoryItem_StatusChatListCategoryItem)
self._create_category_button = Button(communities_names.add_categories_StatusFlatButton)
self._delete_category_item = QObject(communities_names.delete_Category_StatusMenuItem)
self._edit_category_item = QObject(communities_names.edit_Category_StatusMenuItem)
self.edit_category_item = QObject(communities_names.edit_Category_StatusMenuItem)
self._add_channel_inside_category_item = QObject(
communities_names.scrollView_addButton_StatusChatListCategoryItemButton)
self._more_button = Button(communities_names.scrollView_menuButton_StatusChatListCategoryItemButton)
@ -360,7 +360,7 @@ class LeftPanel(QObject):
@allure.step('Get visibility state of edit item')
def is_edit_item_visible(self) -> bool:
return self._edit_category_item.is_visible
return self.edit_category_item.is_visible
@allure.step('Open delete category popup')
def open_delete_category_popup(self) -> DeleteCategoryPopup:
@ -369,7 +369,7 @@ class LeftPanel(QObject):
@allure.step('Open edit category popup')
def open_edit_category_popup(self) -> EditCategoryPopup:
self._edit_category_item.click()
self.edit_category_item.click()
return CategoryPopup().wait_until_appears()
@allure.step('Open new channel popup inside category')

View File

@ -30,30 +30,22 @@ class ProfileSettingsView(QObject):
@allure.step('Get display name')
def get_display_name(self) -> str:
self._identity_tab_button.click()
if BuildShowcasePopup().is_visible:
BuildShowcasePopup().close()
return self._display_name_text_field.text
@allure.step('Set user name')
def set_name(self, value: str):
self._identity_tab_button.click()
if BuildShowcasePopup().is_visible:
BuildShowcasePopup().close()
self._display_name_text_field.text = value
@property
@allure.step('Get bio')
def get_bio(self) -> str:
self._identity_tab_button.click()
if BuildShowcasePopup().is_visible:
BuildShowcasePopup().close()
return self._bio_text_field.text
@allure.step('Set bio')
def set_bio(self, value: str):
self._identity_tab_button.click()
if BuildShowcasePopup().is_visible:
BuildShowcasePopup().close()
self._bio_text_field.text = value
@property

View File

@ -3,4 +3,4 @@ from allure_commons._allure import step
with step('Set testnet mode'):
def enable_testnet_mode(main_window):
wallet_settings = main_window.left_panel.open_settings().left_panel.open_wallet_settings()
wallet_settings.open_networks().switch_testnet_mode_toggle().turn_on_testnet_mode_in_testnet_modal()
wallet_settings.open_networks().switch_testnet_mode_toggle().turn_on_button.click()

View File

@ -40,6 +40,7 @@ def test_add_generated_account_restart_add_again(
account_popup = wallet.left_panel.open_add_account_popup()
account_popup.set_name(name).set_emoji(emoji).set_color(color).save_changes()
authenticate_with_password(user_account)
account_popup.wait_until_hidden()
with step('Verify toast message notification when adding account'):
assert len(main_screen.wait_for_notification()) == 1, \
@ -66,6 +67,7 @@ def test_add_generated_account_restart_add_again(
account_popup = wallet.left_panel.open_add_account_popup()
account_popup.set_name(name2).set_emoji(emoji2).set_color(color2).save_changes()
authenticate_with_password(user_account)
account_popup.wait_until_hidden()
with step('Verify toast message notification when adding account'):
assert len(main_screen.wait_for_notification()) == 1, \

View File

@ -38,6 +38,7 @@ def test_delete_generated_account_from_wallet_settings(
with step('Add a new generated account from wallet settings screen'):
add_account_popup.set_name(account_name).set_emoji(emoji).set_color(color).save_changes()
authenticate_with_password(user_account)
add_account_popup.wait_until_hidden()
with step('Open account details view for the generated account'):
account_index = 1

View File

@ -37,6 +37,7 @@ def test_add_edit_delete_generated_account(main_screen: MainWindow, user_account
account_popup = wallet.left_panel.open_add_account_popup()
account_popup.set_name(name).set_emoji(emoji).set_color(color).save_changes()
authenticate_with_password(user_account)
account_popup.wait_until_hidden()
with step('Verify toast message notification when adding account'):
assert len(main_screen.wait_for_notification()) == 1, \

View File

@ -68,7 +68,7 @@ def test_group_chat_add_contact_in_ac(multiple_instances, community_name, domain
request = activity_center.find_contact_request_in_list(user_one.name, timeout)
activity_center.click_activity_center_button(
'Contact requests').accept_contact_request(request)
activity_center.click()
main_window.left_panel.click()
main_window.hide()
with step(f'User {user_three.name}, get chat key'):
@ -93,7 +93,7 @@ def test_group_chat_add_contact_in_ac(multiple_instances, community_name, domain
request = activity_center.find_contact_request_in_list(user_one.name, timeout)
activity_center.click_activity_center_button(
'Contact requests').accept_contact_request(request)
activity_center.click()
main_window.left_panel.click()
main_window.hide()
with step(f'User {user_one.name}, start chat and add {members}'):

View File

@ -33,8 +33,8 @@ pytestmark = marks
@pytest.mark.parametrize('user_image, zoom, shift', [
pytest.param(
random.choice(['sample_JPEG_1920×1280.jpeg', 'file_example_PNG_3MB.png', 'file_example_JPG_2500kB.jpg']
),
random.choice(range(1, 11, )),
),
random.choice(range(1, 10)),
shift_image(0, 1000, 1000, 0))
])
def test_generate_account_back_up_seed_sign_out(aut, main_window, user_account,

View File

@ -59,7 +59,7 @@ def test_block_and_unblock_user_from_settings_and_profile(multiple_instances):
request = activity_center.find_contact_request_in_list(user_one.name, timeout)
activity_center.click_activity_center_button(
'Contact requests').accept_contact_request(request)
activity_center.click()
main_screen.left_panel.click()
main_screen.hide()
with step(f'User {user_three.name}, get chat key'):
@ -85,7 +85,7 @@ def test_block_and_unblock_user_from_settings_and_profile(multiple_instances):
request = activity_center.find_contact_request_in_list(user_two.name, timeout)
activity_center.click_activity_center_button(
'Contact requests').accept_contact_request(request)
activity_center.click()
main_screen.left_panel.click()
main_screen.hide()
with step(

View File

@ -49,7 +49,6 @@ def test_rename_keypair_test(main_screen: MainWindow, user_account, emoji: str,
new_account_popup.enter_private_key_name(pk_name).click_continue()
account_popup.save_changes()
authenticate_with_password(user_account)
account_popup.wait_until_hidden()
with step('Open wallet settings and verify Status keypair title'):
settings = main_screen.left_panel.open_settings().left_panel.open_wallet_settings()
@ -68,7 +67,8 @@ def test_rename_keypair_test(main_screen: MainWindow, user_account, emoji: str,
settings.click_open_menu_button(pk_name)
rename_keypair_popup = settings.click_rename_keypair()
rename_keypair_popup.rename_keypair(pk_new_name)
rename_keypair_popup.save_changes()
rename_keypair_popup.save_changes_button.click()
rename_keypair_popup.wait_until_hidden()
assert pk_new_name in settings.get_keypairs_names()
with step('Verify toast message with successful renaming appears'):

View File

@ -10,6 +10,8 @@ from gui.components.toast_message import ToastMessage
from gui.main_window import MainWindow
pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703505', 'Network: Testnet switching')
@pytest.mark.case(703505)
def test_switch_testnet_mode(main_screen: MainWindow):
@ -27,7 +29,7 @@ def test_switch_testnet_mode(main_screen: MainWindow):
assert not networks.is_testnet_mode_toggle_checked(), f"Testnet toggle is on when it should not"
with step('Turn on Testnet mode'):
networks.switch_testnet_mode_toggle().turn_on_testnet_mode_in_testnet_modal()
networks.switch_testnet_mode_toggle().turn_on_button.click()
with step('Verify that Testnet mode turned on'):
assert len(main_screen.wait_for_notification()) == 1, \
@ -49,7 +51,7 @@ def test_switch_testnet_mode(main_screen: MainWindow):
# TODO: add verificatin for test net label
with step('Turn off Testnet mode in wallet settings'):
networks.switch_testnet_mode_toggle().turn_off_testnet_mode_in_testnet_modal()
networks.switch_testnet_mode_toggle().turn_off_button.click()
with step('Verify that Testnet mode turned off'):
assert len(main_screen.wait_for_notification()) == 2
@ -78,7 +80,7 @@ def test_toggle_testnet_toggle_on_and_close_the_confirmation(main_screen: MainWi
testnet_modal = networks.switch_testnet_mode_toggle()
with step('Click cross button on the Testnet modal'):
testnet_modal.close_testnet_modal_with_cross_button()
testnet_modal.close_cross_button.click()
assert not networks.is_testnet_mode_toggle_checked()
with step('Verify that Testnet mode is not turned off'):
@ -102,7 +104,7 @@ def test_switch_testnet_off_by_toggle_and_cancel_in_confirmation(main_screen: Ma
testnet_modal = networks.switch_testnet_mode_toggle()
with step('Confirm enabling testnet mode in testnet modal'):
testnet_modal.turn_on_testnet_mode_in_testnet_modal()
testnet_modal.turn_on_button.click()
with step('Verify testnet mode is enabled'):
assert len(main_screen.wait_for_notification()) == 1, \
@ -119,7 +121,7 @@ def test_switch_testnet_off_by_toggle_and_cancel_in_confirmation(main_screen: Ma
testnet_modal = networks.switch_testnet_mode_toggle()
with step('Click Cancel button on the Testnet modal'):
testnet_modal.click_cancel_button_in_testnet_modal()
testnet_modal.cancel_button.click()
assert networks.is_testnet_mode_toggle_checked(), f"Testnet toggle is turned OFF when it should not"
with step('Verify that Testnet mode is not turned off'):

View File

@ -36,7 +36,7 @@ pytestmark = marks
def test_wallet_sort_assets(main_screen: MainWindow, address, name, dai, wrappedeth, stt, eth):
with step('Turn on Testnet mode'):
networks = main_screen.left_panel.open_settings().left_panel.open_wallet_settings().open_networks()
networks.switch_testnet_mode_toggle().turn_on_testnet_mode_in_testnet_modal()
networks.switch_testnet_mode_toggle().turn_on_button.click()
with step('Add watched address with plus action button'):
wallet = main_screen.left_panel.open_wallet()
@ -155,7 +155,7 @@ def test_wallet_sort_assets(main_screen: MainWindow, address, name, dai, wrapped
def test_custom_ordering(main_screen: MainWindow, address, name, dai, wrappedeth, stt, eth):
with step('Turn on Testnet mode'):
networks = main_screen.left_panel.open_settings().left_panel.open_wallet_settings().open_networks()
networks.switch_testnet_mode_toggle().turn_on_testnet_mode_in_testnet_modal()
networks.switch_testnet_mode_toggle().turn_on_button.click()
with step('Add watched address with plus action button'):
wallet = main_screen.left_panel.open_wallet()