Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Appium Test 숙제 #8

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/main/kotlin/AndroidSetup.kt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions src/main/kotlin/iOSSetup.kt
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down Expand Up @@ -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
Expand Down
Loading