2023-09-28 06:45:49 +00:00
|
|
|
import allure
|
2023-10-06 03:17:13 +00:00
|
|
|
import pyperclip
|
2023-09-28 06:45:49 +00:00
|
|
|
import pytest
|
|
|
|
from allure_commons._allure import step
|
2024-05-15 06:35:11 +00:00
|
|
|
|
|
|
|
from gui.screens.settings_syncing import SyncingSettingsView
|
2023-12-07 16:47:34 +00:00
|
|
|
from . import marks
|
2023-09-28 06:45:49 +00:00
|
|
|
|
|
|
|
import configs.testpath
|
|
|
|
import constants
|
|
|
|
import driver
|
|
|
|
from constants import UserAccount
|
2023-10-06 03:17:13 +00:00
|
|
|
from constants.syncing import SyncingSettings
|
2023-09-28 06:45:49 +00:00
|
|
|
from gui.components.onboarding.before_started_popup import BeforeStartedPopUp
|
|
|
|
from gui.components.onboarding.beta_consent_popup import BetaConsentPopup
|
2023-11-27 10:44:30 +00:00
|
|
|
from gui.components.settings.sync_new_device_popup import SyncNewDevicePopup
|
2023-09-28 06:45:49 +00:00
|
|
|
from gui.components.splash_screen import SplashScreen
|
|
|
|
from gui.main_window import MainWindow
|
2023-10-06 03:17:13 +00:00
|
|
|
from gui.screens.onboarding import AllowNotificationsView, WelcomeToStatusView, SyncResultView, \
|
2024-04-24 13:29:14 +00:00
|
|
|
SyncCodeView, SyncDeviceFoundView, YourEmojihashAndIdenticonRingView
|
2023-09-28 06:45:49 +00:00
|
|
|
|
2023-12-07 16:47:34 +00:00
|
|
|
pytestmark = marks
|
2023-09-28 06:45:49 +00:00
|
|
|
|
2023-12-22 14:34:36 +00:00
|
|
|
|
2023-10-06 03:17:13 +00:00
|
|
|
@pytest.fixture
|
|
|
|
def sync_screen(main_window) -> SyncCodeView:
|
|
|
|
with step('Open Syncing view'):
|
|
|
|
BeforeStartedPopUp().get_started()
|
|
|
|
wellcome_screen = WelcomeToStatusView().wait_until_appears()
|
|
|
|
return wellcome_screen.sync_existing_user().open_sync_code_view()
|
|
|
|
|
|
|
|
|
2023-09-28 06:45:49 +00:00
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703592', 'Sync device during onboarding')
|
|
|
|
@pytest.mark.case(703592)
|
2024-04-18 17:40:17 +00:00
|
|
|
@pytest.mark.critical
|
2024-03-28 09:19:23 +00:00
|
|
|
def test_sync_device_during_onboarding(multiple_instances):
|
2024-03-28 11:37:24 +00:00
|
|
|
user: UserAccount = constants.user_with_random_attributes_1
|
2023-09-28 06:45:49 +00:00
|
|
|
main_window = MainWindow()
|
|
|
|
|
2024-03-28 09:19:23 +00:00
|
|
|
with multiple_instances(user_data=None) as aut_one, multiple_instances(user_data=None) as aut_two:
|
2023-09-28 06:45:49 +00:00
|
|
|
with step('Get syncing code in first instance'):
|
|
|
|
aut_one.attach()
|
|
|
|
main_window.prepare()
|
|
|
|
main_window.authorize_user(user)
|
|
|
|
sync_settings_view = main_window.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()
|
|
|
|
setup_syncing = main_window.left_panel.open_settings().left_panel.open_syncing_settings().set_up_syncing(
|
|
|
|
user.password)
|
|
|
|
sync_code = setup_syncing.syncing_code
|
|
|
|
setup_syncing.done()
|
|
|
|
main_window.hide()
|
|
|
|
|
|
|
|
with step('Verify syncing code is correct'):
|
|
|
|
sync_code_fields = sync_code.split(':')
|
|
|
|
assert sync_code_fields[0] == 'cs3'
|
|
|
|
assert len(sync_code_fields) == 5
|
|
|
|
|
|
|
|
with step('Open sync code form in second instance'):
|
|
|
|
aut_two.attach()
|
|
|
|
main_window.prepare()
|
|
|
|
BeforeStartedPopUp().get_started()
|
|
|
|
wellcome_screen = WelcomeToStatusView().wait_until_appears()
|
|
|
|
sync_view = wellcome_screen.sync_existing_user().open_sync_code_view()
|
|
|
|
|
|
|
|
with step('Paste sync code on second instance and wait until device is synced'):
|
2023-10-06 03:17:13 +00:00
|
|
|
sync_start = sync_view.open_enter_sync_code_form()
|
2024-04-18 18:09:53 +00:00
|
|
|
pyperclip.copy(sync_code)
|
|
|
|
sync_start.click_paste_button()
|
2023-10-06 03:17:13 +00:00
|
|
|
sync_device_found = SyncDeviceFoundView()
|
2023-11-22 10:42:26 +00:00
|
|
|
assert driver.waitFor(
|
|
|
|
lambda: 'Device found!' in sync_device_found.device_found_notifications, 15000)
|
2023-12-22 14:34:36 +00:00
|
|
|
try:
|
|
|
|
assert driver.waitForObjectExists(SyncResultView().real_name, 15000), \
|
|
|
|
f'Sync result view is not shown within 15 seconds'
|
|
|
|
except (Exception, AssertionError) as ex:
|
|
|
|
raise ex
|
|
|
|
sync_result = SyncResultView()
|
2023-11-22 10:42:26 +00:00
|
|
|
assert driver.waitFor(
|
2024-04-24 13:29:14 +00:00
|
|
|
lambda: 'Device synced!' in sync_result.device_synced_notifications, 23000)
|
2023-10-06 03:17:13 +00:00
|
|
|
assert user.name in sync_device_found.device_found_notifications
|
2023-09-28 06:45:49 +00:00
|
|
|
|
|
|
|
with step('Sign in to synced account'):
|
|
|
|
sync_result.sign_in()
|
2023-10-31 08:34:02 +00:00
|
|
|
SplashScreen().wait_until_hidden()
|
2024-04-24 13:29:14 +00:00
|
|
|
YourEmojihashAndIdenticonRingView().verify_emojihash_view_present().next()
|
|
|
|
if configs.system.IS_MAC:
|
|
|
|
AllowNotificationsView().start_using_status()
|
|
|
|
SplashScreen().wait_until_appears().wait_until_hidden()
|
2023-11-16 10:48:17 +00:00
|
|
|
if not configs.system.TEST_MODE:
|
|
|
|
BetaConsentPopup().confirm()
|
2023-09-28 06:45:49 +00:00
|
|
|
|
|
|
|
with step('Verify user details are the same with user in first instance'):
|
2023-12-22 14:34:36 +00:00
|
|
|
online_identifier = main_window.left_panel.open_online_identifier()
|
|
|
|
assert online_identifier.get_user_name == user.name, \
|
2023-12-23 07:27:34 +00:00
|
|
|
f'Name in online identifier and display name do not match'
|
2023-10-06 03:17:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703631', 'Wrong sync code')
|
|
|
|
@pytest.mark.case(703631)
|
|
|
|
@pytest.mark.parametrize('wrong_sync_code', [
|
|
|
|
pytest.param('9rhfjgfkgfj890tjfgtjfgshjef900')
|
|
|
|
])
|
|
|
|
def test_wrong_sync_code(sync_screen, wrong_sync_code):
|
|
|
|
with step('Open sync code form'):
|
|
|
|
sync_view = sync_screen.open_enter_sync_code_form()
|
|
|
|
|
2024-04-18 18:09:53 +00:00
|
|
|
with step('Paste wrong sync code and check that error message appears'):
|
2023-10-06 03:17:13 +00:00
|
|
|
pyperclip.copy(wrong_sync_code)
|
2024-04-18 18:09:53 +00:00
|
|
|
sync_view.click_paste_button()
|
2023-10-06 03:17:13 +00:00
|
|
|
assert SyncingSettings.SYNC_CODE_IS_WRONG_TEXT.value == sync_view.sync_code_error_message, f'Wrong sync code message did not appear'
|
2023-11-27 10:44:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
@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'):
|
2024-05-15 06:35:11 +00:00
|
|
|
sync_settings_view.click_setup_syncing().close_authenticate_popup()
|
2023-11-27 10:44:30 +00:00
|
|
|
|
2024-05-15 06:35:11 +00:00
|
|
|
with step('Verify that authenticate popup was closed and syncing settings view appears after closing'):
|
|
|
|
SyncingSettingsView().wait_until_appears()
|