Profile settings - display name, states, change password (#112)

This commit is contained in:
Valentina1133 2023-09-20 18:35:56 +07:00 committed by GitHub
parent 02cb848a1d
commit bd07b1d0dd
9 changed files with 197 additions and 7 deletions

View File

@ -11,6 +11,8 @@ user_account_two = UserAccount('athletic', '0000000000', [
])
user_account_three = UserAccount('nervous', '000000000', [])
user_account_one_changed = UserAccount('squisher', 'NewPassword@12345', [])
community_params = {
'name': 'Name',
'description': 'Description',

View File

@ -0,0 +1,24 @@
import allure
from gui.components.base_popup import BasePopup
from gui.elements.qt.button import Button
from gui.elements.qt.text_edit import TextEdit
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('Change password and confirm action')
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()

View File

@ -7,6 +7,7 @@ from gui.components.base_popup import BasePopup
from gui.elements.qt.button import Button
from gui.elements.qt.object import QObject
from gui.elements.qt.text_label import TextLabel
from gui.screens.settings import ProfileSettingsView
from scripts.tools.image import Image
@ -68,3 +69,8 @@ class ProfilePopup(BasePopup):
15, 15, self._profile_image.image.width - 30, self._profile_image.image.height - 30
)
return self.profile_image.has_text(text, constants.tesseract.text_on_profile_image, crop=crop)
@allure.step('Click edit profile button')
def edit_profile(self):
self._edit_profile_button.click()
return ProfileSettingsView()

View File

@ -61,14 +61,26 @@ class LeftPanel(QObject):
self._profile_button.click()
return UserCanvas().wait_until_appears()
@allure.step('Set user to online')
def set_user_to_online(self):
self.open_user_canvas().set_user_state_online()
@allure.step('Verify: User is online')
def user_is_online(self) -> bool:
return self.user_badge_color == '#4ebc60'
@allure.step('Set user to offline')
def set_user_to_offline(self):
self.open_user_canvas().set_user_state_offline()
@allure.step('Verify: User is offline')
def user_is_offline(self):
return self.user_badge_color == '#7f8990'
@allure.step('Set user to automatic')
def set_user_to_automatic(self):
self.open_user_canvas().set_user_automatic_state()
@allure.step('Verify: User is set to automatic')
def user_is_set_to_automatic(self):
return self.user_badge_color == '#4ebc60'

View File

@ -263,3 +263,10 @@ mainWindow_Turn_off_Button = {"checkable": False, "container": statusDesktop_mai
# Wallet toast message
mainWallet_Ephemeral_Notification_List = {"container": statusDesktop_mainWindow, "objectName": "ephemeralNotificationList", "type": "StatusListView"}
ephemeralNotificationList_StatusToastMessage = {"container": mainWallet_Ephemeral_Notification_List, "type": "StatusToastMessage", "unnamed": 1, "visible": True}
# 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}

View File

@ -3,6 +3,7 @@ statusDesktop_mainWindow_overlay = {"container": statusDesktop_mainWindow, "type
statusDesktop_mainWindow_overlay_popup2 = {"container": statusDesktop_mainWindow_overlay, "occurrence": 2, "type": "PopupItem", "unnamed": 1, "visible": True}
scrollView_StatusScrollView = {"container": statusDesktop_mainWindow_overlay, "id": "scrollView", "type": "StatusScrollView", "unnamed": 1, "visible": True}
splashScreen = {"container": statusDesktop_mainWindow, "objectName": "splashScreen", "type": "DidYouKnowSplashScreen"}
settingsSave_StatusButton = {"container": statusDesktop_mainWindow, "objectName": "settingsDirtyToastMessageSaveButton", "type": "StatusButton", "visible": True}
# Main right panel
mainWindow_RighPanel = {"container": statusDesktop_mainWindow, "type": "ColumnLayout", "objectName": "mainRightView", "visible": True}

View File

@ -9,7 +9,7 @@ settingsContentBaseScrollView_Flickable = {"container": settingsContentBase_Scro
mainWindow_LeftTabView = {"container": mainWindow_StatusSectionLayout_ContentItem, "type": "LeftTabView", "unnamed": 1, "visible": True}
mainWindow_Settings_StatusNavigationPanelHeadline = {"container": mainWindow_LeftTabView, "type": "StatusNavigationPanelHeadline", "unnamed": 1, "visible": True}
mainWindow_scrollView_StatusScrollView = {"container": mainWindow_LeftTabView, "id": "scrollView", "type": "StatusScrollView", "unnamed": 1, "visible": True}
scrollView_AppMenuItem_StatusNavigationListItem = {"container": mainWindow_scrollView_StatusScrollView, "type": "StatusNavigationListItem", "visible": True}
scrollView_MenuItem_StatusNavigationListItem = {"container": mainWindow_scrollView_StatusScrollView, "type": "StatusNavigationListItem", "visible": True}
# Communities View
mainWindow_CommunitiesView = {"container": statusDesktop_mainWindow, "type": "CommunitiesView", "unnamed": 1, "visible": True}
@ -55,3 +55,9 @@ settingsContentBaseScrollView_accountOrderView_AccountOrderView = {"container":
settingsContentBaseScrollView_StatusBaseText = {"container": settingsContentBase_ScrollView, "type": "StatusBaseText", "unnamed": 1, "visible": True}
mainWindow_StatusToolBar = {"container": statusDesktop_mainWindow, "objectName": "statusToolBar", "type": "StatusToolBar", "visible": True}
main_toolBar_back_button = {"container": mainWindow_StatusToolBar, "objectName": "toolBarBackButton", "type": "StatusFlatButton", "visible": True}
# Profile View
mainWindow_MyProfileView = {"container": statusDesktop_mainWindow, "type": "MyProfileView", "unnamed": 1, "visible": True}
displayName_StatusInput = {"container": statusDesktop_mainWindow, "objectName": "displayNameInput", "type": "StatusInput", "visible": True}
displayName_TextEdit = {"container": displayName_StatusInput, "type": "TextEdit", "unnamed": 1, "visible": True}
change_password_button = {"container": statusDesktop_mainWindow, "type": "StatusButton", "objectName": "profileSettingsChangePasswordButton", "visible": True}

View File

@ -8,12 +8,14 @@ import driver
from constants import UserCommunityInfo, wallet_account_list_item
from driver import objects_access
from driver.objects_access import walk_children
from gui.components.change_password_popup import ChangePasswordPopup
from gui.components.settings.send_contact_request_popup import SendContactRequest
from gui.components.wallet.testnet_mode_popup import TestnetModePopup
from gui.elements.qt.button import Button
from gui.elements.qt.list import List
from gui.elements.qt.object import QObject
from gui.elements.qt.scroll import Scroll
from gui.elements.qt.text_edit import TextEdit
from gui.elements.qt.text_label import TextLabel
from gui.screens.community_settings import CommunitySettingsScreen
from gui.screens.messages import MessagesScreen
@ -24,27 +26,32 @@ class LeftPanel(QObject):
def __init__(self):
super().__init__('mainWindow_LeftTabView')
self._settings_section_template = QObject('scrollView_AppMenuItem_StatusNavigationListItem')
self._settings_section_template = QObject('scrollView_MenuItem_StatusNavigationListItem')
def _open_settings(self, index: int):
self._settings_section_template.real_name['objectName'] = f'{index}-AppMenuItem'
def _open_settings(self, index: int, section_name: str):
self._settings_section_template.real_name['objectName'] = f'{index}-{section_name}MenuItem'
self._settings_section_template.click()
@allure.step('Open messaging settings')
def open_messaging_settings(self) -> 'MessagingSettingsView':
self._open_settings(3)
self._open_settings(3, 'App')
return MessagingSettingsView()
@allure.step('Open communities settings')
def open_communities_settings(self) -> 'CommunitiesSettingsView':
self._open_settings(12)
self._open_settings(12, 'App')
return CommunitiesSettingsView()
@allure.step('Open wallet settings')
def open_wallet_settings(self):
self._open_settings(4)
self._open_settings(4, 'App')
return WalletSettingsView()
@allure.step('Open profile settings')
def open_profile_settings(self):
self._open_settings(0, 'Main')
return ProfileSettingsView()
class SettingsScreen(QObject):
@ -53,6 +60,37 @@ class SettingsScreen(QObject):
self.left_panel = LeftPanel()
class ProfileSettingsView(QObject):
def __init__(self):
super().__init__('mainWindow_MyProfileView')
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')
@property
@allure.step('Get display name')
def display_name(self) -> str:
self._scroll_view.vertical_scroll_to(self._display_name_text_field)
return self._display_name_text_field.text
@allure.step('Set user name')
def set_name(self, value: str):
self._scroll_view.vertical_scroll_to(self._display_name_text_field)
self._display_name_text_field.text = value
self.save_changes()
@allure.step('Save changes')
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()
class MessagingSettingsView(QObject):
def __init__(self):

View File

@ -0,0 +1,94 @@
import allure
import pytest
from allure import step
import constants
from driver.aut import AUT
from gui.main_window import MainWindow
pytestmark = allure.suite("Settings")
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703007',
'Change own display name in profile popup')
@pytest.mark.case(703007)
@pytest.mark.parametrize('user_account', [constants.user.user_account_one])
@pytest.mark.parametrize('new_name', [pytest.param('NewUserName')])
def test_change_own_display_name(main_screen: MainWindow, user_account, new_name):
with step('Open own profile popup and check name of user is correct'):
profile = main_screen.left_panel.open_user_canvas()
profile_popup = profile.open_profile_popup()
assert profile_popup.user_name == user_account.name
with step('Go to edit profile settings and change the name of the user'):
profile_popup.edit_profile().set_name(new_name)
with step('Open own profile popup and check name of user is correct'):
assert main_screen.left_panel.open_user_canvas().open_profile_popup().user_name == new_name
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703002', 'Switch state to offline')
@pytest.mark.case(703002)
def test_switch_states_between_offline_and_online(aut: AUT, main_screen: MainWindow, user_account):
with (step('Open settings and switch state to offline')):
settings = main_screen.left_panel
settings.set_user_to_offline()
with step('Verify user appears offline'):
assert settings.user_is_offline()
with step('Restart application'):
aut.restart()
main_screen.authorize_user(user_account)
with step('Verify user appears offline'):
assert settings.user_is_offline()
with (step('Open settings and switch state to online')):
settings = main_screen.left_panel
settings.set_user_to_online()
with step('Restart application'):
aut.restart()
main_screen.authorize_user(user_account)
with step('Verify user appears online'):
assert settings.user_is_online()
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703004', 'Switch state to automatic')
@pytest.mark.case(703004)
def test_switch_state_to_automatic(aut: AUT, main_screen: MainWindow, user_account):
with step('Open settings and switch state to automatic'):
settings = main_screen.left_panel
settings.set_user_to_automatic()
with step('Verify user status set automatically to online'):
assert settings.user_is_set_to_automatic()
with step('Restart application'):
aut.restart()
main_screen.authorize_user(user_account)
with step('Verify user status set automatically to online'):
assert settings.user_is_set_to_automatic()
@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_new',
[pytest.param(constants.user.user_account_one, constants.user.user_account_one_changed)])
def test_change_password_and_login(aut: AUT, main_screen: MainWindow, user_account, user_account_new):
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(
user_account.password, user_account_new.password)
with step('Restart application'):
aut.restart()
main_screen.authorize_user(user_account_new)
with step('Verify that the user logged in correctly'):
user_canvas = main_screen.left_panel.open_user_canvas()
profile_popup = user_canvas.open_profile_popup()
assert profile_popup.user_name == user_account_new.name