Skip to content

Commit b84b142

Browse files
suspenseVNorseGaud
authored andcommitted
replaced end: with to:
1 parent 23b9472 commit b84b142

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

maestro-orchestra/src/main/java/maestro/orchestra/yaml/YamlFluentCommand.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ data class YamlFluentCommand(
552552
return MaestroCommand(
553553
swipeCommand = SwipeCommand(
554554
elementSelector = toElementSelector(swipeElement.from),
555-
endRelative = swipeElement.end,
555+
endRelative = swipeElement.to,
556556
duration = swipeElement.duration,
557557
label = swipeElement.label,
558558
optional = swipeElement.optional,

maestro-orchestra/src/main/java/maestro/orchestra/yaml/YamlSwipe.kt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ data class YamlSwipeElement(
5252

5353
data class YamlRelativeCoordinateSwipeElement(
5454
val from: YamlElementSelectorUnion,
55-
val end: String,
55+
val to: String,
5656
override val duration: Long = DEFAULT_DURATION_IN_MILLIS,
5757
override val label: String? = null,
5858
override val optional: Boolean,
@@ -96,8 +96,7 @@ class YamlSwipeDeserializer : JsonDeserializer<YamlSwipe>() {
9696
mapper.convertValue(root, YamlSwipeElement::class.java)
9797
}
9898
}
99-
input.contains("from") && input.contains("end") -> {
100-
// Handling YamlRelativeCoordinateSwipeElement
99+
input.contains("from") && input.contains("to") -> {
101100
return resolveRelativeCoordinateSwipeElement(root, duration, label, optional, mapper)
102101
}
103102
else -> {
@@ -122,26 +121,26 @@ class YamlSwipeDeserializer : JsonDeserializer<YamlSwipe>() {
122121
mapper: ObjectMapper
123122
): YamlRelativeCoordinateSwipeElement {
124123
val from = mapper.convertValue(root.path("from"), YamlElementSelectorUnion::class.java)
125-
val end = root.path("end").toString().replace("\"", "")
124+
val to = root.path("to").toString().replace("\"", "")
126125

127-
val isRelative = end.contains("%")
126+
val isRelative = to.contains("%")
128127

129128
if (isRelative) {
130-
val endPoints = end
129+
val endPoints = to
131130
.replace("%", "")
132131
.split(",")
133132
.map { it.trim().toInt() }
134133
check(endPoints[0] in 0..100 && endPoints[1] in 0..100) {
135-
"Invalid end point: $end should be between 0 to 100 when using relative coordinates."
134+
"Invalid end point: $to should be between 0 to 100 when using relative coordinates."
136135
}
137136
} else {
138-
val endPoints = end
137+
val endPoints = to
139138
.split(",")
140139
.map { it.trim().toInt() }
141-
check(endPoints.size == 2) { "Invalid format for absolute coordinates: $end" }
140+
check(endPoints.size == 2) { "Invalid format for absolute coordinates: $to" }
142141
}
143142

144-
return YamlRelativeCoordinateSwipeElement(from, end, duration, label, optional)
143+
return YamlRelativeCoordinateSwipeElement(from, to, duration, label, optional)
145144
}
146145

147146
private fun resolveCoordinateSwipe(root: TreeNode, duration: Long, label: String?, optional: Boolean): YamlSwipe {

0 commit comments

Comments
 (0)