test(suite_settings/tst_mainSettingsSection): Fix test on backup seed phrase (#10204)

#8279
This commit is contained in:
Vladimir Druzhinin 2023-04-13 16:53:50 +02:00 committed by GitHub
parent 4716842a26
commit b77c0f13a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 29 additions and 7 deletions

View File

@ -172,6 +172,19 @@ def right_click_obj_by_name(objName: str):
def hover_obj(obj): def hover_obj(obj):
squish.mouseMove(obj) squish.mouseMove(obj)
def hover(objName: str, timeout_sec: int = 5):
def _hover(objName: str,):
obj = squish.waitForObject(getattr(names, objName), 1000)
try:
squish.mouseMove(obj)
return True
except RuntimeError as err:
# Object does not have a valid geometry
squish.snooze(1)
return False
assert squish.waitFor(lambda: _hover(objName), timeout_sec * 1000)
def move_mouse_over_object_by_name(objName: str): def move_mouse_over_object_by_name(objName: str):
obj = squish.waitForObject(getattr(names, objName)) obj = squish.waitForObject(getattr(names, objName))
move_mouse_over_object(obj) move_mouse_over_object(obj)

View File

@ -144,7 +144,6 @@ class SettingsScreen:
click_obj_by_name(AdvancedOptionScreen.ACTIVATE_OR_DEACTIVATE_COMMUNITY_PERMISSIONS.value) click_obj_by_name(AdvancedOptionScreen.ACTIVATE_OR_DEACTIVATE_COMMUNITY_PERMISSIONS.value)
click_obj_by_name(AdvancedOptionScreen.I_UNDERSTAND_POP_UP.value) click_obj_by_name(AdvancedOptionScreen.I_UNDERSTAND_POP_UP.value)
def open_wallet_settings(self): def open_wallet_settings(self):
click_obj_by_name(SidebarComponents.WALLET_OPTION.value) click_obj_by_name(SidebarComponents.WALLET_OPTION.value)
@ -387,7 +386,6 @@ class SettingsScreen:
click_obj_by_name(ProfileSettingsScreen.CLOSE_SOCIAL_LINKS_DIALOG.value) click_obj_by_name(ProfileSettingsScreen.CLOSE_SOCIAL_LINKS_DIALOG.value)
def check_backup_seed_phrase_workflow(self): def check_backup_seed_phrase_workflow(self):
self.open_wallet_settings()
click_obj_by_name(WalletSettingsScreen.BACKUP_SEED_PHRASE_BUTTON.value) click_obj_by_name(WalletSettingsScreen.BACKUP_SEED_PHRASE_BUTTON.value)
# Check all checkboxes and click next button # Check all checkboxes and click next button
@ -400,6 +398,7 @@ class SettingsScreen:
click_obj_by_name(BackupSeedPhrasePopup.NEXT_BUTTON.value) click_obj_by_name(BackupSeedPhrasePopup.NEXT_BUTTON.value)
# Show seed phrase # Show seed phrase
hover(BackupSeedPhrasePopup.REVEAL_SEED_PHRASE_BUTTON.value)
click_obj_by_name(BackupSeedPhrasePopup.REVEAL_SEED_PHRASE_BUTTON.value) click_obj_by_name(BackupSeedPhrasePopup.REVEAL_SEED_PHRASE_BUTTON.value)
# Collect word phrases for the next random confirmation steps # Collect word phrases for the next random confirmation steps

View File

@ -37,6 +37,7 @@ class MainScreenComponents(Enum):
TOOLBAR_BACK_BUTTON = "main_toolBar_back_button" TOOLBAR_BACK_BUTTON = "main_toolBar_back_button"
LEAVE_CHAT_MENUITEM = "leaveChatMenuItem" LEAVE_CHAT_MENUITEM = "leaveChatMenuItem"
CONTACTS_COLUMN_MESSAGES_HEADLINE = "mainWindow_ContactsColumn_Messages_Headline" CONTACTS_COLUMN_MESSAGES_HEADLINE = "mainWindow_ContactsColumn_Messages_Headline"
SECURE_YOUR_SEED_PHRASE_BANNER = "mainWindow_secureYourSeedPhraseBanner_ModuleWarning"
class ProfilePopup(Enum): class ProfilePopup(Enum):
USER_IMAGE = "ProfileHeader_userImage" USER_IMAGE = "ProfileHeader_userImage"
@ -193,3 +194,9 @@ class StatusMainScreen:
def close_popup(self): def close_popup(self):
# Click in the corner of the overlay to close the popup # Click in the corner of the overlay to close the popup
click_obj_by_name_at_coordinates(MainScreenComponents.POPUP_OVERLAY.value, 1, 1) click_obj_by_name_at_coordinates(MainScreenComponents.POPUP_OVERLAY.value, 1, 1)
def is_secure_your_seed_phrase_banner_visible(self, value: bool):
verify(is_found(MainScreenComponents.SECURE_YOUR_SEED_PHRASE_BANNER.value) is value,
f'Secure your seed phrase banner visible: {value}'
)

View File

@ -61,3 +61,6 @@ ProfileHeader_userImage = {"container": statusDesktop_mainWindow_overlay, "objec
ProfilePopup_displayName = {"container": statusDesktop_mainWindow_overlay, "objectName": "ProfileDialog_displayName", "type": "StatusBaseText", "visible": True} ProfilePopup_displayName = {"container": statusDesktop_mainWindow_overlay, "objectName": "ProfileDialog_displayName", "type": "StatusBaseText", "visible": True}
ProfilePopup_editButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "editProfileButton", "type": "StatusButton", "visible": True} ProfilePopup_editButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "editProfileButton", "type": "StatusButton", "visible": True}
ProfilePopup_SendContactRequestButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "profileDialog_sendContactRequestButton", "type": "StatusButton", "visible": True} ProfilePopup_SendContactRequestButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "profileDialog_sendContactRequestButton", "type": "StatusButton", "visible": True}
# Banners
mainWindow_secureYourSeedPhraseBanner_ModuleWarning = {"container": statusDesktop_mainWindow, "objectName": "secureYourSeedPhraseBanner", "type": "ModuleWarning", "visible": True}

View File

@ -0,0 +1,4 @@
@Then("the Secure Your Seed Phrase Banner is not displayed")
def step(context):
StatusMainScreen().is_secure_your_seed_phrase_banner_visible(False)

View File

@ -10,14 +10,10 @@ Feature: Status Desktop Main Settings Section
Background: Open settings section Background: Open settings section
Given the user opens app settings screen Given the user opens app settings screen
# TODO: It must be reformulated or extracted to a different feature file bc preconditions of this feature file also include closing the backup seed phrase indicator at first instance
# so the validation is not providing relevant information
# TODO: It is also unstable. Needs to be checked.
@mayfail
Scenario: The user can backup seed phrase Scenario: The user can backup seed phrase
Given the user opens the wallet settings
When the user backs up the wallet seed phrase When the user backs up the wallet seed phrase
Then the backup seed phrase indicator is not displayed Then the backup seed phrase indicator is not displayed
And the Secure Your Seed Phrase Banner is not displayed
@mayfail @mayfail
Scenario: The user can switch state to offline Scenario: The user can switch state to offline