chore: add asserts for change password test

This commit is contained in:
Anastasiya Semenkevich 2023-12-15 17:48:20 +03:00 committed by Anastasiya
parent caef79d2ee
commit 0edf28f14d
3 changed files with 36 additions and 8 deletions

View File

@ -1,5 +1,6 @@
import allure
import driver
from gui.components.base_popup import BasePopup
from gui.elements.button import Button
from gui.elements.text_edit import TextEdit
@ -15,10 +16,26 @@ class ChangePasswordPopup(BasePopup):
self._submit_button = Button('change_password_menu_submit_button')
self._quit_button = Button('change_password_success_menu_sign_out_quit_button')
@allure.step('Change password and confirm action')
@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._quit_button.wait_until_appears(15000).click()
self.click_sign_out_and_quit_button()
@allure.step('Wait for Sign out and quit button and click it')
def click_sign_out_and_quit_button(self):
"""
Timeout is set as rough estimation of 15 seconds. What is happening when changing password is
the process of re-hasing 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 wait_until_appears method is barely working, I suggest this solution for now
"""
try:
assert driver.waitFor(lambda: self._quit_button.is_visible, 15000), \
f'Sign out and quit button is not visible within 15 seconds'
self._quit_button.click()
except Exception as ex:
raise ex

View File

@ -573,7 +573,6 @@ class LoginView(QObject):
self._password_text_edit.text = account.password
self._arrow_right_button.click()
self.wait_until_hidden()
@allure.step('Select user')
def select_user_name(self, user_name, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):

View File

@ -1,4 +1,5 @@
import allure
import psutil
import pytest
from allure_commons._allure import step
from . import marks
@ -9,6 +10,7 @@ from gui.main_window import MainWindow
pytestmark = marks
@pytest.mark.critical
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703005',
'Change the password and login with new password')
@ -16,17 +18,27 @@ pytestmark = marks
@pytest.mark.parametrize('user_account, user_account_changed_password',
[pytest.param(constants.user.user_account_one,
constants.user.user_account_one_changed_password)])
def test_change_password_and_login(aut: AUT, main_screen: MainWindow, user_account, user_account_changed_password):
with step('Open profile settings and change password'):
main_screen.left_panel.open_settings().left_panel.open_profile_settings().open_change_password_popup().change_password(
with step('Open profile settings'):
settings_scr = main_screen.left_panel.open_settings().left_panel.open_profile_settings()
with step('Open change password popup'):
change_psw_pop_up = settings_scr.open_change_password_popup()
with step('Fill in the change password form and submit'):
change_psw_pop_up.change_password(
user_account.password, user_account_changed_password.password)
with step('Verify the application process is not running'):
psutil.Process(aut.pid).wait(timeout=10)
with step('Restart application'):
aut.restart()
with step('Login with new password'):
main_screen.authorize_user(user_account_changed_password)
with step('Verify that the user logged in correctly'):
user_canvas = main_screen.left_panel.open_online_identifier()
profile_popup = user_canvas.open_profile_popup_from_online_identifier()
online_identifier = main_screen.left_panel.open_online_identifier()
profile_popup = online_identifier.open_profile_popup_from_online_identifier()
assert profile_popup.user_name == user_account.name