Skip to content
This repository was archived by the owner on Aug 13, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions constants/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from enum import Enum

class PasswordView(Enum):
RESTART_STATUS = 'Restart status'


39 changes: 15 additions & 24 deletions gui/components/change_password_popup.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,34 @@
import allure

import configs
import driver
from constants.settings import PasswordView
from gui.components.base_popup import BasePopup
from gui.elements.button import Button
from gui.elements.text_edit import TextEdit
from gui.elements.text_label import TextLabel


class ChangePasswordPopup(BasePopup):

def __init__(self):
super(ChangePasswordPopup, self).__init__()
self._current_password_text_field = TextEdit('change_password_menu_current_password')
self._new_password_text_field = TextEdit('change_password_menu_new_password')
self._confirm_password_text_field = TextEdit('change_password_menu_new_password_confirm')
self._submit_button = Button('change_password_menu_submit_button')
self._quit_button = Button('change_password_success_menu_sign_out_quit_button')

@allure.step('Fill in the form, submit and sign out')
def change_password(self, old_pwd: str, new_pwd: str):
self._current_password_text_field.text = old_pwd
self._new_password_text_field.text = new_pwd
self._confirm_password_text_field.text = new_pwd
self._submit_button.click()
self.click_sign_out_and_quit_button()
self._re_encrypt_data_restart_button = Button('reEncryptRestartButton')
self._re_encryption_complete_element = TextLabel('reEncryptionComplete')

@allure.step('Wait for Sign out and quit button and click it')
def click_sign_out_and_quit_button(self):
def click_re_encrypt_data_restart_button(self):
"""
Timeout is set as rough estimation of 15 seconds. What is happening when changing password is
the process of re-hashing DB initiated. Taking into account the user is new , so DB is relatively small
I assume, 15 seconds should be enough to finish re-hashing and show the Sign-out and quit button
This time is not really predictable, especially for huge DBs. We might implement other solution, but since
this is_visible method is barely working, I suggest this solution for now
I assume, 15 seconds should be enough to finish re-hashing and show the Restart button
This time is not really predictable, especially for huge DBs.
"""
try:
assert driver.waitForObjectExists(self._quit_button.real_name, 15000), \
f'Sign out and quit button is not present within 15 seconds'
self._quit_button.click()
except (Exception, AssertionError) as ex:
raise ex
self._re_encrypt_data_restart_button.click()
assert driver.waitForObject(self._re_encryption_complete_element.real_name, 15000), \
f'Re-encryption confirmation is not present within 15 seconds'
assert driver.waitForObject(self._re_encrypt_data_restart_button.real_name, 17000)
assert getattr(self._re_encrypt_data_restart_button.object, 'text') == PasswordView.RESTART_STATUS.value
self._re_encrypt_data_restart_button.click()



15 changes: 9 additions & 6 deletions gui/objects_map/component_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,15 @@
ephemeral_Notification_List = {"container": statusDesktop_mainWindow, "objectName": "ephemeralNotificationList", "type": "StatusListView"}
ephemeralNotificationList_StatusToastMessage = {"container": ephemeral_Notification_List, "objectName": "statusToastMessage", "type": "StatusToastMessage"}

# Change password popup
change_password_menu_current_password = {"container": statusDesktop_mainWindow_overlay, "objectName": "passwordViewCurrentPassword", "type": "StatusPasswordInput", "visible": True}
change_password_menu_new_password = {"container": statusDesktop_mainWindow_overlay, "objectName": "passwordViewNewPassword", "type": "StatusPasswordInput", "visible": True}
change_password_menu_new_password_confirm = {"container": statusDesktop_mainWindow_overlay, "objectName": "passwordViewNewPasswordConfirm", "type": "StatusPasswordInput", "visible": True}
change_password_menu_submit_button = {"container": statusDesktop_mainWindow_overlay, "objectName": "changePasswordModalSubmitButton", "type": "StatusButton", "visible": True}
change_password_success_menu_sign_out_quit_button = {"container": statusDesktop_mainWindow_overlay, "objectName": "changePasswordSuccessModalSignOutAndQuitButton", "type": "StatusButton", "visible": True}
# Change password view

settingsContentBase_ScrollView = {"container": statusDesktop_mainWindow, "objectName": "settingsContentBaseScrollView", "type": "StatusScrollView", "visible": True}
change_password_menu_current_password = {"container": settingsContentBase_ScrollView, "objectName": "passwordViewCurrentPassword", "type": "StatusPasswordInput", "visible": True}
change_password_menu_new_password = {"container": settingsContentBase_ScrollView, "objectName": "passwordViewNewPassword", "type": "StatusPasswordInput", "visible": True}
change_password_menu_new_password_confirm = {"container": settingsContentBase_ScrollView, "objectName": "passwordViewNewPasswordConfirm", "type": "StatusPasswordInput", "visible": True}
change_password_menu_change_password_button = {"container": settingsContentBase_ScrollView, "objectName": "changePasswordModalSubmitButton", "type": "StatusButton", "visible": True}
reEncryptRestartButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "changePasswordModalSubmitButton", "type": "StatusButton", "visible": True}
reEncryptionComplete = {"container": statusDesktop_mainWindow_overlay, "objectName": "statusListItemSubTitle", "type": "StatusTextWithLoadingState", "visible": True}

