2023-08-04 18:27:03 +00:00
|
|
|
import logging
|
|
|
|
import time
|
2023-08-10 11:43:17 +00:00
|
|
|
import typing
|
2023-08-04 18:27:03 +00:00
|
|
|
from abc import abstractmethod
|
|
|
|
|
|
|
|
import allure
|
|
|
|
|
2023-08-29 14:43:00 +00:00
|
|
|
import configs
|
2023-08-04 18:27:03 +00:00
|
|
|
import constants.tesseract
|
|
|
|
import driver
|
2023-10-25 11:43:06 +00:00
|
|
|
from constants import ColorCodes
|
2023-10-13 13:26:39 +00:00
|
|
|
from driver.objects_access import walk_children
|
2023-08-04 18:27:03 +00:00
|
|
|
from gui.components.os.open_file_dialogs import OpenFileDialog
|
2023-08-29 14:43:00 +00:00
|
|
|
from gui.components.picture_edit_popup import PictureEditPopup
|
2023-10-31 08:34:02 +00:00
|
|
|
from gui.components.splash_screen import SplashScreen
|
2023-10-06 08:33:42 +00:00
|
|
|
from gui.elements.button import Button
|
|
|
|
from gui.elements.object import QObject
|
|
|
|
from gui.elements.text_edit import TextEdit
|
|
|
|
from gui.elements.text_label import TextLabel
|
2023-08-04 18:27:03 +00:00
|
|
|
from scripts.tools.image import Image
|
|
|
|
from scripts.utils.system_path import SystemPath
|
|
|
|
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
class AllowNotificationsView(QObject):
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super(AllowNotificationsView, self).__init__('mainWindow_AllowNotificationsView')
|
|
|
|
self._allow_button = Button('mainWindow_allowNotificationsOnboardingOkButton')
|
|
|
|
|
|
|
|
@allure.step("Allow Notifications")
|
|
|
|
def allow(self):
|
|
|
|
self._allow_button.click()
|
|
|
|
self.wait_until_hidden()
|
|
|
|
|
|
|
|
|
2023-09-22 03:58:45 +00:00
|
|
|
class WelcomeToStatusView(QObject):
|
2023-08-04 18:27:03 +00:00
|
|
|
|
|
|
|
def __init__(self):
|
2023-09-22 03:58:45 +00:00
|
|
|
super(WelcomeToStatusView, self).__init__('mainWindow_WelcomeView')
|
|
|
|
self._i_am_new_to_status_button = Button('mainWindow_I_am_new_to_Status_StatusBaseText')
|
2023-09-28 06:45:49 +00:00
|
|
|
self._i_already_use_status_button = Button('mainWindow_I_already_use_Status_StatusFlatButton')
|
2023-08-04 18:27:03 +00:00
|
|
|
|
|
|
|
@allure.step('Open Keys view')
|
|
|
|
def get_keys(self) -> 'KeysView':
|
2023-09-22 03:58:45 +00:00
|
|
|
self._i_am_new_to_status_button.click()
|
2023-08-04 18:27:03 +00:00
|
|
|
time.sleep(1)
|
|
|
|
return KeysView().wait_until_appears()
|
|
|
|
|
2023-09-28 06:45:49 +00:00
|
|
|
@allure.step('Open Sign by syncing form')
|
|
|
|
def sync_existing_user(self) -> 'SignBySyncingView':
|
|
|
|
self._i_already_use_status_button.click()
|
|
|
|
time.sleep(1)
|
|
|
|
return SignBySyncingView().wait_until_appears()
|
|
|
|
|
2023-08-04 18:27:03 +00:00
|
|
|
|
2023-08-29 14:43:00 +00:00
|
|
|
class OnboardingView(QObject):
|
2023-08-04 18:27:03 +00:00
|
|
|
|
|
|
|
def __init__(self, object_name):
|
2023-08-29 14:43:00 +00:00
|
|
|
super(OnboardingView, self).__init__(object_name)
|
2023-08-04 18:27:03 +00:00
|
|
|
self._back_button = Button('mainWindow_onboardingBackButton_StatusRoundButton')
|
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def back(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2023-08-29 14:43:00 +00:00
|
|
|
class KeysView(OnboardingView):
|
2023-08-04 18:27:03 +00:00
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super(KeysView, self).__init__('mainWindow_KeysMainView')
|
|
|
|
self._generate_key_button = Button('mainWindow_Generate_new_keys_StatusButton')
|
2023-08-10 11:43:17 +00:00
|
|
|
self._generate_key_for_new_keycard_button = Button('mainWindow_Generate_keys_for_new_Keycard_StatusBaseText')
|
|
|
|
self._import_seed_phrase_button = Button('mainWindow_Import_seed_phrase')
|
2023-08-04 18:27:03 +00:00
|
|
|
|
|
|
|
@allure.step('Open Profile view')
|
|
|
|
def generate_new_keys(self) -> 'YourProfileView':
|
|
|
|
self._generate_key_button.click()
|
|
|
|
return YourProfileView().wait_until_appears()
|
|
|
|
|
2023-08-10 11:43:17 +00:00
|
|
|
@allure.step('Open Keycard Init view')
|
|
|
|
def generate_key_for_new_keycard(self) -> 'KeycardInitView':
|
|
|
|
self._generate_key_for_new_keycard_button.click()
|
|
|
|
return KeycardInitView().wait_until_appears()
|
|
|
|
|
|
|
|
@allure.step('Open Import Seed Phrase view')
|
|
|
|
def open_import_seed_phrase_view(self) -> 'ImportSeedPhraseView':
|
|
|
|
self._import_seed_phrase_button.click()
|
|
|
|
return ImportSeedPhraseView().wait_until_appears()
|
|
|
|
|
2023-08-04 18:27:03 +00:00
|
|
|
@allure.step('Go back')
|
2023-09-22 03:58:45 +00:00
|
|
|
def back(self) -> WelcomeToStatusView:
|
2023-08-04 18:27:03 +00:00
|
|
|
self._back_button.click()
|
2023-09-22 03:58:45 +00:00
|
|
|
return WelcomeToStatusView().wait_until_appears()
|
2023-08-04 18:27:03 +00:00
|
|
|
|
|
|
|
|
2023-08-29 14:43:00 +00:00
|
|
|
class ImportSeedPhraseView(OnboardingView):
|
2023-08-10 11:43:17 +00:00
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super(ImportSeedPhraseView, self).__init__('mainWindow_KeysMainView')
|
|
|
|
self._import_seed_phrase_button = Button('keysMainView_PrimaryAction_Button')
|
|
|
|
|
|
|
|
@allure.step('Open seed phrase input view')
|
|
|
|
def open_seed_phrase_input_view(self):
|
|
|
|
self._import_seed_phrase_button.click()
|
|
|
|
return SeedPhraseInputView().wait_until_appears()
|
|
|
|
|
|
|
|
@allure.step('Go back')
|
|
|
|
def back(self) -> KeysView:
|
|
|
|
self._back_button.click()
|
|
|
|
return KeysView().wait_until_appears()
|
|
|
|
|
|
|
|
|
2023-09-28 06:45:49 +00:00
|
|
|
class SignBySyncingView(OnboardingView):
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super(SignBySyncingView, self).__init__('mainWindow_KeysMainView')
|
|
|
|
self._scan_or_enter_sync_code_button = Button('keysMainView_PrimaryAction_Button')
|
|
|
|
|
|
|
|
@allure.step('Open sync code view')
|
|
|
|
def open_sync_code_view(self):
|
|
|
|
self._scan_or_enter_sync_code_button.click()
|
|
|
|
return SyncCodeView().wait_until_appears()
|
|
|
|
|
|
|
|
|
|
|
|
class SyncCodeView(OnboardingView):
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super(SyncCodeView, self).__init__('mainWindow_SyncCodeView')
|
|
|
|
self._enter_sync_code_button = Button('switchTabBar_Enter_sync_code_StatusSwitchTabButton')
|
|
|
|
self._paste_sync_code_button = Button('mainWindow_Paste_StatusButton')
|
2023-10-06 03:17:13 +00:00
|
|
|
self._syncing_enter_code_item = QObject('mainWindow_syncingEnterCode_SyncingEnterCode')
|
2023-09-28 06:45:49 +00:00
|
|
|
|
|
|
|
@allure.step('Open enter sync code form')
|
|
|
|
def open_enter_sync_code_form(self):
|
|
|
|
self._enter_sync_code_button.click()
|
|
|
|
return self
|
|
|
|
|
|
|
|
@allure.step('Paste sync code')
|
|
|
|
def paste_sync_code(self):
|
|
|
|
self._paste_sync_code_button.click()
|
2023-10-06 03:17:13 +00:00
|
|
|
|
|
|
|
@property
|
|
|
|
@allure.step('Get wrong sync code message')
|
|
|
|
def sync_code_error_message(self) -> str:
|
|
|
|
return self._syncing_enter_code_item.object.syncCodeErrorMessage
|
2023-09-28 06:45:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SyncDeviceFoundView(OnboardingView):
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super(SyncDeviceFoundView, self).__init__('mainWindow_SyncingDeviceView_found')
|
|
|
|
self._sync_text_item = QObject('sync_text_item')
|
|
|
|
|
|
|
|
@property
|
|
|
|
@allure.step('Get device_found_notifications')
|
|
|
|
def device_found_notifications(self) -> typing.List:
|
|
|
|
device_found_notifications = []
|
|
|
|
for obj in driver.findAllObjects(self._sync_text_item.real_name):
|
|
|
|
device_found_notifications.append(str(obj.text))
|
|
|
|
return device_found_notifications
|
|
|
|
|
|
|
|
|
|
|
|
class SyncResultView(OnboardingView):
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super(SyncResultView, self).__init__('mainWindow_SyncDeviceResult')
|
|
|
|
self._sync_result = QObject('mainWindow_SyncDeviceResult')
|
|
|
|
self._sign_in_button = Button('mainWindow_Sign_in_StatusButton')
|
|
|
|
self._synced_text_item = QObject('synced_StatusBaseText')
|
|
|
|
|
|
|
|
@property
|
|
|
|
@allure.step('Get device synced notifications')
|
|
|
|
def device_synced_notifications(self) -> typing.List:
|
|
|
|
device_synced_notifications = []
|
|
|
|
for obj in driver.findAllObjects(self._synced_text_item.real_name):
|
|
|
|
device_synced_notifications.append(str(obj.text))
|
|
|
|
return device_synced_notifications
|
|
|
|
|
|
|
|
@allure.step('Wait until appears {0}')
|
|
|
|
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
|
|
|
self._sign_in_button.wait_until_appears(timeout_msec)
|
|
|
|
return self
|
|
|
|
|
|
|
|
@allure.step('Sign in')
|
2023-10-31 08:34:02 +00:00
|
|
|
def sign_in(self, attempts: int = 2):
|
2023-09-28 06:45:49 +00:00
|
|
|
self._sign_in_button.click()
|
2023-10-31 08:34:02 +00:00
|
|
|
try:
|
|
|
|
return SplashScreen().wait_until_appears()
|
|
|
|
except:
|
|
|
|
assert attempts > 0, f'Next button was not clicked'
|
|
|
|
self.sign_in(attempts - 1)
|
2023-09-28 06:45:49 +00:00
|
|
|
|
|
|
|
|
2023-08-29 14:43:00 +00:00
|
|
|
class SeedPhraseInputView(OnboardingView):
|
2023-08-10 11:43:17 +00:00
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super(SeedPhraseInputView, self).__init__('mainWindow_SeedPhraseInputView')
|
|
|
|
self._12_words_tab_button = Button('switchTabBar_12_words_Button')
|
|
|
|
self._18_words_tab_button = Button('switchTabBar_18_words_Button')
|
|
|
|
self._24_words_tab_button = Button('switchTabBar_24_words_Button')
|
|
|
|
self._seed_phrase_input_text_edit = TextEdit('mainWindow_statusSeedPhraseInputField_TextEdit')
|
|
|
|
self._import_button = Button('mainWindow_Import_StatusButton')
|
|
|
|
|
2023-10-13 13:26:39 +00:00
|
|
|
@property
|
|
|
|
@allure.step('Get import button enabled state')
|
|
|
|
def is_import_button_enabled(self) -> bool:
|
|
|
|
return driver.waitForObjectExists(self._import_button.real_name,
|
|
|
|
configs.timeouts.UI_LOAD_TIMEOUT_MSEC).enabled
|
|
|
|
|
2023-08-10 11:43:17 +00:00
|
|
|
@allure.step('Input seed phrase')
|
2023-10-11 11:28:34 +00:00
|
|
|
def input_seed_phrase(self, seed_phrase: typing.List[str], autocomplete: bool):
|
2023-08-10 11:43:17 +00:00
|
|
|
if len(seed_phrase) == 12:
|
|
|
|
if not self._12_words_tab_button.is_checked:
|
|
|
|
self._12_words_tab_button.click()
|
|
|
|
elif len(seed_phrase) == 18:
|
|
|
|
if not self._18_words_tab_button.is_checked:
|
|
|
|
self._18_words_tab_button.click()
|
|
|
|
elif len(seed_phrase) == 24:
|
|
|
|
if not self._24_words_tab_button.is_checked:
|
|
|
|
self._24_words_tab_button.click()
|
|
|
|
else:
|
|
|
|
raise RuntimeError("Wrong amount of seed words", len(seed_phrase))
|
|
|
|
|
|
|
|
for index, word in enumerate(seed_phrase, start=1):
|
|
|
|
self._seed_phrase_input_text_edit.real_name['objectName'] = f'statusSeedPhraseInputField{index}'
|
2023-10-11 11:28:34 +00:00
|
|
|
if autocomplete:
|
|
|
|
word_to_put = word[:-1]
|
|
|
|
self._seed_phrase_input_text_edit.text = word_to_put
|
|
|
|
driver.type(self._seed_phrase_input_text_edit.object, "<Return>")
|
|
|
|
else:
|
|
|
|
self._seed_phrase_input_text_edit.text = word
|
2023-08-10 11:43:17 +00:00
|
|
|
|
2023-10-13 13:26:39 +00:00
|
|
|
@allure.step('Click import button')
|
|
|
|
def import_seed_phrase(self):
|
2023-08-10 11:43:17 +00:00
|
|
|
self._import_button.click()
|
|
|
|
return YourProfileView().wait_until_appears()
|
|
|
|
|
|
|
|
|
2023-08-29 14:43:00 +00:00
|
|
|
class KeycardInitView(OnboardingView):
|
2023-08-10 11:43:17 +00:00
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super(KeycardInitView, self).__init__('mainWindow_KeycardInitView')
|
|
|
|
self._message = TextLabel('mainWindow_Plug_in_Keycard_reader_StatusBaseText')
|
|
|
|
|
|
|
|
@property
|
|
|
|
def message(self) -> str:
|
|
|
|
return self._message.text
|
|
|
|
|
|
|
|
def back(self) -> KeysView:
|
|
|
|
self._back_button.click()
|
|
|
|
return KeysView().wait_until_appears()
|
|
|
|
|
|
|
|
|
2023-08-29 14:43:00 +00:00
|
|
|
class YourProfileView(OnboardingView):
|
2023-08-04 18:27:03 +00:00
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super(YourProfileView, self).__init__('mainWindow_InsertDetailsView')
|
|
|
|
self._upload_picture_button = Button('updatePicButton_StatusRoundButton')
|
|
|
|
self._profile_image = QObject('mainWindow_CanvasItem')
|
|
|
|
self._display_name_text_field = TextEdit('mainWindow_statusBaseInput_StatusBaseInput')
|
|
|
|
self._erros_text_label = TextLabel('mainWindow_errorMessage_StatusBaseText')
|
|
|
|
self._next_button = Button('mainWindow_Next_StatusButton')
|
2023-10-13 13:26:39 +00:00
|
|
|
self._login_input_object = QObject('mainWindow_nameInput_StatusInput')
|
|
|
|
|
|
|
|
@property
|
|
|
|
@allure.step('Get next button enabled state')
|
|
|
|
def is_next_button_enabled(self) -> bool:
|
|
|
|
return driver.waitForObjectExists(self._next_button.real_name, configs.timeouts.UI_LOAD_TIMEOUT_MSEC).enabled
|
2023-08-04 18:27:03 +00:00
|
|
|
|
|
|
|
@property
|
|
|
|
@allure.step('Get profile image')
|
|
|
|
def profile_image(self) -> Image:
|
|
|
|
return self._profile_image.image
|
|
|
|
|
|
|
|
@property
|
|
|
|
@allure.step('Get error messages')
|
|
|
|
def error_message(self) -> str:
|
|
|
|
return self._erros_text_label.text if self._erros_text_label.is_visible else ''
|
|
|
|
|
|
|
|
@allure.step('Set user display name')
|
|
|
|
def set_display_name(self, value: str):
|
|
|
|
self._display_name_text_field.clear().text = value
|
|
|
|
return self
|
|
|
|
|
|
|
|
@allure.step('Set user image')
|
2023-08-29 14:43:00 +00:00
|
|
|
def set_user_image(self, fp: SystemPath) -> PictureEditPopup:
|
2023-08-04 18:27:03 +00:00
|
|
|
allure.attach(name='User image', body=fp.read_bytes(), attachment_type=allure.attachment_type.PNG)
|
|
|
|
self._upload_picture_button.hover()
|
|
|
|
self._upload_picture_button.click()
|
|
|
|
file_dialog = OpenFileDialog().wait_until_appears()
|
|
|
|
file_dialog.open_file(fp)
|
2023-08-29 14:43:00 +00:00
|
|
|
return PictureEditPopup().wait_until_appears()
|
2023-08-04 18:27:03 +00:00
|
|
|
|
|
|
|
@allure.step('Open Emoji and Icon view')
|
2023-10-26 11:19:32 +00:00
|
|
|
def next(self, attempts: int = 2) -> 'EmojiAndIconView':
|
2023-08-04 18:27:03 +00:00
|
|
|
self._next_button.click()
|
2023-10-26 11:19:32 +00:00
|
|
|
try:
|
|
|
|
return EmojiAndIconView().wait_until_appears()
|
|
|
|
except AssertionError as err:
|
|
|
|
if attempts:
|
|
|
|
return self.next(attempts - 1)
|
|
|
|
else:
|
|
|
|
raise err
|
|
|
|
|
2023-08-04 18:27:03 +00:00
|
|
|
@allure.step('Go back')
|
|
|
|
def back(self):
|
|
|
|
self._back_button.click()
|
|
|
|
return KeysView().wait_until_appears()
|
|
|
|
|
|
|
|
|
2023-08-29 14:43:00 +00:00
|
|
|
class EmojiAndIconView(OnboardingView):
|
2023-08-04 18:27:03 +00:00
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super(EmojiAndIconView, self).__init__('mainWindow_InsertDetailsView')
|
|
|
|
self._profile_image = QObject('mainWindow_welcomeScreenUserProfileImage_StatusSmartIdenticon')
|
|
|
|
self._chat_key_text_label = TextLabel('mainWindow_insertDetailsViewChatKeyTxt_StyledText')
|
|
|
|
self._next_button = Button('mainWindow_Next_StatusButton')
|
|
|
|
self._emoji_hash = QObject('mainWindow_EmojiHash')
|
|
|
|
self._identicon_ring = QObject('mainWindow_userImageCopy_StatusSmartIdenticon')
|
|
|
|
|
|
|
|
@property
|
|
|
|
@allure.step('Get profile image icon')
|
|
|
|
def profile_image(self) -> Image:
|
|
|
|
self._profile_image.image.update_view()
|
|
|
|
return self._profile_image.image
|
|
|
|
|
|
|
|
@property
|
|
|
|
@allure.step('Get profile image icon without identicon ring')
|
|
|
|
def cropped_profile_image(self) -> Image:
|
|
|
|
# Profile image without identicon_ring
|
|
|
|
self._profile_image.image.update_view()
|
|
|
|
self._profile_image.image.crop(
|
|
|
|
driver.UiTypes.ScreenRectangle(
|
|
|
|
20, 20, self._profile_image.image.width - 40, self._profile_image.image.height - 40
|
|
|
|
))
|
|
|
|
return self._profile_image.image
|
|
|
|
|
|
|
|
@property
|
|
|
|
@allure.step('Get chat key')
|
|
|
|
def chat_key(self) -> str:
|
|
|
|
return self._chat_key_text_label.text.split(':')[1].strip()
|
|
|
|
|
|
|
|
@property
|
|
|
|
@allure.step('Get emoji hash image')
|
|
|
|
def emoji_hash(self) -> Image:
|
|
|
|
return self._emoji_hash.image
|
|
|
|
|
|
|
|
@property
|
|
|
|
@allure.step('Verify: Identicon ring visible')
|
|
|
|
def is_identicon_ring_visible(self):
|
|
|
|
return self._identicon_ring.is_visible
|
|
|
|
|
|
|
|
@allure.step('Open Create password view')
|
|
|
|
def next(self) -> 'CreatePasswordView':
|
|
|
|
self._next_button.click()
|
|
|
|
time.sleep(1)
|
|
|
|
return CreatePasswordView().wait_until_appears()
|
|
|
|
|
|
|
|
@allure.step('Go back')
|
|
|
|
def back(self):
|
|
|
|
self._back_button.click()
|
|
|
|
return YourProfileView().wait_until_appears()
|
|
|
|
|
|
|
|
@allure.step
|
|
|
|
@allure.step('Verify: User image contains text')
|
|
|
|
def is_user_image_contains(self, text: str):
|
|
|
|
crop = driver.UiTypes.ScreenRectangle(
|
2023-08-10 11:43:17 +00:00
|
|
|
20, 20, self._profile_image.image.width - 40, self._profile_image.image.height - 40
|
|
|
|
)
|
2023-08-04 18:27:03 +00:00
|
|
|
return self.profile_image.has_text(text, constants.tesseract.text_on_profile_image, crop=crop)
|
|
|
|
|
|
|
|
@allure.step
|
|
|
|
@allure.step('Verify: User image background color')
|
|
|
|
def is_user_image_background_white(self):
|
|
|
|
crop = driver.UiTypes.ScreenRectangle(
|
2023-08-10 11:43:17 +00:00
|
|
|
20, 20, self._profile_image.image.width - 40, self._profile_image.image.height - 40
|
|
|
|
)
|
2023-08-04 18:27:03 +00:00
|
|
|
return self.profile_image.has_color(constants.Color.WHITE, crop=crop)
|
|
|
|
|
|
|
|
|
2023-08-29 14:43:00 +00:00
|
|
|
class CreatePasswordView(OnboardingView):
|
2023-08-04 18:27:03 +00:00
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super(CreatePasswordView, self).__init__('mainWindow_CreatePasswordView')
|
|
|
|
self._new_password_text_field = TextEdit('mainWindow_passwordViewNewPassword')
|
|
|
|
self._confirm_password_text_field = TextEdit('mainWindow_passwordViewNewPasswordConfirm')
|
|
|
|
self._create_button = Button('mainWindow_Create_password_StatusButton')
|
2023-10-13 13:26:39 +00:00
|
|
|
self._password_view_object = QObject('mainWindow_view_PasswordView')
|
2023-10-25 11:43:06 +00:00
|
|
|
self._strength_indicator = QObject('mainWindow_strengthInditactor_StatusPasswordStrengthIndicator')
|
|
|
|
self._indicator_panel_object = QObject('mainWindow_RowLayout')
|
2023-08-04 18:27:03 +00:00
|
|
|
|
|
|
|
@property
|
|
|
|
@allure.step('Verify: Create password button enabled')
|
|
|
|
def is_create_password_button_enabled(self) -> bool:
|
2023-10-13 13:26:39 +00:00
|
|
|
return driver.waitForObjectExists(self._create_button.real_name,
|
|
|
|
configs.timeouts.UI_LOAD_TIMEOUT_MSEC).enabled
|
2023-08-04 18:27:03 +00:00
|
|
|
|
2023-10-25 11:43:06 +00:00
|
|
|
@property
|
|
|
|
@allure.step('Get strength indicator color')
|
|
|
|
def strength_indicator_color(self) -> str:
|
|
|
|
return self._strength_indicator.object.fillColor['name']
|
|
|
|
|
|
|
|
@property
|
|
|
|
@allure.step('Get strength indicator text')
|
|
|
|
def strength_indicator_text(self) -> str:
|
|
|
|
return self._strength_indicator.object.text
|
|
|
|
|
|
|
|
@property
|
|
|
|
@allure.step('Get indicator panel green messages')
|
|
|
|
def green_indicator_messages(self) -> typing.List[str]:
|
|
|
|
messages = []
|
|
|
|
color = ColorCodes.GREEN.value
|
|
|
|
for child in walk_children(self._indicator_panel_object.object):
|
|
|
|
if getattr(child, 'id', '') == 'lowerCaseTxt' and child.color['name'] == color:
|
|
|
|
messages.append(str(child.text))
|
|
|
|
elif getattr(child, 'id', '') == 'upperCaseTxt' and child.color['name'] == color:
|
|
|
|
messages.append(str(child.text))
|
|
|
|
elif getattr(child, 'id', '') == 'numbersTxt' and child.color['name'] == color:
|
|
|
|
messages.append(str(child.text))
|
|
|
|
elif getattr(child, 'id', '') == 'symbolsTxt' and child.color['name'] == color:
|
|
|
|
messages.append(str(child.text))
|
|
|
|
return messages
|
|
|
|
|
2023-10-13 13:26:39 +00:00
|
|
|
@property
|
|
|
|
@allure.step('Get password error message')
|
|
|
|
def password_error_message(self) -> str:
|
|
|
|
return self._password_view_object.object.errorMsgText
|
|
|
|
|
|
|
|
@allure.step('Set password in first field')
|
|
|
|
def set_password_in_first_field(self, value: str):
|
2023-08-04 18:27:03 +00:00
|
|
|
self._new_password_text_field.clear().text = value
|
2023-10-13 13:26:39 +00:00
|
|
|
|
|
|
|
@allure.step('Set password in confirmation field')
|
|
|
|
def set_password_in_confirmation_field(self, value: str):
|
2023-08-04 18:27:03 +00:00
|
|
|
self._confirm_password_text_field.clear().text = value
|
2023-10-13 13:26:39 +00:00
|
|
|
|
|
|
|
@allure.step('Set password and open Confirmation password view')
|
|
|
|
def create_password(self, value: str) -> 'ConfirmPasswordView':
|
|
|
|
self.set_password_in_first_field(value)
|
|
|
|
self.set_password_in_confirmation_field(value)
|
2023-08-04 18:27:03 +00:00
|
|
|
self._create_button.click()
|
|
|
|
time.sleep(1)
|
|
|
|
return ConfirmPasswordView().wait_until_appears()
|
|
|
|
|
|
|
|
@allure.step('Go back')
|
|
|
|
def back(self):
|
|
|
|
self._back_button.click()
|
|
|
|
return EmojiAndIconView().wait_until_appears()
|
|
|
|
|
|
|
|
|
2023-08-29 14:43:00 +00:00
|
|
|
class ConfirmPasswordView(OnboardingView):
|
2023-08-04 18:27:03 +00:00
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super(ConfirmPasswordView, self).__init__('mainWindow_ConfirmPasswordView')
|
|
|
|
self._confirm_password_text_field = TextEdit('mainWindow_confirmAgainPasswordInput')
|
|
|
|
self._confirm_button = Button('mainWindow_Finalise_Status_Password_Creation_StatusButton')
|
2023-10-13 13:26:39 +00:00
|
|
|
self._confirmation_password_view_object = QObject('mainWindow_passwordView_PasswordConfirmationView')
|
|
|
|
|
|
|
|
@property
|
|
|
|
@allure.step('Get finalise password creation button enabled state')
|
|
|
|
def is_confirm_password_button_enabled(self) -> bool:
|
|
|
|
return driver.waitForObjectExists(self._confirm_button.real_name,
|
|
|
|
configs.timeouts.UI_LOAD_TIMEOUT_MSEC).enabled
|
|
|
|
|
|
|
|
@property
|
|
|
|
@allure.step('Get confirmation error message')
|
|
|
|
def confirmation_error_message(self) -> str:
|
|
|
|
for child in walk_children(self._confirmation_password_view_object.object):
|
|
|
|
if getattr(child, 'id', '') == 'errorTxt':
|
|
|
|
return str(child.text)
|
|
|
|
|
|
|
|
@allure.step('Set password')
|
|
|
|
def set_password(self, value: str):
|
|
|
|
self._confirm_password_text_field.text = value
|
2023-08-04 18:27:03 +00:00
|
|
|
|
|
|
|
@allure.step('Confirm password')
|
|
|
|
def confirm_password(self, value: str):
|
2023-10-13 13:26:39 +00:00
|
|
|
self.set_password(value)
|
2023-08-04 18:27:03 +00:00
|
|
|
self._confirm_button.click()
|
|
|
|
|
|
|
|
@allure.step('Go back')
|
|
|
|
def back(self):
|
|
|
|
self._back_button.click()
|
|
|
|
return CreatePasswordView().wait_until_appears()
|
|
|
|
|
|
|
|
|
2023-09-22 03:58:45 +00:00
|
|
|
class BiometricsView(OnboardingView):
|
2023-08-04 18:27:03 +00:00
|
|
|
|
|
|
|
def __init__(self):
|
2023-09-22 03:58:45 +00:00
|
|
|
super(BiometricsView, self).__init__('mainWindow_TouchIDAuthView')
|
|
|
|
self._yes_use_touch_id_button = Button('mainWindow_touchIdYesUseTouchIDButton')
|
2023-08-04 18:27:03 +00:00
|
|
|
self._prefer_password_button = Button('mainWindow_touchIdIPreferToUseMyPasswordText')
|
|
|
|
|
|
|
|
@allure.step('Select prefer password')
|
|
|
|
def prefer_password(self):
|
|
|
|
self._prefer_password_button.click()
|
|
|
|
self.wait_until_hidden()
|
2023-08-29 14:43:00 +00:00
|
|
|
|
2023-09-22 03:58:45 +00:00
|
|
|
@allure.step('Verify TouchID button')
|
|
|
|
def is_touch_id_button_visible(self):
|
|
|
|
return self._yes_use_touch_id_button.is_visible
|
|
|
|
|
|
|
|
|
2023-08-29 14:43:00 +00:00
|
|
|
class LoginView(QObject):
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super(LoginView, self).__init__('mainWindow_LoginView')
|
|
|
|
self._password_text_edit = TextEdit('loginView_passwordInput')
|
|
|
|
self._arrow_right_button = Button('loginView_submitBtn')
|
|
|
|
self._current_user_name_label = TextLabel('loginView_currentUserNameLabel')
|
|
|
|
self._change_account_button = Button('loginView_changeAccountBtn')
|
|
|
|
self._accounts_combobox = QObject('accountsView_accountListPanel')
|
2023-10-13 13:26:39 +00:00
|
|
|
self._password_object = QObject('mainWindow_txtPassword_Input')
|
|
|
|
|
|
|
|
@property
|
|
|
|
@allure.step('Get login error message')
|
|
|
|
def login_error_message(self) -> str:
|
|
|
|
return str(self._password_object.object.validationError)
|
2023-08-29 14:43:00 +00:00
|
|
|
|
|
|
|
@allure.step('Log in user')
|
|
|
|
def log_in(self, account):
|
|
|
|
if self._current_user_name_label.text != account.name:
|
|
|
|
self._change_account_button.hover()
|
|
|
|
self._change_account_button.click()
|
|
|
|
self.select_user_name(account.name)
|
|
|
|
|
|
|
|
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):
|
|
|
|
names = set()
|
|
|
|
|
|
|
|
def _select_user() -> bool:
|
|
|
|
for index in range(self._accounts_combobox.object.count):
|
|
|
|
name_object = self._accounts_combobox.object.itemAt(index)
|
|
|
|
name_label = str(name_object.label)
|
|
|
|
names.add(name_label)
|
|
|
|
if name_label == user_name:
|
|
|
|
try:
|
|
|
|
driver.mouseClick(name_object)
|
|
|
|
except RuntimeError:
|
|
|
|
continue
|
|
|
|
return True
|
|
|
|
return False
|
|
|
|
|
|
|
|
assert driver.waitFor(lambda: _select_user(), timeout_msec), f'User name: "{user_name}" not found in {names}'
|