chore: change password test fixed

This commit is contained in:
Anastasiya Semenkevich 2024-02-10 13:02:47 +03:00 committed by Anastasiya
parent 6132398b06
commit 299a702e33
9 changed files with 83 additions and 43 deletions

View File

@ -0,0 +1,6 @@
from enum import Enum
class PasswordView(Enum):
RESTART_STATUS = 'Restart status'

View File

@ -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()

View File

@ -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}

View File

@ -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}

View File

@ -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')

View File

@ -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()

View File

@ -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()

View File

@ -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)