From 4c39347add0642db3f7283ab9ddeac7f565cad25 Mon Sep 17 00:00:00 2001 From: atavism Date: Sat, 9 Sep 2023 16:24:45 -0700 Subject: [PATCH 01/13] Add initial GooglePlayTest --- .../appium_kotlin/tests/GooglePlayTest.kt | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt diff --git a/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt b/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt new file mode 100644 index 000000000..868481051 --- /dev/null +++ b/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt @@ -0,0 +1,106 @@ +package appium_kotlin.tests + +import appium_kotlin.ACCOUNT_MANAGEMENT +import appium_kotlin.ACCOUNT_RENEW +import appium_kotlin.ACCOUNT_TAP +import appium_kotlin.CARD_NUMBER +import appium_kotlin.CHECK_OUT +import appium_kotlin.CHROME_PACKAGE_ACTIVITY +import appium_kotlin.CHROME_PACKAGE_ID +import appium_kotlin.CVC +import appium_kotlin.ContextType +import appium_kotlin.ERROR_PAYMENT_PURCHASE +import appium_kotlin.IP_REQUEST_URL +import appium_kotlin.LANTERN_PACKAGE_ID +import appium_kotlin.LOGS_DIALED_MESSAGE +import appium_kotlin.MMYY +import appium_kotlin.MOST_POPULAR +import appium_kotlin.PAYMENT_PURCHASE_COMPLETED +import appium_kotlin.RENEWAL_SUCCESS_OK +import appium_kotlin.REPORT_AN_ISSUE +import appium_kotlin.REPORT_DESCRIPTION +import appium_kotlin.REPORT_ISSUE_SUCCESS +import appium_kotlin.SEND_REPORT +import appium_kotlin.SUPPORT +import io.appium.java_client.MobileBy +import io.appium.java_client.MobileElement +import io.appium.java_client.TouchAction +import io.appium.java_client.android.Activity +import io.appium.java_client.android.AndroidDriver +import io.appium.java_client.android.nativekey.AndroidKey +import io.appium.java_client.android.nativekey.KeyEvent +import io.appium.java_client.touch.WaitOptions +import io.appium.java_client.touch.offset.PointOption +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.MethodSource +import org.openqa.selenium.By +import org.openqa.selenium.logging.LogEntries +import pro.truongsinh.appium_flutter.FlutterFinder +import java.io.IOException +import java.time.Duration +import java.time.LocalDate +import java.time.format.DateTimeFormatter +import java.util.concurrent.TimeUnit +import java.util.regex.Pattern + +class GooglePlayTest() : BaseTest() { + + private var driver: AndroidDriver? = null + private val testAppName = "ccleaner" + + @ParameterizedTest + @MethodSource("devices") + fun userJourneyTests(taskId: Int) { + driver = setupAndCreateConnection(taskId) + } + + fun testEstablishPlaySession() { + val activity = driver.activity + val package = driver.package + Assertions.assertEquals(package, "com.android.vending") + Assertions.assertEquals(activity, "org.getlantern.lantern") + } + + fun testGooglePlayFeatures() { + driver.findElement(By.xpath("/android.widget.FrameLayout[@content-desc = 'Show navigation drawer']")).click() + val elements = driver.findElements(By.xpath("//android.widget.TextView")) + for (element in elements) { + element.text.equals("Settings").let? { + it.click() + break + } + } + } + + fun openSearchForm() { + val elements = driver.findElements(By.xpath("//android.widget.TextView")) + for (element in elements) { + element.text.equals("Search for apps & games").let? { + it.click() + break + } + } + } + + Throws(Exception::class) + fun testInstallAppPlayStore() { + openSearchForm() + driver.findElement(MobileBy.className("android.widget.EditText")).sendKeys(testAppName) + + driver.findElement(By.xpath("//android.support.v7.widget.RecyclerView[1]/android.widget.LinearLayout[1]")).click() + + val button = driver.findElement(MobileBy.className("android.widget.Button")) + if (button.text.equals("Install")) { + println("Installing application") + button.click() + } else { + println("Opening application") + button.click() + } + + driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS) + driver.pressKey(KeyEvent(AndroidKey.HOME)) + driver.closeApp() + } +} \ No newline at end of file From fe7cffd7b3a116630354507dabb0603088a2b227 Mon Sep 17 00:00:00 2001 From: atavism Date: Sat, 9 Sep 2023 16:26:49 -0700 Subject: [PATCH 02/13] Add initial GooglePlayTest --- .../app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt b/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt index 868481051..82f35d9ba 100644 --- a/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt +++ b/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt @@ -53,6 +53,9 @@ class GooglePlayTest() : BaseTest() { @MethodSource("devices") fun userJourneyTests(taskId: Int) { driver = setupAndCreateConnection(taskId) + testEstablishPlaySession() + testGooglePlayFeatures() + testInstallAppPlayStore() } fun testEstablishPlaySession() { From b13aaa581604e996314483f1d43d6cd17b992043 Mon Sep 17 00:00:00 2001 From: atavism Date: Sun, 10 Sep 2023 13:46:27 -0700 Subject: [PATCH 03/13] Updates to google play tests --- .../appium_kotlin/tests/GooglePlayTest.kt | 144 ++++++++---------- 1 file changed, 65 insertions(+), 79 deletions(-) diff --git a/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt b/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt index 82f35d9ba..3bf6f99cc 100644 --- a/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt +++ b/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt @@ -1,109 +1,95 @@ package appium_kotlin.tests -import appium_kotlin.ACCOUNT_MANAGEMENT -import appium_kotlin.ACCOUNT_RENEW -import appium_kotlin.ACCOUNT_TAP -import appium_kotlin.CARD_NUMBER -import appium_kotlin.CHECK_OUT -import appium_kotlin.CHROME_PACKAGE_ACTIVITY -import appium_kotlin.CHROME_PACKAGE_ID -import appium_kotlin.CVC -import appium_kotlin.ContextType -import appium_kotlin.ERROR_PAYMENT_PURCHASE -import appium_kotlin.IP_REQUEST_URL -import appium_kotlin.LANTERN_PACKAGE_ID -import appium_kotlin.LOGS_DIALED_MESSAGE -import appium_kotlin.MMYY -import appium_kotlin.MOST_POPULAR -import appium_kotlin.PAYMENT_PURCHASE_COMPLETED -import appium_kotlin.RENEWAL_SUCCESS_OK -import appium_kotlin.REPORT_AN_ISSUE -import appium_kotlin.REPORT_DESCRIPTION -import appium_kotlin.REPORT_ISSUE_SUCCESS -import appium_kotlin.SEND_REPORT -import appium_kotlin.SUPPORT import io.appium.java_client.MobileBy -import io.appium.java_client.MobileElement -import io.appium.java_client.TouchAction -import io.appium.java_client.android.Activity import io.appium.java_client.android.AndroidDriver import io.appium.java_client.android.nativekey.AndroidKey import io.appium.java_client.android.nativekey.KeyEvent -import io.appium.java_client.touch.WaitOptions -import io.appium.java_client.touch.offset.PointOption +import io.appium.java_client.remote.AndroidMobileCapabilityType import org.junit.jupiter.api.Assertions import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.MethodSource import org.openqa.selenium.By -import org.openqa.selenium.logging.LogEntries -import pro.truongsinh.appium_flutter.FlutterFinder -import java.io.IOException -import java.time.Duration -import java.time.LocalDate -import java.time.format.DateTimeFormatter +import org.openqa.selenium.remote.DesiredCapabilities import java.util.concurrent.TimeUnit -import java.util.regex.Pattern class GooglePlayTest() : BaseTest() { - private var driver: AndroidDriver? = null - private val testAppName = "ccleaner" + private val testAppName = "chromecast" + private val testAppPackage = "com.google.android.apps.chromecast.app" + private val testAppActivity = ".DiscoveryActivity" @ParameterizedTest @MethodSource("devices") - fun userJourneyTests(taskId: Int) { - driver = setupAndCreateConnection(taskId) - testEstablishPlaySession() - testGooglePlayFeatures() - testInstallAppPlayStore() - } + fun userJourneyTests(taskId: Int) { + val driver = setupAndCreateConnection(taskId) + val capabilities = DesiredCapabilities() + capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.android.vending") + capabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, ".AssetBrowserActivity") + capabilities.setCapability(AndroidMobileCapabilityType.APP_WAIT_ACTIVITY, ".AssetBrowserActivity") + capabilities.setCapability(AndroidMobileCapabilityType.DEVICE_READY_TIMEOUT, 40) + testEstablishPlaySession(driver) + testGooglePlayFeatures(driver) + installAppFromPlayStore(driver) + } - fun testEstablishPlaySession() { - val activity = driver.activity - val package = driver.package - Assertions.assertEquals(package, "com.android.vending") - Assertions.assertEquals(activity, "org.getlantern.lantern") - } + fun testEstablishPlaySession(driver: AndroidDriver) { + Assertions.assertEquals(driver.currentPackage, "com.android.vending") + Assertions.assertEquals(driver.currentActivity(), "org.getlantern.lantern") + } - fun testGooglePlayFeatures() { - driver.findElement(By.xpath("/android.widget.FrameLayout[@content-desc = 'Show navigation drawer']")).click() - val elements = driver.findElements(By.xpath("//android.widget.TextView")) - for (element in elements) { - element.text.equals("Settings").let? { - it.click() - break - } - } - } + fun testGooglePlayFeatures(driver: AndroidDriver) { + driver.findElement(By.xpath("/android.widget.FrameLayout[@content-desc = 'Show navigation drawer']"))?.click() + val elements = driver.findElements(By.xpath("//android.widget.TextView")) + if (elements == null) return + for (element in elements) { + if (element.text.equals("Settings")) { + element.click() + break + } + } + } - fun openSearchForm() { - val elements = driver.findElements(By.xpath("//android.widget.TextView")) - for (element in elements) { - element.text.equals("Search for apps & games").let? { - it.click() - break - } - } - } + fun openSearchForm(driver: AndroidDriver) { + val elements = driver?.findElements(By.xpath("//android.widget.TextView")) + if (elements == null) return + for (element in elements) { + if (element.text.equals("Search for apps & games")) { + element.click() + break + } + } + } - Throws(Exception::class) - fun testInstallAppPlayStore() { - openSearchForm() - driver.findElement(MobileBy.className("android.widget.EditText")).sendKeys(testAppName) + @Throws(Exception::class) + fun installAppFromPlayStore(driver: AndroidDriver) { + openSearchForm(driver) + driver.findElement(MobileBy.className("android.widget.EditText"))?.sendKeys(testAppName) - driver.findElement(By.xpath("//android.support.v7.widget.RecyclerView[1]/android.widget.LinearLayout[1]")).click() + driver.findElement(By.xpath("//android.support.v7.widget.RecyclerView[1]/android.widget.LinearLayout[1]"))?.click() val button = driver.findElement(MobileBy.className("android.widget.Button")) - if (button.text.equals("Install")) { - println("Installing application") - button.click() + if (button?.text.equals("Install")) { + println("Installing application") + button?.click() } else { - println("Opening application") - button.click() + println("Opening application") + button?.click() } driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS) driver.pressKey(KeyEvent(AndroidKey.HOME)) driver.closeApp() - } -} \ No newline at end of file + } + + @Throws(Exception::class) + fun installedAppCaps(): DesiredCapabilities { + val capabilities = DesiredCapabilities() + capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, testAppPackage) + capabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, testAppActivity) + capabilities.setCapability(AndroidMobileCapabilityType.APP_WAIT_ACTIVITY, testAppActivity) + capabilities.setCapability(AndroidMobileCapabilityType.DEVICE_READY_TIMEOUT, 40) + capabilities.setCapability("deviceOrientation", "portrait") + capabilities.setCapability("autoLaunch", "false") + return capabilities + } +} From 2e99918244bbfebf81e24cc4ce7410684430bb16 Mon Sep 17 00:00:00 2001 From: atavism Date: Sun, 10 Sep 2023 14:12:27 -0700 Subject: [PATCH 04/13] Updates to google play tests --- .../test/java/appium_kotlin/tests/BaseTest.kt | 79 ++++++++++--------- .../appium_kotlin/tests/GooglePlayTest.kt | 31 +++++--- 2 files changed, 64 insertions(+), 46 deletions(-) diff --git a/appium_kotlin/app/src/test/java/appium_kotlin/tests/BaseTest.kt b/appium_kotlin/app/src/test/java/appium_kotlin/tests/BaseTest.kt index 9f8c09e40..15d446bed 100644 --- a/appium_kotlin/app/src/test/java/appium_kotlin/tests/BaseTest.kt +++ b/appium_kotlin/app/src/test/java/appium_kotlin/tests/BaseTest.kt @@ -4,7 +4,6 @@ import appium_kotlin.ContextType import com.google.gson.JsonArray import com.google.gson.JsonObject import com.google.gson.JsonParser -import io.appium.java_client.AppiumDriver import io.appium.java_client.android.AndroidDriver import io.appium.java_client.service.local.AppiumDriverLocalService import io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException @@ -16,10 +15,8 @@ import org.junit.jupiter.api.parallel.ExecutionMode import org.junit.jupiter.params.provider.MethodSource import org.openqa.selenium.JavascriptExecutor import org.openqa.selenium.remote.DesiredCapabilities -import pro.truongsinh.appium_flutter.FlutterFinder import java.io.FileReader import java.net.URL -import java.util.concurrent.TimeUnit import java.util.stream.Stream /** Here is the device list-:https://www.browserstack.com/list-of-browsers-and-platforms/app_automate */ @@ -31,7 +28,6 @@ open class BaseTest { lateinit var config: JsonObject lateinit var service: AppiumDriverLocalService - @JvmStatic @MethodSource("devices") fun devices(): Stream { @@ -54,33 +50,14 @@ open class BaseTest { } } - fun setupAndCreateConnection(taskId: Int): AndroidDriver { - println("Setup and creating connection for TaskId: $taskId") + // Initialize DesiredCapabilities + fun initialCapabilities(taskId: Int): DesiredCapabilities { // Initialize DesiredCapabilities val capabilities = DesiredCapabilities() // Get common capabilities from config val commonCapabilities = config["capabilities"] as JsonObject - // Get environment variables if available or get from config - val username = System.getenv("BROWSERSTACK_USERNAME") ?: config.get("username").asString - val accessKey = - System.getenv("BROWSERSTACK_ACCESS_KEY") ?: config.get("access_key").asString val app = System.getenv("BROWSERSTACK_APP_ID") ?: config.get("app").asString - val server = System.getenv("SERVER") ?: config.get("server").asString - // Check if it is a local run - val isLocalRun = (System.getenv("RUN_ENV") ?: "local") == "local" val envs = config["environments"] as JsonArray - // If local run, start Appium Server - if (isLocalRun) { - // Start Appium Server for local run - service = AppiumServiceBuilder() - .withArgument(GeneralServerFlag.ALLOW_INSECURE, "chromedriver_autodownload") - .build() - service.start() - - if (!service.isRunning) { - throw AppiumServerHasNotBeenStartedLocallyException("An appium server node is not started!") - } - } // Iterate over common capabilities val it = commonCapabilities.entrySet().iterator() @@ -103,7 +80,7 @@ open class BaseTest { if (capabilities.getCapability(pair.key.toString()) == null) { capabilities.setCapability( pair.key.toString(), - pair.value.toString().replace("\"", "") + pair.value.toString().replace("\"", ""), ) } } @@ -112,7 +89,6 @@ open class BaseTest { // capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "Flutter") println("Setup for TaskId $taskId: $capabilities") - val envCapabilities = envs[taskId] as JsonObject println("TaskId: $taskId | Current Evn $envCapabilities") @@ -120,15 +96,50 @@ open class BaseTest { envCapabilities.entrySet().iterator().forEach { pair -> capabilities.setCapability(pair.key, pair.value.toString().replace("\"", "")) } - val url = if (isLocalRun) { + return capabilities + } + + // Check if it is a local run + fun checkLocalRun(): Boolean { + val isLocalRun = (System.getenv("RUN_ENV") ?: "local") == "local" + // If local run, start Appium Server + if (isLocalRun) { + // Start Appium Server for local run + service = AppiumServiceBuilder() + .withArgument(GeneralServerFlag.ALLOW_INSECURE, "chromedriver_autodownload") + .build() + service.start() + + if (!service.isRunning) { + throw AppiumServerHasNotBeenStartedLocallyException("An appium server node is not started!") + } + } + return isLocalRun + } + + fun serviceURL(isLocalRun: Boolean): String { + // Get environment variables if available or get from config + val username = System.getenv("BROWSERSTACK_USERNAME") ?: config.get("username").asString + val accessKey = + System.getenv("BROWSERSTACK_ACCESS_KEY") ?: config.get("access_key").asString + val server = System.getenv("SERVER") ?: config.get("server").asString + return if (isLocalRun) { service.url.toString() } else { - "https://${username}:${accessKey}@$server" + "https://$username:$accessKey@$server" } + } + fun setupAndCreateConnection(taskId: Int): AndroidDriver { + println("Setup and creating connection for TaskId: $taskId") + + val isLocalRun = checkLocalRun() + val capabilities = initialCapabilities(taskId) + + val url = serviceURL(isLocalRun) val driver = AndroidDriver( URL(url), - capabilities + capabilities, ) println("TaskId: $taskId | Driver created") @@ -136,7 +147,6 @@ open class BaseTest { return driver } - fun testPassed(driver: AndroidDriver) { val jse = (driver as JavascriptExecutor) jse.executeScript("browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"status\": \"passed\", \"reason\": \"All test passed!\"}}") @@ -144,15 +154,13 @@ open class BaseTest { fun testFail(failureMessage: String, driver: AndroidDriver) { val jse = (driver as JavascriptExecutor) - jse.executeScript("browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"status\":\"failed\", \"reason\": \"$failureMessage\"}}"); + jse.executeScript("browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"status\":\"failed\", \"reason\": \"$failureMessage\"}}") } - protected fun switchToContext(contextType: ContextType, driver: AndroidDriver) { val context = getContextString(contextType) driver.context(context) print("Android", "Switched to context: $context") - } private fun getContextString(contextType: ContextType): String { @@ -166,5 +174,4 @@ open class BaseTest { protected fun print(tag: String, message: String) { println("[$tag] $message") } - -} \ No newline at end of file +} diff --git a/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt b/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt index 3bf6f99cc..98d474f3e 100644 --- a/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt +++ b/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt @@ -10,6 +10,7 @@ import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.MethodSource import org.openqa.selenium.By import org.openqa.selenium.remote.DesiredCapabilities +import java.net.URL import java.util.concurrent.TimeUnit class GooglePlayTest() : BaseTest() { @@ -21,15 +22,29 @@ class GooglePlayTest() : BaseTest() { @ParameterizedTest @MethodSource("devices") fun userJourneyTests(taskId: Int) { - val driver = setupAndCreateConnection(taskId) - val capabilities = DesiredCapabilities() + var capabilities = initialCapabilities(taskId) capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.android.vending") capabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, ".AssetBrowserActivity") capabilities.setCapability(AndroidMobileCapabilityType.APP_WAIT_ACTIVITY, ".AssetBrowserActivity") capabilities.setCapability(AndroidMobileCapabilityType.DEVICE_READY_TIMEOUT, 40) + var driver = initDriver(capabilities) testEstablishPlaySession(driver) testGooglePlayFeatures(driver) - installAppFromPlayStore(driver) + installAppFromPlayStore(taskId, driver) + println("Opening application") + driver.quit() + capabilities = installedAppCapabilities(taskId) + driver = initDriver(capabilities) + driver.launchApp() + } + + fun initDriver(capabilities: DesiredCapabilities): AndroidDriver { + val isLocalRun = checkLocalRun() + val url = serviceURL(isLocalRun) + return AndroidDriver( + URL(url), + capabilities, + ) } fun testEstablishPlaySession(driver: AndroidDriver) { @@ -61,7 +76,7 @@ class GooglePlayTest() : BaseTest() { } @Throws(Exception::class) - fun installAppFromPlayStore(driver: AndroidDriver) { + fun installAppFromPlayStore(taskId: Int, driver: AndroidDriver) { openSearchForm(driver) driver.findElement(MobileBy.className("android.widget.EditText"))?.sendKeys(testAppName) @@ -71,19 +86,15 @@ class GooglePlayTest() : BaseTest() { if (button?.text.equals("Install")) { println("Installing application") button?.click() - } else { - println("Opening application") - button?.click() } driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS) driver.pressKey(KeyEvent(AndroidKey.HOME)) - driver.closeApp() } @Throws(Exception::class) - fun installedAppCaps(): DesiredCapabilities { - val capabilities = DesiredCapabilities() + fun installedAppCapabilities(taskId: Int): DesiredCapabilities { + val capabilities = initialCapabilities(taskId) capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, testAppPackage) capabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, testAppActivity) capabilities.setCapability(AndroidMobileCapabilityType.APP_WAIT_ACTIVITY, testAppActivity) From 55d1ed2881bcbc9001a70a602090b9d9c39cf916 Mon Sep 17 00:00:00 2001 From: atavism Date: Sun, 10 Sep 2023 14:12:36 -0700 Subject: [PATCH 05/13] Updates to google play tests --- .../app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt b/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt index 98d474f3e..4955a013c 100644 --- a/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt +++ b/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt @@ -39,7 +39,7 @@ class GooglePlayTest() : BaseTest() { } fun initDriver(capabilities: DesiredCapabilities): AndroidDriver { - val isLocalRun = checkLocalRun() + val isLocalRun = checkLocalRun() val url = serviceURL(isLocalRun) return AndroidDriver( URL(url), From aa1e8e01dc4e056b2a9600db3746a2a8f4277f74 Mon Sep 17 00:00:00 2001 From: atavism Date: Wed, 13 Sep 2023 21:50:39 -0700 Subject: [PATCH 06/13] switch VPN on prior to running Play tests --- .../appium_kotlin/tests/GooglePlayTest.kt | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt b/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt index 4955a013c..dfcef6adc 100644 --- a/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt +++ b/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt @@ -1,5 +1,7 @@ package appium_kotlin.tests +import appium_kotlin.ContextType +import appium_kotlin.LANTERN_PACKAGE_ID import io.appium.java_client.MobileBy import io.appium.java_client.android.AndroidDriver import io.appium.java_client.android.nativekey.AndroidKey @@ -10,6 +12,7 @@ import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.MethodSource import org.openqa.selenium.By import org.openqa.selenium.remote.DesiredCapabilities +import pro.truongsinh.appium_flutter.FlutterFinder import java.net.URL import java.util.concurrent.TimeUnit @@ -22,12 +25,16 @@ class GooglePlayTest() : BaseTest() { @ParameterizedTest @MethodSource("devices") fun userJourneyTests(taskId: Int) { + var driver = setupAndCreateConnection(taskId) + val flutterFinder = FlutterFinder(driver) + turnVPNon(driver, taskId, flutterFinder) + var capabilities = initialCapabilities(taskId) capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.android.vending") capabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, ".AssetBrowserActivity") capabilities.setCapability(AndroidMobileCapabilityType.APP_WAIT_ACTIVITY, ".AssetBrowserActivity") capabilities.setCapability(AndroidMobileCapabilityType.DEVICE_READY_TIMEOUT, 40) - var driver = initDriver(capabilities) + driver = initDriver(capabilities) testEstablishPlaySession(driver) testGooglePlayFeatures(driver) installAppFromPlayStore(taskId, driver) @@ -38,6 +45,29 @@ class GooglePlayTest() : BaseTest() { driver.launchApp() } + fun turnVPNon( + driver: AndroidDriver, + taskId: Int, + flutterFinder: FlutterFinder, + ) { + switchToContext(ContextType.NATIVE_APP, driver) + driver.activateApp(LANTERN_PACKAGE_ID) + Thread.sleep(5000) + + + switchToContext(ContextType.FLUTTER, driver) + val vpnSwitchFinder = flutterFinder.byType("FlutterSwitch") + vpnSwitchFinder.click() + Thread.sleep(2000) + // Approve VPN Permissions dialog + switchToContext(ContextType.NATIVE_APP, driver) + Thread.sleep(1000) + driver.findElement(By.id("android:id/button1")).click() + //Wait for VPN to connect + println("TaskId: $taskId | Going to Sleep") + Thread.sleep(2000) + } + fun initDriver(capabilities: DesiredCapabilities): AndroidDriver { val isLocalRun = checkLocalRun() val url = serviceURL(isLocalRun) From b47540746618d7478c5a215f88d1ca86478af2af Mon Sep 17 00:00:00 2001 From: atavism Date: Wed, 27 Sep 2023 10:32:23 -0700 Subject: [PATCH 07/13] open play app using existing driver --- .../appium_kotlin/tests/GooglePlayTest.kt | 24 ++++++------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt b/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt index dfcef6adc..e256e454e 100644 --- a/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt +++ b/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt @@ -3,6 +3,7 @@ package appium_kotlin.tests import appium_kotlin.ContextType import appium_kotlin.LANTERN_PACKAGE_ID import io.appium.java_client.MobileBy +import io.appium.java_client.android.Activity import io.appium.java_client.android.AndroidDriver import io.appium.java_client.android.nativekey.AndroidKey import io.appium.java_client.android.nativekey.KeyEvent @@ -29,20 +30,10 @@ class GooglePlayTest() : BaseTest() { val flutterFinder = FlutterFinder(driver) turnVPNon(driver, taskId, flutterFinder) - var capabilities = initialCapabilities(taskId) - capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.android.vending") - capabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, ".AssetBrowserActivity") - capabilities.setCapability(AndroidMobileCapabilityType.APP_WAIT_ACTIVITY, ".AssetBrowserActivity") - capabilities.setCapability(AndroidMobileCapabilityType.DEVICE_READY_TIMEOUT, 40) - driver = initDriver(capabilities) + driver.startActivity(Activity("com.android.vending", ".AssetBrowserActivity")); testEstablishPlaySession(driver) testGooglePlayFeatures(driver) installAppFromPlayStore(taskId, driver) - println("Opening application") - driver.quit() - capabilities = installedAppCapabilities(taskId) - driver = initDriver(capabilities) - driver.launchApp() } fun turnVPNon( @@ -50,7 +41,10 @@ class GooglePlayTest() : BaseTest() { taskId: Int, flutterFinder: FlutterFinder, ) { + Thread.sleep(5000) + switchToContext(ContextType.NATIVE_APP, driver) + Thread.sleep(5000) driver.activateApp(LANTERN_PACKAGE_ID) Thread.sleep(5000) @@ -62,10 +56,6 @@ class GooglePlayTest() : BaseTest() { // Approve VPN Permissions dialog switchToContext(ContextType.NATIVE_APP, driver) Thread.sleep(1000) - driver.findElement(By.id("android:id/button1")).click() - //Wait for VPN to connect - println("TaskId: $taskId | Going to Sleep") - Thread.sleep(2000) } fun initDriver(capabilities: DesiredCapabilities): AndroidDriver { @@ -79,11 +69,11 @@ class GooglePlayTest() : BaseTest() { fun testEstablishPlaySession(driver: AndroidDriver) { Assertions.assertEquals(driver.currentPackage, "com.android.vending") - Assertions.assertEquals(driver.currentActivity(), "org.getlantern.lantern") + Assertions.assertEquals(driver.currentActivity(), ".AssetBrowserActivity") } fun testGooglePlayFeatures(driver: AndroidDriver) { - driver.findElement(By.xpath("/android.widget.FrameLayout[@content-desc = 'Show navigation drawer']"))?.click() + driver.findElement(By.xpath("//android.widget.FrameLayout[@content-desc = 'Show navigation drawer']"))?.click() val elements = driver.findElements(By.xpath("//android.widget.TextView")) if (elements == null) return for (element in elements) { From 8a27966c879de51d03f474d71a8cd6f48ef65691 Mon Sep 17 00:00:00 2001 From: atavism Date: Wed, 27 Sep 2023 10:36:37 -0700 Subject: [PATCH 08/13] remove semicolon --- .../app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt b/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt index e256e454e..6cfcdd894 100644 --- a/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt +++ b/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt @@ -30,7 +30,7 @@ class GooglePlayTest() : BaseTest() { val flutterFinder = FlutterFinder(driver) turnVPNon(driver, taskId, flutterFinder) - driver.startActivity(Activity("com.android.vending", ".AssetBrowserActivity")); + driver.startActivity(Activity("com.android.vending", ".AssetBrowserActivity")) testEstablishPlaySession(driver) testGooglePlayFeatures(driver) installAppFromPlayStore(taskId, driver) From 2a45ea3ac7c364b1e0ace14d7f81ea2a72f86ec0 Mon Sep 17 00:00:00 2001 From: atavism Date: Wed, 27 Sep 2023 10:54:09 -0700 Subject: [PATCH 09/13] update README --- README.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/README.md b/README.md index 6af90a2a8..8265cf0fd 100644 --- a/README.md +++ b/README.md @@ -324,6 +324,42 @@ You'd most probably wanna run this against Lantern's staging servers **and** tur - You can debug pro-server-neu's staging instance (i.e., `api-staging.getiantem.org`) using a combination of log, telemetry and checking the staging Redis instance (see [here](https://github.com/getlantern/pro-server-neu/blob/c79c1b8da9e418bc4b075392fde9b051c699141d/README.md?plain=1#L125) for more info) +## Running Appium tests locally + +To run the Appium tests locally with a connected device, you need to follow a few steps: + +1. Install appium with npm: + +```bash +npm install -g appium +``` + +2. Install the necessary drivers: + +```bash +appium driver install uiautomator2 +appium driver install --source=npm appium-flutter-driver +appium driver install espresso +``` + +3. Generate a debug build with `CI=true make android-debug ANDROID_ARCH=all` ... CI needs to be set to true to enable the +Flutter driver extension. + +4. Modify [local_config.json](appium_kotlin/app/src/tests/resources/local/local_config.json) to specify the path of a debug build APK on your system, and change `appium:udid` to specify your device ID (you can get this from `adb devices`) + +5. Make sure your device is connected to your computer and then run + +```bash +cd appium_kotlin +./gradlew test +``` + +To run a specific test, you can do + +```bash +./gradlew test --tests '*GooglePlay*' +``` + ## Source Dump Lantern Android source code is made available via source dump tarballs. To create one, run: From 74071c6901bc8dcef8626f2215a61d011ff7be6a Mon Sep 17 00:00:00 2001 From: atavism Date: Wed, 27 Sep 2023 10:56:15 -0700 Subject: [PATCH 10/13] update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8265cf0fd..16c7a847f 100644 --- a/README.md +++ b/README.md @@ -345,7 +345,7 @@ appium driver install espresso 3. Generate a debug build with `CI=true make android-debug ANDROID_ARCH=all` ... CI needs to be set to true to enable the Flutter driver extension. -4. Modify [local_config.json](appium_kotlin/app/src/tests/resources/local/local_config.json) to specify the path of a debug build APK on your system, and change `appium:udid` to specify your device ID (you can get this from `adb devices`) +4. Modify [local_config.json](appium_kotlin/app/src/test/resources/local/local_config.json) to specify the path of a debug build APK on your system, and change `appium:udid` to specify your device ID (you can get this from `adb devices`) 5. Make sure your device is connected to your computer and then run From 00130b566d82bcccbdf905f25855fc66a8b87319 Mon Sep 17 00:00:00 2001 From: atavism Date: Sun, 1 Oct 2023 22:46:59 -0700 Subject: [PATCH 11/13] move tests to AppTest --- .../test/java/appium_kotlin/tests/AppTest.kt | 114 ++++++++++++++++ .../test/java/appium_kotlin/tests/BaseTest.kt | 3 +- .../appium_kotlin/tests/GooglePlayTest.kt | 126 ------------------ 3 files changed, 116 insertions(+), 127 deletions(-) delete mode 100644 appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt diff --git a/appium_kotlin/app/src/test/java/appium_kotlin/tests/AppTest.kt b/appium_kotlin/app/src/test/java/appium_kotlin/tests/AppTest.kt index 5140b56b4..9d342dc25 100644 --- a/appium_kotlin/app/src/test/java/appium_kotlin/tests/AppTest.kt +++ b/appium_kotlin/app/src/test/java/appium_kotlin/tests/AppTest.kt @@ -22,26 +22,36 @@ import appium_kotlin.REPORT_DESCRIPTION import appium_kotlin.REPORT_ISSUE_SUCCESS import appium_kotlin.SEND_REPORT import appium_kotlin.SUPPORT +import io.appium.java_client.MobileBy import io.appium.java_client.TouchAction import io.appium.java_client.android.Activity import io.appium.java_client.android.AndroidDriver +import io.appium.java_client.android.nativekey.AndroidKey +import io.appium.java_client.android.nativekey.KeyEvent +import io.appium.java_client.remote.AndroidMobileCapabilityType import io.appium.java_client.touch.WaitOptions import io.appium.java_client.touch.offset.PointOption import org.junit.jupiter.api.Assertions import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.MethodSource import org.openqa.selenium.By +import org.openqa.selenium.remote.DesiredCapabilities import org.openqa.selenium.logging.LogEntries import pro.truongsinh.appium_flutter.FlutterFinder import java.io.IOException +import java.net.URL import java.time.Duration import java.time.LocalDate import java.time.format.DateTimeFormatter +import java.util.concurrent.TimeUnit import java.util.regex.Pattern class AppTest() : BaseTest() { private val isLocalRun = (System.getenv("RUN_ENV") ?: "local") == "local" + private val testAppName = "chromecast" + private val testAppPackage = "com.google.android.apps.chromecast.app" + private val testAppActivity = ".DiscoveryActivity" @ParameterizedTest @MethodSource("devices") @@ -63,6 +73,8 @@ class AppTest() : BaseTest() { // Report and issue flow reportAnIssueFlow(androidDriver, taskId, flutterFinder) + googlePlayFlow(androidDriver, taskId, flutterFinder) + if (!isLocalRun) { testPassed(androidDriver) } @@ -404,4 +416,106 @@ class AppTest() : BaseTest() { return "" } + @Throws(IOException::class, InterruptedException::class) + private fun googlePlayFlow( + driver: AndroidDriver, + taskId: Int, + flutterFinder: FlutterFinder + ) { + turnVPNon(driver, taskId, flutterFinder) + driver.startActivity(Activity("com.android.vending", ".AssetBrowserActivity")) + testEstablishPlaySession(driver) + testGooglePlayFeatures(driver) + installAppFromPlayStore(taskId, driver) + } + + fun turnVPNon( + driver: AndroidDriver, + taskId: Int, + flutterFinder: FlutterFinder, + ) { + Thread.sleep(5000) + + switchToContext(ContextType.NATIVE_APP, driver) + Thread.sleep(5000) + driver.activateApp(LANTERN_PACKAGE_ID) + Thread.sleep(5000) + + + switchToContext(ContextType.FLUTTER, driver) + val vpnSwitchFinder = flutterFinder.byType("FlutterSwitch") + vpnSwitchFinder.click() + Thread.sleep(2000) + // Approve VPN Permissions dialog + switchToContext(ContextType.NATIVE_APP, driver) + Thread.sleep(1000) + } + + fun initDriver(capabilities: DesiredCapabilities): AndroidDriver { + val isLocalRun = checkLocalRun() + val url = serviceURL(isLocalRun) + return AndroidDriver( + URL(url), + capabilities, + ) + } + + fun testEstablishPlaySession(driver: AndroidDriver) { + Assertions.assertEquals(driver.currentPackage, "com.android.vending") + Assertions.assertEquals(driver.currentActivity(), ".AssetBrowserActivity") + } + + fun testGooglePlayFeatures(driver: AndroidDriver) { + driver.findElement(By.xpath("//android.widget.FrameLayout[@content-desc = 'Show navigation drawer']"))?.click() + val elements = driver.findElements(By.xpath("//android.widget.TextView")) + if (elements == null) return + for (element in elements) { + if (element.text.equals("Settings")) { + element.click() + break + } + } + } + + fun openSearchForm(driver: AndroidDriver) { + val elements = driver?.findElements(By.xpath("//android.widget.TextView")) + if (elements == null) return + for (element in elements) { + if (element.text.equals("Search for apps & games")) { + element.click() + break + } + } + } + + @Throws(Exception::class) + fun installAppFromPlayStore(taskId: Int, driver: AndroidDriver) { + openSearchForm(driver) + driver.findElement(MobileBy.className("android.widget.EditText"))?.sendKeys(testAppName) + + driver.findElement(By.xpath("//android.support.v7.widget.RecyclerView[1]/android.widget.LinearLayout[1]"))?.click() + + val button = driver.findElement(MobileBy.className("android.widget.Button")) + if (button?.text.equals("Install")) { + println("Installing application") + button?.click() + } + + driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS) + driver.pressKey(KeyEvent(AndroidKey.HOME)) + } + + @Throws(Exception::class) + fun installedAppCapabilities(taskId: Int): DesiredCapabilities { + val capabilities = initialCapabilities(taskId) + capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, testAppPackage) + capabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, testAppActivity) + capabilities.setCapability(AndroidMobileCapabilityType.APP_WAIT_ACTIVITY, testAppActivity) + capabilities.setCapability(AndroidMobileCapabilityType.DEVICE_READY_TIMEOUT, 40) + capabilities.setCapability("deviceOrientation", "portrait") + capabilities.setCapability("autoLaunch", "false") + return capabilities + } + + } \ No newline at end of file diff --git a/appium_kotlin/app/src/test/java/appium_kotlin/tests/BaseTest.kt b/appium_kotlin/app/src/test/java/appium_kotlin/tests/BaseTest.kt index 15d446bed..2fd4f6bf6 100644 --- a/appium_kotlin/app/src/test/java/appium_kotlin/tests/BaseTest.kt +++ b/appium_kotlin/app/src/test/java/appium_kotlin/tests/BaseTest.kt @@ -5,6 +5,7 @@ import com.google.gson.JsonArray import com.google.gson.JsonObject import com.google.gson.JsonParser import io.appium.java_client.android.AndroidDriver +import io.appium.java_client.remote.MobileCapabilityType import io.appium.java_client.service.local.AppiumDriverLocalService import io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException import io.appium.java_client.service.local.AppiumServiceBuilder @@ -86,7 +87,7 @@ open class BaseTest { } } capabilities.setCapability("app", app) -// capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "Flutter") + capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "Flutter") println("Setup for TaskId $taskId: $capabilities") val envCapabilities = envs[taskId] as JsonObject diff --git a/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt b/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt deleted file mode 100644 index 6cfcdd894..000000000 --- a/appium_kotlin/app/src/test/java/appium_kotlin/tests/GooglePlayTest.kt +++ /dev/null @@ -1,126 +0,0 @@ -package appium_kotlin.tests - -import appium_kotlin.ContextType -import appium_kotlin.LANTERN_PACKAGE_ID -import io.appium.java_client.MobileBy -import io.appium.java_client.android.Activity -import io.appium.java_client.android.AndroidDriver -import io.appium.java_client.android.nativekey.AndroidKey -import io.appium.java_client.android.nativekey.KeyEvent -import io.appium.java_client.remote.AndroidMobileCapabilityType -import org.junit.jupiter.api.Assertions -import org.junit.jupiter.params.ParameterizedTest -import org.junit.jupiter.params.provider.MethodSource -import org.openqa.selenium.By -import org.openqa.selenium.remote.DesiredCapabilities -import pro.truongsinh.appium_flutter.FlutterFinder -import java.net.URL -import java.util.concurrent.TimeUnit - -class GooglePlayTest() : BaseTest() { - - private val testAppName = "chromecast" - private val testAppPackage = "com.google.android.apps.chromecast.app" - private val testAppActivity = ".DiscoveryActivity" - - @ParameterizedTest - @MethodSource("devices") - fun userJourneyTests(taskId: Int) { - var driver = setupAndCreateConnection(taskId) - val flutterFinder = FlutterFinder(driver) - turnVPNon(driver, taskId, flutterFinder) - - driver.startActivity(Activity("com.android.vending", ".AssetBrowserActivity")) - testEstablishPlaySession(driver) - testGooglePlayFeatures(driver) - installAppFromPlayStore(taskId, driver) - } - - fun turnVPNon( - driver: AndroidDriver, - taskId: Int, - flutterFinder: FlutterFinder, - ) { - Thread.sleep(5000) - - switchToContext(ContextType.NATIVE_APP, driver) - Thread.sleep(5000) - driver.activateApp(LANTERN_PACKAGE_ID) - Thread.sleep(5000) - - - switchToContext(ContextType.FLUTTER, driver) - val vpnSwitchFinder = flutterFinder.byType("FlutterSwitch") - vpnSwitchFinder.click() - Thread.sleep(2000) - // Approve VPN Permissions dialog - switchToContext(ContextType.NATIVE_APP, driver) - Thread.sleep(1000) - } - - fun initDriver(capabilities: DesiredCapabilities): AndroidDriver { - val isLocalRun = checkLocalRun() - val url = serviceURL(isLocalRun) - return AndroidDriver( - URL(url), - capabilities, - ) - } - - fun testEstablishPlaySession(driver: AndroidDriver) { - Assertions.assertEquals(driver.currentPackage, "com.android.vending") - Assertions.assertEquals(driver.currentActivity(), ".AssetBrowserActivity") - } - - fun testGooglePlayFeatures(driver: AndroidDriver) { - driver.findElement(By.xpath("//android.widget.FrameLayout[@content-desc = 'Show navigation drawer']"))?.click() - val elements = driver.findElements(By.xpath("//android.widget.TextView")) - if (elements == null) return - for (element in elements) { - if (element.text.equals("Settings")) { - element.click() - break - } - } - } - - fun openSearchForm(driver: AndroidDriver) { - val elements = driver?.findElements(By.xpath("//android.widget.TextView")) - if (elements == null) return - for (element in elements) { - if (element.text.equals("Search for apps & games")) { - element.click() - break - } - } - } - - @Throws(Exception::class) - fun installAppFromPlayStore(taskId: Int, driver: AndroidDriver) { - openSearchForm(driver) - driver.findElement(MobileBy.className("android.widget.EditText"))?.sendKeys(testAppName) - - driver.findElement(By.xpath("//android.support.v7.widget.RecyclerView[1]/android.widget.LinearLayout[1]"))?.click() - - val button = driver.findElement(MobileBy.className("android.widget.Button")) - if (button?.text.equals("Install")) { - println("Installing application") - button?.click() - } - - driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS) - driver.pressKey(KeyEvent(AndroidKey.HOME)) - } - - @Throws(Exception::class) - fun installedAppCapabilities(taskId: Int): DesiredCapabilities { - val capabilities = initialCapabilities(taskId) - capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, testAppPackage) - capabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, testAppActivity) - capabilities.setCapability(AndroidMobileCapabilityType.APP_WAIT_ACTIVITY, testAppActivity) - capabilities.setCapability(AndroidMobileCapabilityType.DEVICE_READY_TIMEOUT, 40) - capabilities.setCapability("deviceOrientation", "portrait") - capabilities.setCapability("autoLaunch", "false") - return capabilities - } -} From cf4c2c0d1e58dfcfdbdcd0731140f73479865ea5 Mon Sep 17 00:00:00 2001 From: atavism Date: Tue, 3 Oct 2023 02:21:27 -0700 Subject: [PATCH 12/13] remove unused --- .../test/java/appium_kotlin/tests/AppTest.kt | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/appium_kotlin/app/src/test/java/appium_kotlin/tests/AppTest.kt b/appium_kotlin/app/src/test/java/appium_kotlin/tests/AppTest.kt index 9d342dc25..b1a19282c 100644 --- a/appium_kotlin/app/src/test/java/appium_kotlin/tests/AppTest.kt +++ b/appium_kotlin/app/src/test/java/appium_kotlin/tests/AppTest.kt @@ -451,15 +451,6 @@ class AppTest() : BaseTest() { Thread.sleep(1000) } - fun initDriver(capabilities: DesiredCapabilities): AndroidDriver { - val isLocalRun = checkLocalRun() - val url = serviceURL(isLocalRun) - return AndroidDriver( - URL(url), - capabilities, - ) - } - fun testEstablishPlaySession(driver: AndroidDriver) { Assertions.assertEquals(driver.currentPackage, "com.android.vending") Assertions.assertEquals(driver.currentActivity(), ".AssetBrowserActivity") @@ -505,17 +496,4 @@ class AppTest() : BaseTest() { driver.pressKey(KeyEvent(AndroidKey.HOME)) } - @Throws(Exception::class) - fun installedAppCapabilities(taskId: Int): DesiredCapabilities { - val capabilities = initialCapabilities(taskId) - capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, testAppPackage) - capabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, testAppActivity) - capabilities.setCapability(AndroidMobileCapabilityType.APP_WAIT_ACTIVITY, testAppActivity) - capabilities.setCapability(AndroidMobileCapabilityType.DEVICE_READY_TIMEOUT, 40) - capabilities.setCapability("deviceOrientation", "portrait") - capabilities.setCapability("autoLaunch", "false") - return capabilities - } - - } \ No newline at end of file From 9d9f24984140b9148f00f47e6bc0e656bdffdd31 Mon Sep 17 00:00:00 2001 From: atavism Date: Tue, 10 Oct 2023 05:03:52 -0700 Subject: [PATCH 13/13] remove datadog from gradle config --- android/app/build.gradle | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 418f9fde8..0c840cabd 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -180,8 +180,6 @@ android { buildConfigField "boolean", "STICKY_CONFIG", getBoolean("stickyConfig") buildConfigField "boolean", "STAGING", getBoolean("useStaging") buildConfigField "boolean", "PLAY_VERSION", getBoolean("playVersion") - buildConfigField "String", "DD_CLIENT_TOKEN", ddClientToken() - buildConfigField "String", "DD_APPLICATION_ID", ddApplicationID() buildConfigField "String", "COUNTRY", userCountry() buildConfigField "String", "PAYMENT_PROVIDER", paymentProvider() buildConfigField "String", "PRO_SERVER_URL", proServerUrl() @@ -323,22 +321,6 @@ def getInt(name) { return value.toInteger() } -def ddApplicationID() { - def value = project.getProperties().get("ddApplicationID") - if (value == null || !value?.trim()) { - return "\"\"" - } - return String.format("\"%s\"", value) -} - -def ddClientToken() { - def value = project.getProperties().get("ddClientToken") - if (value == null || !value?.trim()) { - return "\"\"" - } - return String.format("\"%s\"", value) -} - def userCountry() { def value = project.getProperties().get("country") if (value == null || !value?.trim()) {