Skip to content

Commit

Permalink
Version 2.0.73-alpha
Browse files Browse the repository at this point in the history
- Add get from parent
- Fix get child
  • Loading branch information
dtmilano committed Oct 12, 2024
1 parent 94e2a99 commit 8aca2db
Show file tree
Hide file tree
Showing 38 changed files with 167 additions and 45 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ android {
applicationId "com.dtmilano.android.culebratester2"
minSdk 26
targetSdk 33
versionCode 20072
versionName "2.0.72-alpha"
versionCode 20073
versionName "2.0.73-alpha"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,6 @@ interface ApplicationComponent {
fun inject(getChildren: UiObject2.GetChildren)
fun inject(getBounds: UiObject.GetBounds)
fun inject(getChild: UiObject.GetChild)
fun inject(getFromParent: UiObject.GetFromParent)
// fun inject(uiAutomatorHelper: UiAutomatorHelper)
}
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,10 @@ fun Application.module(testing: Boolean = false) {
call.respond(it.response())
}

get<UiObject.GetFromParent> {
call.respond(it.response())
}

post<UiObject.PerformTwoPointerGesture.Post> {
// We have to get the body as ktor doesn't do it
// see https://github.com/ktorio/ktor/issues/190
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,19 +228,24 @@ class UiObject {
}

fun response(): ObjectRef {
uiSelector?.let {
val usb = uiSelectorBundleFromString(it)
val obj = holder.uiDevice.findObject(usb.selector)
if (obj != null) {
val oid = objectStore.put(obj)
return@response ObjectRef(oid, obj.className)
uiSelector?.let { uis ->
val usb = uiSelectorBundleFromString(uis)
uiObject(oid, objectStore)?.let { obj ->
obj.getChild(usb.selector)?.let {
val newOid = objectStore.put(it)
return@response ObjectRef(newOid, it.className)
}
throw HttpException(
HttpStatusCode.NotFound,
StatusCode.OBJECT_NOT_FOUND.message("getChild could not find any object matching selector")
)
}
throw notFound(oid)
}
throw HttpException(
HttpStatusCode.NotFound,
StatusCode.OBJECT_NOT_FOUND.message("getChild could not find any object matching selector")
HttpStatusCode.InternalServerError,
StatusCode.ARGUMENT_MISSING.message("uiSelector must be provided and not empty")
)

}
}

Expand Down Expand Up @@ -323,6 +328,47 @@ class UiObject {
}
}

@Location("/{oid}/getFromParent")
/*inner*/ class GetFromParent(
val oid: Int,
private val uiSelector: String? = null,
private val parent: UiObject = UiObject()
) {
private var holder: Holder

@Inject
lateinit var holderHolder: HolderHolder

@Inject
lateinit var objectStore: ObjectStore

init {
CulebraTesterApplication().appComponent.inject(this)
holder = holderHolder.instance
}

fun response(): ObjectRef {
uiSelector?.let { uis ->
val usb = uiSelectorBundleFromString(uis)
uiObject(oid, objectStore)?.let { obj ->
obj.getFromParent(usb.selector)?.let {
val newOid = objectStore.put(it)
return@response ObjectRef(newOid, it.className)
}
throw HttpException(
HttpStatusCode.NotFound,
StatusCode.OBJECT_NOT_FOUND.message("getFromParent could not find any object matching selector")
)
}
throw notFound(oid)
}
throw HttpException(
HttpStatusCode.InternalServerError,
StatusCode.ARGUMENT_MISSING.message("uiSelector must be provided and not empty")
)
}
}

@Location("/{oid}/performTwoPointerGesture")
/*inner*/ class PerformTwoPointerGesture(val oid: Int) {
// WARNING: ktor is not passing this argument so the '?' and null are needed
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/io/swagger/server/models/AnyValue.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/io/swagger/server/models/ClickBody.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/io/swagger/server/models/CulebraInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/io/swagger/server/models/DisplayWidth.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/io/swagger/server/models/Help.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/io/swagger/server/models/Locale.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/io/swagger/server/models/ObjectRef.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/io/swagger/server/models/Pattern.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/io/swagger/server/models/Pixel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/io/swagger/server/models/Point.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/io/swagger/server/models/ProductName.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/io/swagger/server/models/Rect.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/io/swagger/server/models/Selector.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/io/swagger/server/models/SwipeBody.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/io/swagger/server/models/Text.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/io/swagger/server/models/Timeout.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* CulebraTester
* ## Snaky Android Test --- If you want to be able to try out the API using the **Execute** or **TRY** button from this page - an android device should be connected using `adb` - the server should have been started using `./culebratester2 start-server` then you will be able to invoke the API and see the responses.
*
* OpenAPI spec version: 2.0.72
* OpenAPI spec version: 2.0.73
*
*
* NOTE: This class is auto generated by the swagger code generator program.
Expand Down
Loading

0 comments on commit 8aca2db

Please sign in to comment.