-
Notifications
You must be signed in to change notification settings - Fork 0
/
Home.kts
40 lines (30 loc) · 928 Bytes
/
Home.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import io.appium.java_client.*
import org.openqa.selenium.support.ui.*
class Screen(val app: AppiumDriver<MobileElement>) {
fun selectCriteria(criteria: String): Screen {
val searchCriteria = app.findElement(
MobileBy.AndroidUIAutomator("""text("$criteria")""")
)
searchCriteria.click()
return this
}
fun enterTerm(term: String): Screen {
val searchTerm = app.findElement(
MobileBy.AndroidUIAutomator("""text("Package search")""")
)
searchTerm.click()
searchTerm.sendKeys(term)
return this
}
fun search(): Results.Screen {
app.executeScript("mobile:performEditorAction", mapOf("action" to "search"))
WebDriverWait(app, 10).until(
ExpectedConditions.visibilityOfElementLocated(
MobileBy.AndroidUIAutomator(
"""className("androidx.recyclerview.widget.RecyclerView")"""
)
)
)
return Results.Screen(app)
}
}