Files
Mag. 4db0c8bdcf test(e2e-mobile): add iOS support for Appium test framework (#20049)
Make the e2e mobile test framework platform-aware so tests can run on
both Android and iOS devices via BrowserStack.

- Add platform detection and iOS device config entries
- Make Gestures, ElementStateChecker, BasePage, and AppLifecycleManager
  platform-aware
- Strip Android-only capabilities for iOS sessions in BrowserStack provider
- Add cross-platform locator helpers (label_contains, label_exact,
  object_name_contains) and migrate onboarding locators to use them
- Guard Android-only Appium settings for iOS compatibility
- Handle iOS-specific onboarding behavior (auto-advance, objectName locators)
- Add iOS onboarding integration test exercising the full fixture flow
2026-02-24 13:21:14 +00:00

28 lines
1002 B
Python

"""Platform detection utilities for cross-platform test support.
Provides lightweight helpers that read ``platformName`` from the Appium
driver's capabilities at runtime so that framework code can branch on
Android vs iOS without hard-coding assumptions.
"""
def get_platform(driver) -> str:
"""Return the normalised platform name from driver capabilities.
Returns ``"android"`` or ``"ios"`` (lowercase). Falls back to
``"android"`` when the capability is missing or empty — this keeps
existing behaviour unchanged for tests that predate iOS support.
"""
caps = getattr(driver, "capabilities", None) or {}
return (caps.get("platformName") or "android").lower()
def is_ios(driver) -> bool:
"""Return ``True`` when the driver session targets an iOS device."""
return get_platform(driver) == "ios"
def is_android(driver) -> bool:
"""Return ``True`` when the driver session targets an Android device."""
return get_platform(driver) in ("android", "")