@@ -35,6 +35,8 @@ def test_toggle_touch_id_enrollment
35
35
# Screen recording
36
36
37
37
def test_start_recording_screen
38
+ skip 'Only XCUITest supports' unless @core . automation_name == :xcuitest
39
+
38
40
stub_request ( :post , "#{ SESSION } /appium/start_recording_screen" )
39
41
. with ( body : { options : { videoType : 'mjpeg' , timeLimit : '180' , videoQuality : 'medium' } } . to_json )
40
42
. to_return ( headers : HEADER , status : 200 , body : { value : [ 'a' ] } . to_json )
@@ -45,6 +47,8 @@ def test_start_recording_screen
45
47
end
46
48
47
49
def test_start_recording_screen_custom
50
+ skip 'Only XCUITest supports' unless @core . automation_name == :xcuitest
51
+
48
52
stub_request ( :post , "#{ SESSION } /appium/start_recording_screen" )
49
53
. with ( body : { options : {
50
54
videoType : 'libx264' , timeLimit : '60' , videoQuality : 'medium' , videoScale : '320:240'
@@ -57,6 +61,8 @@ def test_start_recording_screen_custom
57
61
end
58
62
59
63
def test_start_recording_screen_custom_force
64
+ skip 'Only XCUITest supports' unless @core . automation_name == :xcuitest
65
+
60
66
stub_request ( :post , "#{ SESSION } /appium/start_recording_screen" )
61
67
. with ( body :
62
68
{ options : { forceRestart : true , videoType : 'libx264' , timeLimit : '60' , videoQuality : 'medium' } } . to_json )
@@ -68,6 +74,8 @@ def test_start_recording_screen_custom_force
68
74
end
69
75
70
76
def test_stop_recording_screen_default
77
+ skip 'Only XCUITest supports' unless @core . automation_name == :xcuitest
78
+
71
79
stub_request ( :post , "#{ SESSION } /appium/stop_recording_screen" )
72
80
. with ( body : { } . to_json )
73
81
. to_return ( headers : HEADER , status : 200 , body : { value : [ 'a' ] } . to_json )
@@ -89,6 +97,8 @@ def test_stop_recording_screen_custom
89
97
end
90
98
91
99
def test_get_battery_info
100
+ skip 'Only XCUITest supports' unless @core . automation_name == :xcuitest
101
+
92
102
stub_request ( :post , "#{ SESSION } /execute" )
93
103
. with ( body : { script : 'mobile: batteryInfo' , args : [ { } ] } . to_json )
94
104
. to_return ( headers : HEADER , status : 200 , body : { value : { state : 3 , level : 1.0 } } . to_json )
@@ -99,6 +109,32 @@ def test_get_battery_info
99
109
assert_equal :full , info [ :state ]
100
110
assert_equal 1.0 , info [ :level ]
101
111
end
112
+
113
+ def test_method_missing
114
+ stub_request ( :get , "#{ SESSION } /element/id/attribute/name" )
115
+ . to_return ( headers : HEADER , status : 200 , body : { value : '' } . to_json )
116
+
117
+ e = ::Selenium ::WebDriver ::Element . new ( @driver . send ( :bridge ) , 'id' )
118
+ e . name
119
+
120
+ assert_requested ( :get , "#{ SESSION } /element/id/attribute/name" , times : 1 )
121
+ end
122
+
123
+ def test_background_app
124
+ if @core . automation_name == :xcuitest
125
+ stub_request ( :post , "#{ SESSION } /appium/app/background" )
126
+ . with ( body : { seconds : { timeout : 0 } } . to_json )
127
+ . to_return ( headers : HEADER , status : 200 , body : { value : '' } . to_json )
128
+ else
129
+ stub_request ( :post , "#{ SESSION } /appium/app/background" )
130
+ . with ( body : { seconds : 0 } . to_json )
131
+ . to_return ( headers : HEADER , status : 200 , body : { value : '' } . to_json )
132
+ end
133
+
134
+ @driver . background_app 0
135
+
136
+ assert_requested ( :post , "#{ SESSION } /appium/app/background" , times : 1 )
137
+ end
102
138
end # class CommandsTest
103
139
end # module MJSONWP
104
140
end # module Device
0 commit comments