Package core.helpers

Class MobileHelper


  • public class MobileHelper
    extends Object
    • Constructor Detail

      • MobileHelper

        public MobileHelper()
    • Method Detail

      • getAppiumDriver

        public io.appium.java_client.AppiumDriver getAppiumDriver()
      • getAndroidDriver

        public io.appium.java_client.android.AndroidDriver getAndroidDriver()
      • getiOSDriver

        public io.appium.java_client.ios.IOSDriver getiOSDriver()
      • hideKeyboard

        public void hideKeyboard()
        hides ios or android keyboard
      • smartHideKeyboard

        public void smartHideKeyboard​(EnhancedBy element)
        if element is not visible, attempt to hide keyboard
        Parameters:
        element -
      • pressEnterOnAndroid

        public void pressEnterOnAndroid()
        select enter on android
      • resetApp

        public void resetApp​(String iosAppId)
      • resetApp

        public void resetApp​(String androidId,
                             String iosAppId)
        resets the app ios requires app id android package is automatically provided
      • refreshMobileApp

        public void refreshMobileApp()
        places the app in background And Then relaunches it
      • isMobile

        public boolean isMobile()
        returns if mobile driver is used
        Returns:
      • isIOS

        public boolean isIOS()
        is ios driver
        Returns:
      • isAndroid

        public boolean isAndroid()
        is ios driver
        Returns:
      • isWinApp

        public boolean isWinApp()
        is win app driver
        Returns:
      • isWebDriver

        public boolean isWebDriver()
        is web driver
        Returns:
      • isIeExplorer

        public boolean isIeExplorer()
        returns true if browser is ie
        Returns:
      • setLocation

        public void setLocation​(org.openqa.selenium.html5.Location location)
        sets gps location on ios simulator
        Parameters:
        location -
      • mobile_swipeRight

        public void mobile_swipeRight​(double durationInSeconds)
        swipe right on the screen
      • mobile_swipeRight

        public void mobile_swipeRight​(EnhancedBy element,
                                      int index,
                                      double durationInSeconds)
        swipe right on the screen
      • mobile_swipeLeft

        public void mobile_swipeLeft​(double durationInSeconds)
        swipe right using actions
        Parameters:
        durationInSeconds -
      • mobile_swipeLeft

        public void mobile_swipeLeft​(EnhancedBy element,
                                     int index,
                                     double durationInSeconds)
        swipe left on the screen
      • mobile_swipeUp

        public void mobile_swipeUp​(double durationInSeconds)
        swipe up using actions
        Parameters:
        durationInSeconds -
      • mobile_swipeUp

        public void mobile_swipeUp​(EnhancedBy element,
                                   int index,
                                   double durationInSeconds)
        swipe up on the screen
      • mobile_swipeDown

        public void mobile_swipeDown​(double durationInSeconds)
        swipe down using actions
        Parameters:
        durationInSeconds -
      • mobile_swipeDown

        public void mobile_swipeDown​(EnhancedBy element,
                                     int index,
                                     double durationInSeconds)
        swipe down on the screen
      • findImageOccurrence

        public io.appium.java_client.imagecomparison.OccurrenceMatchingResult findImageOccurrence​(File fullImage,
                                                                                                  File partialImage)
        returns the occurrences of image based on partial image
        Parameters:
        fullImage -
        partialImage -
        Returns:
      • setAppiumContexts

        public void setAppiumContexts​(String context)
        set context for android And ios apps
        Parameters:
        context -
      • mobile_getContextList

        public Set<String> mobile_getContextList()
        returns the list of mobile context. eg. webview, native view
        Returns:
      • mobile_switchToNativeView

        public void mobile_switchToNativeView()
      • mobile_switchToWebView

        public void mobile_switchToWebView()
      • mobile_switchToView

        public void mobile_switchToView​(String view)
      • switchWindowsHandle

        public void switchWindowsHandle​(int index)
      • mobile_longPress

        public void mobile_longPress​(EnhancedBy target,
                                     long miliSeconds)
      • mobile_longPressAndExpect

        public void mobile_longPressAndExpect​(EnhancedBy target,
                                              long miliSeconds,
                                              EnhancedBy expected)
        long press And expect element
        Parameters:
        target -
        miliSeconds -
        expected -
      • longPress

        public void longPress​(EnhancedBy target,
                              long miliSeconds)
        TODO: enhance to become longpress And expect presses the target element
        Parameters:
        target -
        index -
        miliSeconds -
        expected -
      • longPress

        public void longPress​(int x,
                              int y,
                              long miliSeconds)
      • mobile_zoomOut

        public void mobile_zoomOut​(int zoomLevel)
      • mobile_zoomOut

        public void mobile_zoomOut​(EnhancedBy indicator)
        zooms out And checks if target level indicator has been reached
        Parameters:
        zoomLevel -
        indicator -
      • mobile_zoomIn

        public void mobile_zoomIn​(EnhancedBy indicator)
        zooms in And checks if target level indicator has been reached
        Parameters:
        zoomLevel -
        indicator -
      • mobile_zoomIn

        public void mobile_zoomIn​(int zoomLevel)
      • mobile_zoom

        public void mobile_zoom​(String inOut)
        pass in "in" or "out" to zoom in or out
        Parameters:
        inOut -
      • scrollDown

        public void scrollDown()
        scrolls down android left side of display
      • scrollDownFromCenter

        public void scrollDownFromCenter()
      • scroll

        public void scroll​(int fromX,
                           int fromY,
                           int toX,
                           int toY)
      • mobile_scrollToElement

        public void mobile_scrollToElement​(EnhancedBy target)
        scrolls to mobile element until element becomes visible
        Parameters:
        target -
      • mobile_scrollToElementWithRefresh

        public void mobile_scrollToElementWithRefresh​(EnhancedBy target)
      • mobile_takePicture

        public void mobile_takePicture()
      • mobile_keyCode

        public void mobile_keyCode​(int code)
      • mobile_backButton

        public void mobile_backButton()
      • tapAtCenterLeft

        public void tapAtCenterLeft()
      • tapAtCenterRight

        public void tapAtCenterRight()