This file contains 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
assertEquals("40", result) |
This file contains 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
val result = driver.findElement(By.className("android.widget.TextView")).text |
This file contains 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
driver.findElement(By.id(DIGIT_5)).click() | |
driver.findElement(By.id(MULTIPLICATION)).click() | |
driver.findElement(By.id(DIGIT_8)).click() | |
driver.findElement(By.id(EQUAL)).click() |
This file contains 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
import org.junit.jupiter.api.Test | |
import org.openqa.selenium.By | |
import kotlin.test.assertEquals | |
class MultiplicationTests : AppiumSetup() { | |
@Test | |
fun `Simple multiplication gives correct result`() { | |
// Let's implement this ! | |
} | |
} |
This file contains 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
const val DIGIT_5: String = "com.google.android.calculator:id/digit_5" | |
const val DIGIT_8: String = "com.google.android.calculator:id/digit_8" | |
const val MULTIPLICATION: String = "com.google.android.calculator:id/op_mul" | |
const val EQUAL: String = "com.google.android.calculator:id/eq" |
This file contains 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
@JvmStatic | |
@AfterAll | |
fun tearDown() { | |
driver.quit() | |
} |
This file contains 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
@JvmStatic | |
@BeforeAll | |
fun setUp() { | |
caps.setCapability(MobileCapabilityType.PLATFORM_NAME, platformName) | |
caps.setCapability(MobileCapabilityType.AUTOMATION_NAME, automationName) | |
caps.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, appPackage) | |
caps.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, activityName) | |
caps.setCapability(AndroidMobileCapabilityType.AUTO_GRANT_PERMISSIONS, true) | |
driver = AndroidDriver(URL(serverUrl), caps) | |
} |
This file contains 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
private const val appPackage = "com.google.android.calculator" | |
private const val activityName = "com.android.calculator2.Calculator" | |
private const val automationName = "UiAutomator2" | |
private const val platformName = "Android" | |
private const val serverUrl = "http://localhost:4723/wd/hub" |
This file contains 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
lateinit var driver: AppiumDriver<MobileElement> | |
private val caps = DesiredCapabilities() |
This file contains 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
dependencies { | |
testImplementation(kotlin("test")) | |
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2") | |
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.2") | |
testImplementation("io.appium:java-client:7.6.0") | |
testImplementation("org.seleniumhq.selenium:selenium-java:4.1.4") | |
} |