diff --git a/test/e2e/constants/settings.py b/test/e2e/constants/settings.py new file mode 100644 index 0000000000..dc2f7e27e6 --- /dev/null +++ b/test/e2e/constants/settings.py @@ -0,0 +1,6 @@ +from enum import Enum + +class PasswordView(Enum): + RESTART_STATUS = 'Restart status' + + diff --git a/test/e2e/gui/components/change_password_popup.py b/test/e2e/gui/components/change_password_popup.py index 34e98ae77c..76661fae2c 100644 --- a/test/e2e/gui/components/change_password_popup.py +++ b/test/e2e/gui/components/change_password_popup.py @@ -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() + diff --git a/test/e2e/gui/objects_map/component_names.py b/test/e2e/gui/objects_map/component_names.py index 7ad8f7f860..5ea62e696c 100644 --- a/test/e2e/gui/objects_map/component_names.py +++ b/test/e2e/gui/objects_map/component_names.py @@ -307,12 +307,15 @@ mainWindow_Turn_off_Button = {"checkable": False, "container": statusDesktop_mai 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} diff --git a/test/e2e/gui/objects_map/settings_names.py b/test/e2e/gui/objects_map/settings_names.py index eb12d0c844..6b8676cc66 100644 --- a/test/e2e/gui/objects_map/settings_names.py +++ b/test/e2e/gui/objects_map/settings_names.py @@ -131,6 +131,9 @@ mainWindow_profileTabBar_StatusTabBar = {"container": statusDesktop_mainWindow, 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} diff --git a/test/e2e/gui/screens/settings.py b/test/e2e/gui/screens/settings.py index 9c6ae80190..76137ecb59 100644 --- a/test/e2e/gui/screens/settings.py +++ b/test/e2e/gui/screens/settings.py @@ -12,6 +12,7 @@ from gui.screens.settings_messaging import MessagingSettingsView 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 @@ -66,6 +67,11 @@ class LeftPanel(QObject): 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('18-MainMenuItem') diff --git a/test/e2e/gui/screens/settings_password.py b/test/e2e/gui/screens/settings_password.py new file mode 100644 index 0000000000..b5909678dd --- /dev/null +++ b/test/e2e/gui/screens/settings_password.py @@ -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() + diff --git a/test/e2e/gui/screens/settings_profile.py b/test/e2e/gui/screens/settings_profile.py index 4279724b04..87b35ddc17 100644 --- a/test/e2e/gui/screens/settings_profile.py +++ b/test/e2e/gui/screens/settings_profile.py @@ -19,7 +19,6 @@ class ProfileSettingsView(QObject): 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') @@ -113,7 +112,3 @@ class ProfileSettingsView(QObject): 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() diff --git a/test/e2e/tests/settings/settings_password/__init__.py b/test/e2e/tests/settings/settings_password/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/e2e/tests/settings/settings_profile/test_settings_profile_change_password.py b/test/e2e/tests/settings/settings_password/test_settings_password_change_password.py similarity index 69% rename from test/e2e/tests/settings/settings_profile/test_settings_profile_change_password.py rename to test/e2e/tests/settings/settings_password/test_settings_password_change_password.py index 189885f427..39615217de 100644 --- a/test/e2e/tests/settings/settings_profile/test_settings_profile_change_password.py +++ b/test/e2e/tests/settings/settings_password/test_settings_password_change_password.py @@ -2,7 +2,9 @@ import allure 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 @@ -12,24 +14,26 @@ pytestmark = marks @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)