# Social Links Popup
socialLink_StatusListItem = {"container": statusDesktop_mainWindow_overlay, "type": "StatusListItem", "title": "", "visible": True}
Expand Down
5 changes: 5 additions & 0 deletions gui/objects_map/settings_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
mainWindow_scrollView_StatusScrollView = {"container": mainWindow_LeftTabView, "id": "scrollView", "type": "StatusScrollView", "unnamed": 1, "visible": True}
scrollView_MenuItem_StatusNavigationListItem = {"container": mainWindow_scrollView_StatusScrollView, "type": "StatusNavigationListItem", "visible": True}
scrollView_Flickable = {"container": mainWindow_scrollView_StatusScrollView, "type": "Flickable", "unnamed": 1, "visible": True}
mainWindow_ScrollView = {"container": mainWindow_LeftTabView, "type": "StatusScrollView", "unnamed": 1, "visible": True}
settingsBackUpSeedPhraseOption = {"container": mainWindow_ScrollView, "objectName": "18-MainMenuItem", "type": "StatusNavigationListItem", "visible": True}

# Communities View
mainWindow_CommunitiesView = {"container": statusDesktop_mainWindow, "type": "CommunitiesView", "unnamed": 1, "visible": True}
Expand Down Expand Up @@ -129,6 +131,9 @@
profileTabBar_Web_StatusTabButton = {"checkable": True, "container": mainWindow_profileTabBar_StatusTabBar, "objectName": "webTabButton", "type": "StatusTabButton", "visible": True}
profileTabBar_Identity_StatusTabButton = {"checkable": True, "container": mainWindow_profileTabBar_StatusTabBar, "objectName": "identityTabButton", "type": "StatusTabButton", "visible": True}

# Password view
mainWindow_PasswordView = {"container": statusDesktop_mainWindow, "type": "ChangePasswordView", "unnamed": 1, "visible": True}

# Syncing Settings View
mainWindow_SyncingView = {"container": statusDesktop_mainWindow, "type": "SyncingView", "unnamed": 1, "visible": True}
settings_Setup_Syncing_StatusButton = {"container": statusDesktop_mainWindow, "objectName": "setupSyncingStatusButton", "type": "StatusButton", "visible": True}
Expand Down
26 changes: 16 additions & 10 deletions gui/screens/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from gui.screens.settings_profile import ProfileSettingsView
from gui.screens.settings_syncing import SyncingSettingsView
from gui.screens.settings_wallet import WalletSettingsView
from gui.screens.settings_password import ChangePasswordView
from gui.components.settings.sign_out_popup import SignOutPopup


Expand All @@ -21,6 +22,7 @@ def __init__(self):
super().__init__('mainWindow_LeftTabView')
self._settings_section_template = QObject('scrollView_MenuItem_StatusNavigationListItem')
self._scroll = Scroll('scrollView_Flickable')
self._settings_section_back_up_seed_option = QObject('settingsBackUpSeedPhraseOption')

def _open_settings(self, object_name: str):
self._settings_section_template.real_name['objectName'] = object_name
Expand All @@ -30,17 +32,16 @@ def _open_settings(self, object_name: str):

@allure.step('Check back up seed option menu item presence')
def check_back_up_seed_option_present(self):
self._settings_section_template.real_name['objectName'] = '17-MainMenuItem'
return self._settings_section_template.is_visible
return self._settings_section_back_up_seed_option.exists

@allure.step('Open messaging settings')
def open_messaging_settings(self) -> 'MessagingSettingsView':
self._open_settings('3-AppMenuItem')
self._open_settings('4-AppMenuItem')
return MessagingSettingsView()

@allure.step('Open communities settings')
def open_communities_settings(self, attempts: int = 2) -> 'CommunitiesSettingsView':
self._open_settings('12-AppMenuItem')
self._open_settings('13-AppMenuItem')
try:
return CommunitiesSettingsView()
except Exception as ex:
Expand All @@ -51,7 +52,7 @@ def open_communities_settings(self, attempts: int = 2) -> 'CommunitiesSettingsVi

@allure.step('Open wallet settings')
def open_wallet_settings(self, attempts: int = 2) -> WalletSettingsView:
self._open_settings('4-AppMenuItem')
self._open_settings('5-AppMenuItem')
time.sleep(0.5)
try:
return WalletSettingsView()
Expand All @@ -66,14 +67,19 @@ def open_profile_settings(self) -> ProfileSettingsView:
self._open_settings('0-MainMenuItem')
return ProfileSettingsView()

@allure.step('Open password settings')
def open_password_settings(self) -> ChangePasswordView:
self._open_settings('1-MainMenuItem')
return ChangePasswordView()

