From 0de3a6221ab15bc392f6c064169804e8aaa66be1 Mon Sep 17 00:00:00 2001 From: Danil Klimenko Date: Tue, 29 Oct 2024 21:18:14 +0200 Subject: [PATCH] replaced end: with to: --- .../orchestra/yaml/YamlFluentCommand.kt | 2 +- .../java/maestro/orchestra/yaml/YamlSwipe.kt | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/maestro-orchestra/src/main/java/maestro/orchestra/yaml/YamlFluentCommand.kt b/maestro-orchestra/src/main/java/maestro/orchestra/yaml/YamlFluentCommand.kt index f91227febc..ec6833affc 100644 --- a/maestro-orchestra/src/main/java/maestro/orchestra/yaml/YamlFluentCommand.kt +++ b/maestro-orchestra/src/main/java/maestro/orchestra/yaml/YamlFluentCommand.kt @@ -552,7 +552,7 @@ data class YamlFluentCommand( return MaestroCommand( swipeCommand = SwipeCommand( elementSelector = toElementSelector(swipeElement.from), - endRelative = swipeElement.end, + endRelative = swipeElement.to, duration = swipeElement.duration, label = swipeElement.label, optional = swipeElement.optional, diff --git a/maestro-orchestra/src/main/java/maestro/orchestra/yaml/YamlSwipe.kt b/maestro-orchestra/src/main/java/maestro/orchestra/yaml/YamlSwipe.kt index 0863be1cef..20804da4d7 100644 --- a/maestro-orchestra/src/main/java/maestro/orchestra/yaml/YamlSwipe.kt +++ b/maestro-orchestra/src/main/java/maestro/orchestra/yaml/YamlSwipe.kt @@ -52,7 +52,7 @@ data class YamlSwipeElement( data class YamlRelativeCoordinateSwipeElement( val from: YamlElementSelectorUnion, - val end: String, + val to: String, override val duration: Long = DEFAULT_DURATION_IN_MILLIS, override val label: String? = null, override val optional: Boolean, @@ -96,8 +96,7 @@ class YamlSwipeDeserializer : JsonDeserializer() { mapper.convertValue(root, YamlSwipeElement::class.java) } } - input.contains("from") && input.contains("end") -> { - // Handling YamlRelativeCoordinateSwipeElement + input.contains("from") && input.contains("to") -> { return resolveRelativeCoordinateSwipeElement(root, duration, label, optional, mapper) } else -> { @@ -122,26 +121,26 @@ class YamlSwipeDeserializer : JsonDeserializer() { mapper: ObjectMapper ): YamlRelativeCoordinateSwipeElement { val from = mapper.convertValue(root.path("from"), YamlElementSelectorUnion::class.java) - val end = root.path("end").toString().replace("\"", "") + val to = root.path("to").toString().replace("\"", "") - val isRelative = end.contains("%") + val isRelative = to.contains("%") if (isRelative) { - val endPoints = end + val endPoints = to .replace("%", "") .split(",") .map { it.trim().toInt() } check(endPoints[0] in 0..100 && endPoints[1] in 0..100) { - "Invalid end point: $end should be between 0 to 100 when using relative coordinates." + "Invalid end point: $to should be between 0 to 100 when using relative coordinates." } } else { - val endPoints = end + val endPoints = to .split(",") .map { it.trim().toInt() } - check(endPoints.size == 2) { "Invalid format for absolute coordinates: $end" } + check(endPoints.size == 2) { "Invalid format for absolute coordinates: $to" } } - return YamlRelativeCoordinateSwipeElement(from, end, duration, label, optional) + return YamlRelativeCoordinateSwipeElement(from, to, duration, label, optional) } private fun resolveCoordinateSwipe(root: TreeNode, duration: Long, label: String?, optional: Boolean): YamlSwipe {