Skip to content

Commit

Permalink
fix: force cast breaking deserialization of copyText
Browse files Browse the repository at this point in the history
  • Loading branch information
amanjeetsingh150 committed Sep 22, 2023
1 parent 8ef91cc commit 0f056d1
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -526,12 +526,20 @@ data class YamlFluentCommand(
private fun copyTextFromCommand(
copyText: YamlElementSelectorUnion
): MaestroCommand {
return MaestroCommand(
CopyTextFromCommand(
selector = toElementSelector(copyText),
label = (copyText as YamlElementSelector).label
return if (copyText is StringElementSelector) {
MaestroCommand(
CopyTextFromCommand(
selector = toElementSelector(copyText)
)
)
)
} else {
MaestroCommand(
CopyTextFromCommand(
selector = toElementSelector(copyText),
label = (copyText as? YamlElementSelector)?.label
)
)
}
}

private fun scrollUntilVisibleCommand(yaml: YamlScrollUntilVisible): MaestroCommand {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,34 @@ internal class YamlCommandReaderTest {
),
EvalScriptCommand(
scriptString = "false == false"
)
),
TapOnElementCommand(
ElementSelector(
textRegex = "Hello",
),
retryIfNoChange = true,
waitUntilVisible = false,
longPress = false
),
TapOnElementCommand(
selector = ElementSelector(textRegex = "Hello"),
repeat = TapRepeat(2, TapOnElementCommand.DEFAULT_REPEAT_DELAY),
retryIfNoChange = true,
waitUntilVisible = false,
longPress = false
),
TapOnElementCommand(
selector = ElementSelector(textRegex = "Hello"),
longPress = true,
retryIfNoChange = true,
waitUntilVisible = false
),
AssertConditionCommand(
condition = Condition(
visible = ElementSelector(textRegex = "Hello"),
),
),
CopyTextFromCommand(ElementSelector(textRegex = "Hello"))
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ appId: com.example.app
- evalScript: 2 + 1
- evalScript: 2
- evalScript: false == false
- tapOn: "Hello"
- doubleTapOn: "Hello"
- longPressOn: "Hello"
- assertVisible: "Hello"
- copyTextFrom: "Hello"

0 comments on commit 0f056d1

Please sign in to comment.