test: test_cancel_setup_syncing added (#334)

This commit is contained in:
Valentina1133 2023-11-27 13:44:30 +03:00 committed by GitHub
parent 50ada60385
commit 7db3e94a96
6 changed files with 54 additions and 1 deletions

View File

@ -5,3 +5,5 @@ class SyncingSettings(Enum):
SYNC_A_NEW_DEVICE_INSTRUCTIONS_HEADER = 'Sync a New Device'
SYNC_A_NEW_DEVICE_INSTRUCTIONS_SUBTITLE = 'You own your data. Sync it among your devices.'
SYNC_CODE_IS_WRONG_TEXT = 'This does not look like a sync code'
SYNC_SETUP_ERROR_PRIMARY = 'Failed to generate sync code'
SYNC_SETUP_ERROR_SECONDARY = 'Failed to start pairing server'

View File

@ -14,6 +14,7 @@ class AuthenticatePopup(BasePopup):
self._content = QObject('keycardSharedPopupContent_KeycardPopupContent')
self._passwort_text_edit = TextEdit('password_PlaceholderText')
self._authenticate_button = Button('authenticate_StatusButton')
self._close_button = Button('headerCloseButton_StatusFlatRoundButton')
@allure.step('Wait until appears {0}')
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
@ -25,3 +26,7 @@ class AuthenticatePopup(BasePopup):
self._passwort_text_edit.type_text(password)
self._authenticate_button.click()
self._authenticate_button.wait_until_hidden()
@allure.step('Close authenticate popup by close button')
def close_authenticate_popup(self):
self._close_button.click()

View File

@ -3,6 +3,7 @@ import pyperclip
from gui.components.base_popup import BasePopup
from gui.elements.button import Button
from gui.elements.object import QObject
from gui.elements.text_edit import TextEdit
@ -13,6 +14,18 @@ class SyncNewDevicePopup(BasePopup):
self._copy_button = Button('copy_SyncCodeStatusButton')
self._done_button = Button('done_SyncCodeStatusButton')
self._sync_code_field = TextEdit('syncCodeInput_StatusPasswordInput')
self._close_button = Button('close_StatusButton')
self._error_message = QObject('errorView_SyncingErrorMessage')
@property
@allure.step('Get primary error message')
def primary_error_message(self) -> str:
return str(self._error_message.object.primaryText)
@property
@allure.step('Get secondary error message')
def secondary_error_message(self) -> str:
return str(self._error_message.object.secondaryText)
@property
@allure.step('Get syncing code')
@ -24,3 +37,8 @@ class SyncNewDevicePopup(BasePopup):
def done(self):
self._done_button.click()
self.wait_until_hidden()
@allure.step('Click close')
def close(self):
self._close_button.click()
self.wait_until_hidden()

View File

@ -193,6 +193,7 @@ delete_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow
keycardSharedPopupContent_KeycardPopupContent = {"container": statusDesktop_mainWindow_overlay, "objectName": "KeycardSharedPopupContent", "type": "KeycardPopupContent", "visible": True}
password_PlaceholderText = {"container": statusDesktop_mainWindow_overlay, "type": "PlaceholderText", "unnamed": 1, "visible": True}
authenticate_StatusButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "PrimaryButton", "text": "Authenticate", "type": "StatusButton", "visible": True}
headerCloseButton_StatusFlatRoundButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "headerCloseButton", "type": "StatusFlatRoundButton", "visible": True}
# Shared Popup
sharedPopup_Popup_Content = {"container": statusDesktop_mainWindow, "objectName": "KeycardSharedPopupContent", "type": "Item"}
@ -311,6 +312,8 @@ mainWindow_secureYourSeedPhraseBanner_Button = {"container": statusDesktop_mainW
copy_SyncCodeStatusButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "syncCodeCopyButton", "type": "StatusButton", "visible": True}
done_SyncCodeStatusButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "syncAnewDeviceNextButton", "type": "StatusButton", "visible": True}
syncCodeInput_StatusPasswordInput = {"container": statusDesktop_mainWindow_overlay, "id": "syncCodeInput", "type": "StatusPasswordInput", "unnamed": 1, "visible": True}
close_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "syncAnewDeviceNextButton", "type": "StatusButton", "visible": True}
errorView_SyncingErrorMessage = {"container": statusDesktop_mainWindow_overlay, "id": "errorView", "type": "SyncingErrorMessage", "unnamed": 1, "visible": True}
# Edit group name and image popup
groupChatEdit_name_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "groupChatEdit_name", "type": "TextEdit", "visible": True}

View File

@ -33,6 +33,11 @@ class SyncingSettingsView(QObject):
@allure.step('Setup syncing')
def set_up_syncing(self, password: str):
self._setup_syncing_button.click()
self.click_setup_syncing()
AuthenticatePopup().wait_until_appears().authenticate(password)
return SyncNewDevicePopup().wait_until_appears()
@allure.step('Click setup syncing')
def click_setup_syncing(self):
self._setup_syncing_button.click()
return AuthenticatePopup().wait_until_appears()

View File

@ -10,8 +10,10 @@ import constants
import driver
from constants import UserAccount
from constants.syncing import SyncingSettings
from gui.components.community.authenticate_popup import AuthenticatePopup
from gui.components.onboarding.before_started_popup import BeforeStartedPopUp
from gui.components.onboarding.beta_consent_popup import BetaConsentPopup
from gui.components.settings.sync_new_device_popup import SyncNewDevicePopup
from gui.components.splash_screen import SplashScreen
from gui.main_window import MainWindow
from gui.screens.onboarding import AllowNotificationsView, WelcomeToStatusView, SyncResultView, \
@ -106,3 +108,21 @@ def test_wrong_sync_code(sync_screen, wrong_sync_code):
pyperclip.copy(wrong_sync_code)
sync_view.paste_sync_code()
assert SyncingSettings.SYNC_CODE_IS_WRONG_TEXT.value == sync_view.sync_code_error_message, f'Wrong sync code message did not appear'
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703591', 'Generate sync code. Negative')
@pytest.mark.case(703591)
def test_cancel_setup_syncing(main_screen: MainWindow):
with step('Open syncing settings'):
sync_settings_view = main_screen.left_panel.open_settings().left_panel.open_syncing_settings()
sync_settings_view.is_instructions_header_present()
sync_settings_view.is_instructions_subtitle_present()
if configs.DEV_BUILD:
sync_settings_view.is_backup_button_present()
with step('Click setup syncing and close authenticate popup'):
main_screen.left_panel.open_settings().left_panel.open_syncing_settings().click_setup_syncing().close_authenticate_popup()
sync_new_device_popup = SyncNewDevicePopup().wait_until_appears()
with step('Verify error messages appear'):
assert sync_new_device_popup.primary_error_message == SyncingSettings.SYNC_SETUP_ERROR_PRIMARY.value
assert sync_new_device_popup.secondary_error_message == SyncingSettings.SYNC_SETUP_ERROR_SECONDARY.value