@allure.step('Choose back up seed phrase in settings')
def open_back_up_seed_phrase(self) -> BackUpYourSeedPhrasePopUp:
self._open_settings('17-MainMenuItem')
self._open_settings('18-MainMenuItem')
return BackUpYourSeedPhrasePopUp()

@allure.step('Open syncing settings')
def open_syncing_settings(self, attempts: int = 2) -> SyncingSettingsView:
self._open_settings('8-MainMenuItem')
self._open_settings('9-MainMenuItem')
try:
return SyncingSettingsView().wait_until_appears()
except (AssertionError, LookupError) as ec:
Expand All @@ -84,18 +90,18 @@ def open_syncing_settings(self, attempts: int = 2) -> SyncingSettingsView:

@allure.step('Choose sign out and quit in settings')
def open_sign_out_and_quit(self):
self._open_settings('16-ExtraMenuItem')
self._open_settings('17-ExtraMenuItem')
return SignOutPopup()

@allure.step('Open keycard settings')
def open_keycard_settings(self) -> KeycardSettingsView:
self._open_settings('13-MainMenuItem')
self._open_settings('14-MainMenuItem')
return KeycardSettingsView()

@allure.step('Open ENS usernames settings')
def open_ens_usernames_settings(self) -> ENSSettingsView:
time.sleep(1)
self._open_settings('2-MainMenuItem')
self._open_settings('3-MainMenuItem')
return ENSSettingsView()


Expand Down
32 changes: 32 additions & 0 deletions gui/screens/settings_password.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import allure

import configs.timeouts
import driver
from driver.objects_access import walk_children
from gui.components.change_password_popup import ChangePasswordPopup
from gui.components.social_links_popup import SocialLinksPopup
from gui.elements.button import Button
from gui.elements.object import QObject
from gui.elements.scroll import Scroll
from gui.elements.text_edit import TextEdit
from gui.elements.text_label import TextLabel


class ChangePasswordView(QObject):

def __init__(self):
super().__init__('mainWindow_PasswordView')
self._scroll_view = Scroll('settingsContentBaseScrollView_Flickable')
self._change_password_button = Button('change_password_menu_change_password_button')
self._current_password_text_field = TextEdit('change_password_menu_current_password')
self._new_password_text_field = TextEdit('change_password_menu_new_password')
self._confirm_password_text_field = TextEdit('change_password_menu_new_password_confirm')

@allure.step('Fill in the form, submit and sign out')
def change_password(self, old_pwd: str, new_pwd: str):
self._current_password_text_field.text = old_pwd
self._new_password_text_field.text = new_pwd
self._confirm_password_text_field.text = new_pwd
self._change_password_button.click()
return ChangePasswordPopup()

5 changes: 0 additions & 5 deletions gui/screens/settings_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def __init__(self):
self._scroll_view = Scroll('settingsContentBaseScrollView_Flickable')
self._display_name_text_field = TextEdit('displayName_TextEdit')
self._save_button = Button('settingsSave_StatusButton')
self._change_password_button = Button('change_password_button')
self._bio_text_field = TextEdit('bio_TextEdit')
self._add_more_links_label = TextLabel('addMoreSocialLinks')
self._links_list = QObject('linksView')
Expand Down Expand Up @@ -113,7 +112,3 @@ def open_social_links_popup(self):
def save_changes(self):
self._save_button.click()

@allure.step('Open change password form')
def open_change_password_popup(self):
self._change_password_button.click()
return ChangePasswordPopup().wait_until_appears()
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
import psutil
import pytest
from allure_commons._allure import step
from . import marks

from gui.components.change_password_popup import ChangePasswordPopup
from tests.settings.settings_profile import marks

import constants
from driver.aut import AUT
Expand All @@ -12,24 +14,26 @@


@pytest.mark.timeout(timeout=180)
# @pytest.mark.critical
@pytest.mark.critical
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703005',
'Change the password and login with new password')
@pytest.mark.case(703005)
@pytest.mark.parametrize('user_account, user_account_changed_password',
[pytest.param(constants.user.user_account_one,
constants.user.user_account_one_changed_password)])
@pytest.mark.xfail(reason='https://github.com/status-im/status-desktop/issues/13013')
#@pytest.mark.xfail(reason='https://github.com/status-im/status-desktop/issues/13013')
def test_change_password_and_login(aut: AUT, main_screen: MainWindow, user_account, user_account_changed_password):
with step('Open profile settings'):
settings_scr = main_screen.left_panel.open_settings().left_panel.open_profile_settings()
settings_scr = main_screen.left_panel.open_settings()

with step('Open change password popup'):
change_psw_pop_up = settings_scr.open_change_password_popup()
with step('Open change password view'):
password_view = settings_scr.left_panel.open_password_settings()

with step('Fill in the change password form and submit'):
change_psw_pop_up.change_password(
user_account.password, user_account_changed_password.password)
password_view.change_password(user_account.password, user_account_changed_password.password)

with step('Re-encrypt'):
ChangePasswordPopup().click_re_encrypt_data_restart_button()

with step('Verify the application process is not running'):
psutil.Process(aut.pid).wait(timeout=10)
Expand Down