diff --git a/src/main/kotlin/AndroidSetup.kt b/src/main/kotlin/AndroidSetup.kt index 9256e06..11faab0 100644 --- a/src/main/kotlin/AndroidSetup.kt +++ b/src/main/kotlin/AndroidSetup.kt @@ -1,3 +1,4 @@ +import io.appium.java_client.AppiumBy import io.appium.java_client.android.AndroidDriver import io.appium.java_client.remote.options.BaseOptions import org.testng.annotations.AfterMethod @@ -6,7 +7,7 @@ import org.testng.annotations.Test import java.net.MalformedURLException import java.net.URL -class SampleTest { +class AndroidSetup { private lateinit var driver: AndroidDriver @@ -38,7 +39,19 @@ class SampleTest { @Test fun sampleTest() { - Thread.sleep(10000) + driver.findElement(AppiumBy.xpath("//*[@text='App']")).click() + driver.findElement(AppiumBy.xpath("//*[@text='Activity']")).click() + driver.findElement(AppiumBy.xpath("//*[@text='Custom Title']")).click() + + driver.findElement(AppiumBy.id("left_text_edit")).clear() + driver.findElement(AppiumBy.id("left_text_edit")).sendKeys("Hello, World!") + driver.findElement(AppiumBy.id("left_text_button")).click() + assert(driver.findElement(AppiumBy.id("left_text")).text == "Hello, World!") + + driver.findElement(AppiumBy.id("right_text_edit")).clear() + driver.findElement(AppiumBy.id("right_text_edit")).sendKeys("Hello, World!") + driver.findElement(AppiumBy.id("right_text_button")).click() + assert(driver.findElement(AppiumBy.id("right_text")).text == "Hello, World!") } @AfterMethod diff --git a/src/main/kotlin/iOSSetup.kt b/src/main/kotlin/iOSSetup.kt index d4d1fef..b49ef1f 100644 --- a/src/main/kotlin/iOSSetup.kt +++ b/src/main/kotlin/iOSSetup.kt @@ -1,12 +1,11 @@ import io.appium.java_client.ios.IOSDriver import io.appium.java_client.remote.options.BaseOptions -import org.openqa.selenium.WebDriver +import org.openqa.selenium.By import org.testng.annotations.AfterMethod import org.testng.annotations.BeforeMethod import org.testng.annotations.Test import java.net.MalformedURLException import java.net.URL -import java.time.Duration class iOSSetup { @@ -38,7 +37,10 @@ class iOSSetup { @Test fun sampleTest() { - Thread.sleep(10000) + driver.findElement(By.name("IntegerA")).sendKeys("123") + driver.findElement(By.name("IntegerB")).sendKeys("456") + driver.findElement(By.name("ComputeSumButton")).click() + assert(driver.findElement(By.name("Answer")).text == "579") } @AfterMethod