-
Notifications
You must be signed in to change notification settings - Fork 87
e2e_appium/backup recovery phrase #18796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7c01d33
test(e2e_appium): locators
glitchminer d2fd3fd
test(e2e_appium): pages
glitchminer 344cacd
test(e2e_appium): tests
glitchminer a746071
test(e2e_appium): core
glitchminer 397bfcd
test(e2e_appium): utils
glitchminer ccbddeb
test(e2e_appium): workflow
glitchminer 0129ec7
test(e2e_appium): test_saved_addresses
glitchminer cc819c0
test(e2e_appium): test_onboarding_import_seed (#18852)
glitchminer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
from .config.logging_config import get_logger | ||
from .core import EnvironmentSwitcher | ||
from .utils.lambdatest_reporter import LambdaTestReporter | ||
from .utils.screenshot import save_screenshot, save_page_source | ||
|
||
|
||
# Expose fixture modules without star imports | ||
|
@@ -161,6 +162,51 @@ def pytest_runtest_makereport(item, call): | |
logger = get_logger("session") | ||
logger.error(f"Failed to report test result to LambdaTest: {e}") | ||
|
||
# Get screenshot and page source artifacts | ||
try: | ||
if getattr(rep, "failed", False) and not getattr(item, "_failure_artifacts_saved", False): | ||
driver = None | ||
try: | ||
if hasattr(item, "instance") and hasattr(item.instance, "driver"): | ||
driver = item.instance.driver | ||
except Exception: | ||
driver = None | ||
|
||
if driver: | ||
# Resolve screenshots directory from environment config; fallback to 'screenshots' | ||
try: | ||
env_name = os.getenv("CURRENT_TEST_ENVIRONMENT", "lambdatest") | ||
switcher = EnvironmentSwitcher() | ||
env_config = switcher.switch_to(env_name) | ||
screenshots_dir = env_config.directories.get("screenshots", "screenshots") | ||
except Exception: | ||
screenshots_dir = "screenshots" | ||
|
||
test_id = getattr(item, "name", "test") + (f"__{rep.when}" if getattr(rep, "when", None) else "") | ||
|
||
s_path = None | ||
x_path = None | ||
try: | ||
s_path = save_screenshot(driver, str(screenshots_dir), f"FAILED_{test_id}") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exceptions could be logged! |
||
except Exception: | ||
pass | ||
try: | ||
x_path = save_page_source(driver, str(screenshots_dir), f"FAILED_{test_id}") | ||
except Exception: | ||
pass | ||
|
||
log = get_logger("conftest") | ||
if s_path: | ||
log.info(f"Saved failure screenshot: {s_path}") | ||
if x_path: | ||
log.info(f"Saved failure page source: {x_path}") | ||
|
||
setattr(item, "_failure_artifacts_saved", True) | ||
except Exception as e: | ||
log = get_logger("conftest") | ||
log.warning(f"Artifact capture failed: {e}") | ||
|
||
|
||
def pytest_terminal_summary(terminalreporter, exitstatus, config): | ||
if not _logging_setup: | ||
return | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from dataclasses import dataclass, field | ||
from typing import Dict, Any, Optional | ||
|
||
|
||
@dataclass | ||
class TestUser: | ||
display_name: str | ||
password: str = "StatusPassword123!" | ||
seed_phrase: Optional[str] = None | ||
source: str = "created" | ||
|
||
def to_dict(self) -> Dict[str, Any]: | ||
return { | ||
"display_name": self.display_name, | ||
"password": self.password, | ||
"seed_phrase": self.seed_phrase, | ||
"source": self.source, | ||
} | ||
|
||
|
||
@dataclass | ||
class TestAppState: | ||
is_home_loaded: bool = False | ||
current_screen: str = "unknown" | ||
requires_authentication: bool = False | ||
has_existing_profiles: bool = False | ||
|
||
|
||
@dataclass | ||
class TestConfiguration: | ||
environment: str = "lambdatest" | ||
profile_method: str = "password" | ||
display_name: str = "TestUser" | ||
validate_steps: bool = True | ||
take_screenshots: bool = False | ||
custom_config: Dict[str, Any] = field(default_factory=dict) | ||
device_override: Optional[Dict[str, Any]] = None | ||
|
||
@classmethod | ||
def from_pytest_marker(cls, request, marker_name: str) -> "TestConfiguration": | ||
config = cls() | ||
for marker in request.node.iter_markers(): | ||
if marker.name == marker_name: | ||
for key, value in marker.kwargs.items(): | ||
if hasattr(config, key): | ||
setattr(config, key, value) | ||
else: | ||
config.custom_config[key] = value | ||
break | ||
return config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Use consistent timeout keys