11import pytest
22
3- from tests .base_test import BaseTest , lambdatest_reporting
3+ from tests .base_test import BaseTest , cloud_reporting
44from pages .onboarding import (
55 WelcomePage ,
66 AnalyticsPage ,
1717class TestOnboardingImportSeed (BaseTest ):
1818 @pytest .mark .smoke
1919 @pytest .mark .onboarding
20- @lambdatest_reporting
20+ @cloud_reporting
2121 def test_import_and_reimport_seed (self ):
2222 seed_phrase = generate_seed_phrase ()
2323 password = "TestPassword123!"
2424
2525 welcome = WelcomePage (self .driver )
26- assert welcome .is_screen_displayed (timeout = 30 ), "Welcome screen should be visible"
26+ assert welcome .is_screen_displayed (timeout = 30 ), (
27+ "Welcome screen should be visible"
28+ )
2729 assert welcome .click_create_profile (), "Failed to click Create profile"
2830
2931 analytics = AnalyticsPage (self .driver )
@@ -32,18 +34,24 @@ def test_import_and_reimport_seed(self):
3234
3335 create = CreateProfilePage (self .driver )
3436 assert create .is_screen_displayed (), "Create profile screen should be visible"
35- assert create .click_use_recovery_phrase (), "Failed to click Use a recovery phrase"
37+ assert create .click_use_recovery_phrase (), (
38+ "Failed to click Use a recovery phrase"
39+ )
3640
3741 seed_page = SeedPhraseInputPage (self .driver , flow_type = "create" )
38- assert seed_page .is_screen_displayed (), "Seed phrase input (create) should be visible"
42+ assert seed_page .is_screen_displayed (), (
43+ "Seed phrase input (create) should be visible"
44+ )
3945 assert seed_page .import_seed_phrase (seed_phrase ), "Failed to import seed phrase"
4046
4147 password_page = PasswordPage (self .driver )
4248 assert password_page .is_screen_displayed (), "Password screen should be visible"
4349 assert password_page .create_password (password ), "Failed to create password"
4450
4551 splash = SplashScreen (self .driver )
46- assert splash .wait_for_loading_completion (timeout = 60 ), "App did not finish loading"
52+ assert splash .wait_for_loading_completion (timeout = 60 ), (
53+ "App did not finish loading"
54+ )
4755
4856 wallet_locators = WalletLocators ()
4957
@@ -54,7 +62,9 @@ def test_import_and_reimport_seed(self):
5462 base .safe_click (wallet_locators .ACCOUNT_1_BY_TEXT )
5563
5664 # Read the header address displayed (truncated) via wallet header button
57- header_el = base .find_element_safe (wallet_locators .WALLET_HEADER_ADDRESS , timeout = 10 )
65+ header_el = base .find_element_safe (
66+ wallet_locators .WALLET_HEADER_ADDRESS , timeout = 10
67+ )
5868 assert header_el is not None , "Wallet header address button not found"
5969 header_desc = header_el .get_attribute ("content-desc" ) or ""
6070 assert header_desc , "Header content-desc is empty"
@@ -66,22 +76,11 @@ def test_import_and_reimport_seed(self):
6676 )
6777
6878 base_page = base
69- restarted = False
70- try :
71- restarted = base_page .restart_app ("im.status.app" )
72- except Exception :
73- restarted = False
74-
75- if not restarted :
76- try :
77- self .driver .terminate_app ("im.status.app" )
78- self .driver .start_activity (
79- "im.status.app" , "org.qtproject.qt.android.bindings.QtActivity"
80- )
81- except Exception :
82- pass
79+ restarted = base_page .restart_app ()
80+ assert restarted , "Failed to restart app before re-importing seed"
8381
8482 from locators .onboarding .returning_login_locators import ReturningLoginLocators
83+
8584 base = base_page
8685 rel = ReturningLoginLocators ()
8786
@@ -107,22 +106,38 @@ def nudge_user_selector() -> bool:
107106 assert opened , "Returning login user selector did not open"
108107
109108 try :
110- base .safe_click (rel .CREATE_PROFILE_DROPDOWN_ITEM , timeout = 10 , max_attempts = 2 )
109+ base .safe_click (
110+ rel .CREATE_PROFILE_DROPDOWN_ITEM , timeout = 10 , max_attempts = 2
111+ )
111112 except Exception :
112113 el = base .find_element_safe (rel .CREATE_PROFILE_DROPDOWN_ITEM , timeout = 3 )
113114 assert el is not None , "Create profile item not found in dropdown"
114- assert base .gestures .element_tap (el ), "Failed to tap Create profile dropdown item"
115+ assert base .gestures .element_tap (el ), (
116+ "Failed to tap Create profile dropdown item"
117+ )
115118
116119 analytics = AnalyticsPage (self .driver )
117- assert analytics .is_screen_displayed (), "Analytics screen should be visible after choosing Create profile"
120+ assert analytics .is_screen_displayed (), (
121+ "Analytics screen should be visible after choosing Create profile"
122+ )
118123 analytics .skip_analytics_sharing ()
119124
120125 create = CreateProfilePage (self .driver )
121- assert create .is_screen_displayed (), "Create profile screen should be visible (re-import path)"
122- assert create .click_use_recovery_phrase (), "Failed to click Use a recovery phrase (re-import path)"
126+ assert create .is_screen_displayed (), (
127+ "Create profile screen should be visible (re-import path)"
128+ )
129+ assert create .click_use_recovery_phrase (), (
130+ "Failed to click Use a recovery phrase (re-import path)"
131+ )
123132
124133 seed_login = SeedPhraseInputPage (self .driver , flow_type = "create" )
125- assert seed_login .is_screen_displayed (), "Seed phrase screen should be visible (re-import path)"
126- assert seed_login .paste_seed_phrase_via_clipboard (seed_phrase ), "Failed to paste seed phrase (re-import path)"
134+ assert seed_login .is_screen_displayed (), (
135+ "Seed phrase screen should be visible (re-import path)"
136+ )
137+ assert seed_login .paste_seed_phrase_via_clipboard (seed_phrase ), (
138+ "Failed to paste seed phrase (re-import path)"
139+ )
127140
128- assert not seed_login .is_continue_button_enabled (), "Continue should be disabled for already added seed phrase"
141+ assert not seed_login .is_continue_button_enabled (), (
142+ "Continue should be disabled for already added seed phrase"
143+ )
0 commit comments