File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed
maestro-orchestra/src/test
resources/YamlCommandReaderTest Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include
4
4
import com.fasterxml.jackson.databind.ObjectMapper
5
5
import com.fasterxml.jackson.module.kotlin.KotlinModule
6
6
import com.google.common.truth.Truth.assertThat
7
+ import maestro.DeviceOrientation
7
8
import maestro.KeyCode
8
9
import maestro.Point
9
10
import org.intellij.lang.annotations.Language
@@ -590,6 +591,33 @@ internal class MaestroCommandSerializationTest {
590
591
.isEqualTo(command)
591
592
}
592
593
594
+ @Test
595
+ fun `serialize SetOrientationCommand` () {
596
+ // given
597
+ val command = MaestroCommand (
598
+ SetOrientationCommand (DeviceOrientation .PORTRAIT )
599
+ )
600
+
601
+ // when
602
+ val serializedCommandJson = command.toJson()
603
+ val deserializedCommand = objectMapper.readValue(serializedCommandJson, MaestroCommand ::class .java)
604
+
605
+ // then
606
+ @Language(" json" )
607
+ val expectedJson = """
608
+ {
609
+ "setOrientationCommand" : {
610
+ "orientation" : "PORTRAIT",
611
+ "optional" : false
612
+ }
613
+ }
614
+ """ .trimIndent()
615
+ assertThat(serializedCommandJson)
616
+ .isEqualTo(expectedJson)
617
+ assertThat(deserializedCommand)
618
+ .isEqualTo(command)
619
+ }
620
+
593
621
private fun MaestroCommand.toJson (): String =
594
622
objectMapper
595
623
.writerWithDefaultPrettyPrinter()
Original file line number Diff line number Diff line change 1
1
package maestro.orchestra.yaml
2
2
3
3
import com.google.common.truth.Truth.assertThat
4
+ import maestro.DeviceOrientation
4
5
import maestro.KeyCode
5
6
import maestro.ScrollDirection
6
7
import maestro.SwipeDirection
@@ -35,6 +36,7 @@ import maestro.orchestra.PressKeyCommand
35
36
import maestro.orchestra.RepeatCommand
36
37
import maestro.orchestra.RunFlowCommand
37
38
import maestro.orchestra.RunScriptCommand
39
+ import maestro.orchestra.SetOrientationCommand
38
40
import maestro.orchestra.ScrollCommand
39
41
import maestro.orchestra.ScrollUntilVisibleCommand
40
42
import maestro.orchestra.SetAirplaneModeCommand
@@ -427,6 +429,10 @@ internal class YamlCommandReaderTest {
427
429
sourceDescription = " 023_runScript_test.js" ,
428
430
label = " Run some special calculations"
429
431
),
432
+ SetOrientationCommand (
433
+ orientation = Orientation .LANDSCAPE_LEFT ,
434
+ label = " Set the device orientation"
435
+ ),
430
436
ScrollCommand (
431
437
label = " Scroll down"
432
438
),
Original file line number Diff line number Diff line change @@ -81,6 +81,9 @@ appId: com.example.app
81
81
- runScript :
82
82
file : " 023_runScript_test.js"
83
83
label : " Run some special calculations"
84
+ - setOrientation :
85
+ orientation : " LANDSCAPE_LEFT"
86
+ label : " Set the device orientation"
84
87
- scroll :
85
88
label : " Scroll down"
86
89
- scrollUntilVisible :
You can’t perform that action at this time.
0 commit comments