Skip to content

Commit 4ccd686

Browse files
committed
refactor(e2e_appium): migrate to cloud reporting and enhance test assertions
- Replaced instances of LambdaTest reporting with Cloud reporting - Assertion messages for clarity - Updated test methods for toast handling
1 parent d9b8d88 commit 4ccd686

File tree

5 files changed

+91
-60
lines changed

5 files changed

+91
-60
lines changed

test/e2e_appium/tests/test_backup_recovery_phrase.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import os
22
import pytest
33

4-
from tests.base_test import BaseAppReadyTest, lambdatest_reporting
4+
from tests.base_test import BaseAppReadyTest, cloud_reporting
55
from utils.screenshot import save_page_source
66
from pages.app import App
77

88

99
class TestBackupRecoveryPhrase(BaseAppReadyTest):
1010
@pytest.mark.critical
11-
@lambdatest_reporting
11+
@cloud_reporting
1212
def test_sign_out_from_settings(self):
1313
# BaseAppReadyTest ensures authenticated home
1414

@@ -33,7 +33,7 @@ def test_sign_out_from_settings(self):
3333
[pytest.param(True, id="delete")],
3434
)
3535
@pytest.mark.smoke
36-
@lambdatest_reporting
36+
@cloud_reporting
3737
def test_backup_recovery_phrase_flow(self, remove_phrase):
3838
# BaseAppReadyTest ensures home; open Settings (left-nav preferred)
3939
opened = self.ctx.app.click_settings_left_nav()
@@ -72,10 +72,12 @@ def test_backup_recovery_phrase_flow(self, remove_phrase):
7272

7373
# Verify toast appears and assert content-desc contains expected phrase (no fallbacks)
7474
app = App(self.driver)
75-
assert app.is_toast_present(timeout=3), (
76-
"Expected a toast to appear after backup completion"
75+
keep_msg = app.wait_for_toast(
76+
expected_substring="backed up your recovery phrase",
77+
timeout=8,
78+
stability=0.2,
7779
)
78-
keep_msg = app.get_toast_content_desc(timeout=10) or ""
80+
assert keep_msg, "Expected a toast to appear after backup completion"
7981
assert "backed up your recovery phrase" in keep_msg.lower()
8082

8183
# Capture final state XML for reference
@@ -107,10 +109,12 @@ def test_backup_recovery_phrase_flow(self, remove_phrase):
107109
)
108110

