diff --git a/appium_kotlin/app/src/test/java/appium_kotlin/tests/MobileElement.kt b/appium_kotlin/app/src/test/java/appium_kotlin/tests/MobileElement.kt index ffb253b01..f3e6112a4 100644 --- a/appium_kotlin/app/src/test/java/appium_kotlin/tests/MobileElement.kt +++ b/appium_kotlin/app/src/test/java/appium_kotlin/tests/MobileElement.kt @@ -18,4 +18,4 @@ class MobileElement private constructor(lazyElement: Lazy<() -> WebElement?>, la } return el } -} \ No newline at end of file +} diff --git a/appium_kotlin/app/src/test/java/appium_kotlin/tests/MobileUtils.kt b/appium_kotlin/app/src/test/java/appium_kotlin/tests/MobileUtils.kt index 631021d5f..fc3064a4d 100644 --- a/appium_kotlin/app/src/test/java/appium_kotlin/tests/MobileUtils.kt +++ b/appium_kotlin/app/src/test/java/appium_kotlin/tests/MobileUtils.kt @@ -1,18 +1,20 @@ package appium_kotlin.tests +import appium_kotlin.LANTERN_PACKAGE_ID import io.appium.java_client.MobileBy import org.openqa.selenium.By -import appium_kotlin.LANTERN_PACKAGE_ID class MobileUtils { - companion object { - fun id(id: String): By { - // MobileBy is optimised for for Android and IOS UIs instead of the generic By mainly for web locators. - return MobileBy.id(addPackageId(id)) - } + companion object { + fun id(id: String): By { + // MobileBy is optimised for for Android and IOS UIs instead of the generic By mainly for web locators. + return MobileBy.id(addPackageId(id)) + } - fun androidTextByBuilder( - text: String, scroll: Boolean = true, searchType: SearchTextOperator = SearchTextOperator.EXACT + fun androidTextByBuilder( + text: String, + scroll: Boolean = true, + searchType: SearchTextOperator = SearchTextOperator.EXACT, ): By { val elementByText = "UiSelector().${searchType.androidUiSelectorTextMethodName}(\"$text\")" val scrollableElement = "UiScrollable(UiSelector().scrollable(true).instance(0)).scrollIntoView($elementByText)" @@ -25,15 +27,15 @@ class MobileUtils { return MobileBy.AndroidUIAutomator(selector) } - enum class SearchTextOperator(val androidUiSelectorTextMethodName: String, val iOSOperator: String) { - MATCHES("textMatches", "MATCHES"), - EXACT("text", "=="), - CONTAINS("textContains", "CONTAINS"), - STARTS_WITH("textStartsWith", "BEGINSWITH") - } + enum class SearchTextOperator(val androidUiSelectorTextMethodName: String, val iOSOperator: String) { + MATCHES("textMatches", "MATCHES"), + EXACT("text", "=="), + CONTAINS("textContains", "CONTAINS"), + STARTS_WITH("textStartsWith", "BEGINSWITH"), + } private fun addPackageId(id: String): String { return if (id.contains(":")) id else "${LANTERN_PACKAGE_ID}$id" } - } -} \ No newline at end of file + } +}