109111
# Verify toast after delete via content-desc substring (no fallbacks) BEFORE checking entry removal
110-
assert app.is_toast_present(timeout=5), (
111-
"Expected a toast to appear after deletion"
112+
delete_msg = app.wait_for_toast(
113+
expected_substring="recovery phrase permanently removed",
114+
timeout=8,
115+
stability=0.2,
112116
)
113-
delete_msg = app.get_toast_content_desc(timeout=5) or ""
117+
assert delete_msg, "Expected a toast to appear after deletion"
114118
assert "recovery phrase permanently removed" in delete_msg.lower()
115119

116120
# After toast, verify entry removal

test/e2e_appium/tests/test_onboarding_flow.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"""
77

88
import pytest
9-
from tests.base_test import BaseTest, lambdatest_reporting
9+
from tests.base_test import BaseTest, cloud_reporting
1010

1111

1212
class TestOnboardingFlow(BaseTest):
@@ -15,7 +15,7 @@ class TestOnboardingFlow(BaseTest):
1515
@pytest.mark.smoke
1616
@pytest.mark.onboarding
1717
@pytest.mark.e2e
18-
@lambdatest_reporting
18+
@cloud_reporting
1919
@pytest.mark.onboarding_config(
2020
custom_display_name="E2E_TestUser",
2121
skip_analytics=True,
@@ -55,7 +55,7 @@ def test_onboarding_new_password_skip_analytics(self, onboarded_user):
5555
self.logger.info("Complete onboarding flow test with fixture passed!")
5656

5757
@pytest.mark.onboarding
58-
@lambdatest_reporting
58+
@cloud_reporting
5959
@pytest.mark.onboarding_config(custom_display_name="E2E_TestUser")
6060
def test_onboarding_lands_on_main_app(self, onboarded_app):
6161
app = onboarded_app

test/e2e_appium/tests/test_onboarding_import_seed.py

Lines changed: 44 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22

3-
from tests.base_test import BaseTest, lambdatest_reporting
3+
from tests.base_test import BaseTest, cloud_reporting
44
from pages.onboarding import (
55
WelcomePage,
66
AnalyticsPage,
@@ -17,13 +17,15 @@
1717
class 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+
)
Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22

3-
from tests.base_test import BaseAppReadyTest, lambdatest_reporting
3+
from tests.base_test import BaseAppReadyTest, cloud_reporting
44
from utils.generators import generate_ethereum_address, generate_account_name
55
from pages.wallet.add_saved_address_modal import AddSavedAddressModal
66
from pages.app import App
@@ -10,19 +10,24 @@
1010

1111

1212
class TestSavedAddresses(BaseAppReadyTest):
13-
1413
@pytest.mark.wallet
1514
@pytest.mark.saved_addresses
1615
@pytest.mark.smoke
17-
@lambdatest_reporting
16+
@cloud_reporting
1817
def test_add_and_remove_saved_address(self):
19-
assert self.ctx.app.safe_click(AppLocators().LEFT_NAV_WALLET, timeout=6), "Failed to open Wallet"
18+
assert self.ctx.app.safe_click(AppLocators().LEFT_NAV_WALLET, timeout=6), (
19+
"Failed to open Wallet"
20+
)
2021
loc = SavedAddressesLocators()
21-
assert self.ctx.app.safe_click(loc.WALLET_SAVED_ADDRESSES_BUTTON), "Failed to open Saved addresses from Wallet"
22+
assert self.ctx.app.safe_click(loc.WALLET_SAVED_ADDRESSES_BUTTON), (
23+
"Failed to open Saved addresses from Wallet"
24+
)
2225
saved_addresses = SavedAddressesPage(self.driver)
2326
assert saved_addresses.is_loaded(timeout=10), "Saved Addresses view not opened"
24-
25-
assert saved_addresses.open_add_saved_address_modal(), "Add Saved Address modal button not clickable"
27+
28+
assert saved_addresses.open_add_saved_address_modal(), (
29+
"Add Saved Address modal button not clickable"
30+
)
2631
modal = AddSavedAddressModal(self.driver)
2732
assert modal.is_displayed(timeout=10), "Add Saved Address modal did not appear"
2833

@@ -33,15 +38,23 @@ def test_add_and_remove_saved_address(self):
3338
app = App(self.driver)
3439
assert app.is_toast_present(timeout=5), "Expected toast after saving address"
3540
toast_text = app.get_toast_content_desc(timeout=10) or ""
36-
assert "successfully added" in toast_text.lower(), f"Unexpected toast: '{toast_text}'"
41+
assert "successfully added" in toast_text.lower(), (
42+
f"Unexpected toast: '{toast_text}'"
43+
)
3744

38-
assert saved_addresses.is_entry_visible(name, timeout=30), f"Saved address '{name}' not visible in list"
45+
assert saved_addresses.is_entry_visible(name, timeout=30), (
46+
f"Saved address '{name}' not visible in list"
47+
)
3948

40-
assert saved_addresses.open_details(name), "Failed to open saved address details"
41-
assert saved_addresses.delete_saved_address_with_confirmation(name), "Failed to delete saved address via details menu"
49+
assert saved_addresses.open_details(name), (
50+
"Failed to open saved address details"
51+
)
52+
assert saved_addresses.delete_saved_address_with_confirmation(name), (
53+
"Failed to delete saved address via details menu"
54+
)
4255

4356
app = App(self.driver)
4457
_ = app.get_toast_content_desc(timeout=5)
45-
assert not saved_addresses.is_entry_visible(name, timeout=10), f"Saved address '{name}' still visible after deletion"
46-
47-
58+
assert not saved_addresses.is_entry_visible(name, timeout=10), (
59+
f"Saved address '{name}' still visible after deletion"
60+
)

test/e2e_appium/tests/test_settings_password_change_password.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
from constants import AppSections
44
from locators.onboarding.wallet.wallet_locators import WalletLocators
5-
from tests.base_test import BaseAppReadyTest, lambdatest_reporting
5+
from tests.base_test import BaseAppReadyTest, cloud_reporting
66
from utils.generators import generate_secure_password
77

88

99
class TestSettingsPasswordChange(BaseAppReadyTest):
1010
@pytest.mark.critical
1111
@pytest.mark.smoke
12-
@lambdatest_reporting
12+
@cloud_reporting
1313
def test_change_password_and_login(self):
1414
assert self.ctx.app.click_settings_left_nav(), "Failed to open Settings"
1515
assert self.ctx.settings.is_loaded(), "Settings not detected"
@@ -25,9 +25,7 @@ def test_change_password_and_login(self):
2525
pass
2626

2727
modal = password_settings.change_password(old_password, new_password)
28-
assert modal and modal.is_displayed(), (
29-
"Change password modal did not appear"
30-
)
28+
assert modal and modal.is_displayed(), "Change password modal did not appear"
3129
assert modal.complete_reencrypt_and_restart(), (
3230
"Failed to complete password re-encryption flow"
3331
)
@@ -38,6 +36,7 @@ def test_change_password_and_login(self):
3836
assert self.ctx.welcome_back.perform_login(new_password), (
3937
"Unable to authenticate after restart with the new password"
4038
)
39+
4140
locators = WalletLocators()
4241
assert self.ctx.app.is_element_visible(
4342
locators.WALLET_FOOTER_SEND_BUTTON, timeout=15

0 commit comments

Comments
 (0)