testability-driver-qt-sut-plugin 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/action.rb +7 -6
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/application.rb +190 -182
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/attribute.rb +2 -2
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/behaviour.rb +17 -17
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb +6 -6
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/events.rb +6 -6
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/find.rb +2 -2
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fixture.rb +10 -14
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fps.rb +7 -7
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/gesture.rb +387 -338
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/infologger.rb +177 -5
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/key_press.rb +5 -5
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/locale_db.rb +2 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/method.rb +34 -7
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/multitouch.rb +4 -4
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/os.rb +4 -4
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/record.rb +6 -6
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/screen_capture.rb +8 -12
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/settings.rb +8 -8
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/sut.rb +171 -115
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/synchronization.rb +2 -2
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/treewidgetitemcolumn.rb +11 -7
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/type_text.rb +2 -2
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/view_item.rb +5 -5
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/webkit.rb +13 -13
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/widget.rb +54 -63
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/find_object.rb +45 -28
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/version.rb +34 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb +2 -2
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/application.rb +174 -121
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/find_object.rb +35 -26
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/version.rb +56 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/plugin.rb +64 -16
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/adapter.rb +138 -40
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/communication.rb +91 -83
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/find_object_generator.rb +222 -44
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/message_composer.rb +176 -10
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/widget.rb +2 -2
- data/xml/behaviour/qt.xml +12 -0
- metadata +7 -5
data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/synchronization.rb
CHANGED
@@ -108,8 +108,8 @@ module MobyBehaviour
|
|
108
108
|
begin
|
109
109
|
|
110
110
|
signals_xml = MobyUtil::XML.parse_string( self.fixture( 'signal', 'get_signal' ) )
|
111
|
-
|
112
|
-
|
111
|
+
_signal_found_xml, unused_rule = @test_object_adapter.get_objects( signals_xml, { :type => 'QtSignal', :name => signal_name}, true )
|
112
|
+
signal_found = true unless _signal_found_xml.empty?
|
113
113
|
|
114
114
|
end # begin
|
115
115
|
|
@@ -81,26 +81,30 @@ module MobyBehaviour
|
|
81
81
|
raise ArgumentError.new( "new_state must be an integer. Check qt docs for allowed values (Qt::CheckState." ) unless new_state.kind_of?(Integer)
|
82
82
|
|
83
83
|
command = MobyCommand::WidgetCommand.new
|
84
|
-
|
84
|
+
|
85
|
+
command.set_object_id(attribute('parentWidget'))
|
86
|
+
|
85
87
|
command.application_id(get_application_id)
|
86
88
|
command.object_type(:Standard)
|
87
|
-
command.command_name('CheckState')
|
88
|
-
|
89
|
-
|
89
|
+
command.command_name('CheckState')
|
90
|
+
|
91
|
+
command.set_event_type( sut_parameters[ :event_type, "0" ] )
|
92
|
+
|
93
|
+
params = {:state => new_state, :column => attribute('column'), :item => attribute('parentItem')}
|
90
94
|
|
91
|
-
|
95
|
+
command.set_event_type( sut_parameters[ :event_type, "0" ] )
|
92
96
|
|
93
97
|
command.command_params(params)
|
94
98
|
@sut.execute_command(command)
|
95
99
|
|
96
100
|
rescue Exception => e
|
97
101
|
|
98
|
-
$logger.
|
102
|
+
$logger.behaviour "FAIL;Failed select"#{identity};drag;"
|
99
103
|
Kernel::raise e
|
100
104
|
|
101
105
|
end
|
102
106
|
|
103
|
-
$logger.
|
107
|
+
$logger.behaviour "PASS;Operation select executed successfully"#{identity};drag;"
|
104
108
|
ret
|
105
109
|
|
106
110
|
end
|
data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/type_text.rb
CHANGED
@@ -77,12 +77,12 @@ module MobyBehaviour
|
|
77
77
|
|
78
78
|
rescue Exception => e
|
79
79
|
|
80
|
-
$logger.
|
80
|
+
$logger.behaviour "FAIL;Failed type_text with text \"#{text}\".;#{identity};type_text;"
|
81
81
|
Kernel::raise e
|
82
82
|
|
83
83
|
end
|
84
84
|
|
85
|
-
$logger.
|
85
|
+
$logger.behaviour "PASS;Operation type_text executed successfully with text \"#{text}\".;#{identity};type_text;"
|
86
86
|
|
87
87
|
ret
|
88
88
|
|
data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/view_item.rb
CHANGED
@@ -60,30 +60,30 @@ module MobyBehaviour
|
|
60
60
|
|
61
61
|
button = :Left
|
62
62
|
command = MobyCommand::WidgetCommand.new
|
63
|
-
command.
|
63
|
+
command.set_object_id(attribute('viewPort'))
|
64
64
|
command.application_id(get_application_id)
|
65
65
|
command.object_type(:Standard)
|
66
66
|
command.command_name('Tap')
|
67
|
-
command.set_event_type(
|
67
|
+
command.set_event_type(sut_parameters[ :event_type, "0" ])
|
68
68
|
|
69
69
|
mouse_move = @sut.parameter[:in_tap_move_pointer]
|
70
70
|
mouse_move = 'false' unless mouse_move
|
71
71
|
|
72
72
|
params = {'x'=>center_x, 'y' => center_y, 'count' => 1, 'button' => @@_buttons_map[button], 'mouseMove'=>mouse_move, 'useCoordinates' => 'true'}
|
73
73
|
|
74
|
-
command.set_event_type(
|
74
|
+
command.set_event_type(sut_parameters[ :event_type, "0" ])
|
75
75
|
|
76
76
|
command.command_params(params)
|
77
77
|
@sut.execute_command(command)
|
78
78
|
|
79
79
|
rescue Exception => e
|
80
80
|
|
81
|
-
$logger.
|
81
|
+
$logger.behaviour "FAIL;Failed select"#{identity};drag;"
|
82
82
|
Kernel::raise e
|
83
83
|
|
84
84
|
end
|
85
85
|
|
86
|
-
$logger.
|
86
|
+
$logger.behaviour "PASS;Operation select executed successfully"#{identity};drag;"
|
87
87
|
ret
|
88
88
|
|
89
89
|
end
|
@@ -76,7 +76,7 @@ module MobyBehaviour
|
|
76
76
|
|
77
77
|
if type != "QWebFrame"
|
78
78
|
command.command_name('ExecuteJavaScriptOnWebElement')
|
79
|
-
webframe_id =
|
79
|
+
webframe_id = attribute('webFrame') if webframe_id.to_s == "0"
|
80
80
|
else
|
81
81
|
command.command_name('ExecuteJavaScriptOnQWebFrame')
|
82
82
|
end
|
@@ -86,7 +86,7 @@ module MobyBehaviour
|
|
86
86
|
'java_script' => java_script,
|
87
87
|
'locator_query' => locator_query,
|
88
88
|
'index' => index.to_s,
|
89
|
-
'elementId' =>
|
89
|
+
'elementId' => @id.to_s,
|
90
90
|
'webframe_id' => webframe_id.to_s
|
91
91
|
}
|
92
92
|
|
@@ -96,12 +96,12 @@ module MobyBehaviour
|
|
96
96
|
|
97
97
|
rescue Exception => e
|
98
98
|
|
99
|
-
$logger.
|
99
|
+
$logger.behaviour "FAIL;Failed send javascript with execute_javascript \"#{java_script}\""
|
100
100
|
Kernel::raise e
|
101
101
|
|
102
102
|
end
|
103
103
|
|
104
|
-
$logger.
|
104
|
+
$logger.behaviour "PASS;Operation send javascript executed successfully with execute_javascript \"#{java_script}\""
|
105
105
|
|
106
106
|
returnValue
|
107
107
|
|
@@ -154,7 +154,7 @@ module MobyBehaviour
|
|
154
154
|
|
155
155
|
if type != "QWebFrame" #&& parent_object.type == "QWebFrame")
|
156
156
|
#webframe_id = parent_object.id
|
157
|
-
webframe_id =
|
157
|
+
webframe_id = attribute('webFrame')
|
158
158
|
end
|
159
159
|
|
160
160
|
execute_javascript_query( java_script, nil, index, webframe_id)
|
@@ -195,13 +195,13 @@ module MobyBehaviour
|
|
195
195
|
temp_id = ""
|
196
196
|
|
197
197
|
if type == "QWebFrame"
|
198
|
-
temp_id =
|
198
|
+
temp_id = @id
|
199
199
|
else
|
200
|
-
temp_id =
|
200
|
+
temp_id = attribute('webFrame')
|
201
201
|
|
202
|
-
elemens_xml_data, unused_rule =
|
202
|
+
elemens_xml_data, unused_rule = @test_object_adapter.get_objects( @sut.xml_data, { :id => attribute('webFrame')}, true )
|
203
203
|
object_xml_data = elemens_xml_data[0]
|
204
|
-
object_attributes =
|
204
|
+
object_attributes = @test_object_adapter.test_object_attributes(object_xml_data)
|
205
205
|
x_absolute = object_attributes['x_absolute'].to_i
|
206
206
|
y_absolute = object_attributes['y_absolute'].to_i
|
207
207
|
width = object_attributes['width'].to_i
|
@@ -230,15 +230,15 @@ module MobyBehaviour
|
|
230
230
|
else
|
231
231
|
#bring fully visible
|
232
232
|
if(center_y.to_i > frame_down_border)
|
233
|
-
dy =
|
233
|
+
dy = attribute("y_absolute").to_i + attribute("height").to_i - y_absolute - height + horizontalScrollBarHeight
|
234
234
|
elsif (center_y.to_i < y_absolute)
|
235
|
-
dy =
|
235
|
+
dy = attribute("y_absolute").to_i - y_absolute
|
236
236
|
end
|
237
237
|
|
238
238
|
if(center_x.to_i > frame_right_border)
|
239
|
-
dx =
|
239
|
+
dx = attribute("x_absolute").to_i + attribute("width").to_i - x_absolute - width + verticalScrollBarWidth
|
240
240
|
elsif (center_x.to_i < x_absolute)
|
241
|
-
dx =
|
241
|
+
dx = attribute("x_absolute").to_i - x_absolute
|
242
242
|
end
|
243
243
|
end
|
244
244
|
end
|
@@ -17,8 +17,6 @@
|
|
17
17
|
##
|
18
18
|
############################################################################
|
19
19
|
|
20
|
-
|
21
|
-
|
22
20
|
# TODO: document
|
23
21
|
module MobyBehaviour
|
24
22
|
|
@@ -70,10 +68,9 @@ module MobyBehaviour
|
|
70
68
|
# Hide all future params in a hash
|
71
69
|
use_tap_screen = false
|
72
70
|
if move_params.kind_of? Hash
|
73
|
-
use_tap_screen = move_params[:use_tap_screen].nil? ?
|
74
|
-
move_params[:use_tap_screen].to_s
|
71
|
+
use_tap_screen = move_params[:use_tap_screen].nil? ? sut_parameters[ :use_tap_screen, 'false'] : move_params[:use_tap_screen].to_s
|
75
72
|
else
|
76
|
-
use_tap_screen =
|
73
|
+
use_tap_screen = sut_parameters[ :use_tap_screen, 'false']
|
77
74
|
end
|
78
75
|
command = command_params #in qt_behaviour
|
79
76
|
command.command_name('MouseMove')
|
@@ -84,8 +81,8 @@ module MobyBehaviour
|
|
84
81
|
'y' => center_y,
|
85
82
|
'useCoordinates' => 'true',
|
86
83
|
'useTapScreen' => use_tap_screen,
|
87
|
-
'x_off' =>
|
88
|
-
'y_off' =>
|
84
|
+
'x_off' => sut_parameters[:tap_x_offset , '0' ],
|
85
|
+
'y_off' => sut_parameters[:tap_y_offset , '0' ]
|
89
86
|
}
|
90
87
|
else
|
91
88
|
params = {'useTapScreen' => use_tap_screen.to_s}
|
@@ -96,11 +93,11 @@ module MobyBehaviour
|
|
96
93
|
|
97
94
|
rescue Exception => e
|
98
95
|
|
99
|
-
$logger.
|
96
|
+
$logger.behaviour "FAIL;Failed to mouse_move"
|
100
97
|
Kernel::raise e
|
101
98
|
end
|
102
99
|
|
103
|
-
$logger.
|
100
|
+
$logger.behaviour "PASS;Operation mouse_move executed successfully"
|
104
101
|
|
105
102
|
nil
|
106
103
|
|
@@ -180,12 +177,11 @@ module MobyBehaviour
|
|
180
177
|
end
|
181
178
|
|
182
179
|
tap_count = tap_params[:tap_count].nil? ? 1 : tap_params[:tap_count]
|
183
|
-
use_tap_screen = tap_params[:use_tap_screen].nil? ?
|
184
|
-
tap_params[:use_tap_screen].to_s
|
180
|
+
use_tap_screen = tap_params[:use_tap_screen].nil? ? sut_parameters[ :use_tap_screen, 'false'] : tap_params[:use_tap_screen].to_s
|
185
181
|
else
|
186
182
|
tap_count = tap_params
|
187
183
|
|
188
|
-
use_tap_screen =
|
184
|
+
use_tap_screen = sut_parameters[ :use_tap_screen, 'false']
|
189
185
|
end
|
190
186
|
|
191
187
|
raise ArgumentError.new( "Invalid button." ) unless @@_valid_buttons.include?(button)
|
@@ -199,10 +195,10 @@ module MobyBehaviour
|
|
199
195
|
params = {
|
200
196
|
'count' => tap_count.to_s,
|
201
197
|
'button' => @@_buttons_map[button],
|
202
|
-
'mouseMove' =>
|
198
|
+
'mouseMove' => sut_parameters[ :in_tap_move_pointer, 'false' ],
|
203
199
|
'useTapScreen' => use_tap_screen,
|
204
|
-
'x_off' =>
|
205
|
-
'y_off' =>
|
200
|
+
'x_off' => sut_parameters[:tap_x_offset , '0' ],
|
201
|
+
'y_off' => sut_parameters[:tap_y_offset , '0' ]
|
206
202
|
}
|
207
203
|
|
208
204
|
|
@@ -224,11 +220,11 @@ module MobyBehaviour
|
|
224
220
|
|
225
221
|
if(attribute('objectType') == 'Web')
|
226
222
|
#check that type is not QWebFrame and that QWebFrame is found for object
|
227
|
-
if type != "QWebFrame" and
|
223
|
+
if type != "QWebFrame" and attributes.key?('webFrame')
|
228
224
|
# puts "tap: " + (Time.now - tapMeasure).to_s + " s - Not q webframe"
|
229
|
-
elemens_xml_data, unused_rule =
|
225
|
+
elemens_xml_data, unused_rule = @test_object_adapter.get_objects( @sut.xml_data, { :id => attribute('webFrame')}, true )
|
230
226
|
object_xml_data = elemens_xml_data[0]
|
231
|
-
object_attributes =
|
227
|
+
object_attributes = @test_object_adapter.test_object_attributes(object_xml_data)
|
232
228
|
x_absolute = object_attributes['x_absolute'].to_i
|
233
229
|
y_absolute = object_attributes['y_absolute'].to_i
|
234
230
|
width = object_attributes['width'].to_i
|
@@ -268,12 +264,12 @@ module MobyBehaviour
|
|
268
264
|
|
269
265
|
rescue Exception => e
|
270
266
|
|
271
|
-
$logger.
|
267
|
+
$logger.behaviour "FAIL;Failed tap with tap_count \"#{tap_count}\", button \"#{button.to_s}\".;#{identity};tap;"
|
272
268
|
Kernel::raise e
|
273
269
|
|
274
270
|
end
|
275
271
|
|
276
|
-
$logger.
|
272
|
+
$logger.behaviour "PASS;Operation tap executed successfully with tap_count \"#{tap_count}\", button \"#{button.to_s}\".;#{identity};tap;"
|
277
273
|
|
278
274
|
# puts "tap: " + (Time.now - tapMeasure).to_s + " s - tapping ending"
|
279
275
|
|
@@ -334,10 +330,9 @@ module MobyBehaviour
|
|
334
330
|
command_name = tap_params[:command].nil? ? 'Tap' : tap_params[:command]
|
335
331
|
behavior_name = tap_params[:behavior_name].nil? ? 'tap_object' : tap_params[:behavior_name]
|
336
332
|
|
337
|
-
use_tap_screen = tap_params[:use_tap_screen].nil? ?
|
338
|
-
tap_params[:use_tap_screen].to_s
|
333
|
+
use_tap_screen = tap_params[:use_tap_screen].nil? ? sut_parameters[ :use_tap_screen, 'false'] : tap_params[:use_tap_screen].to_s
|
339
334
|
else
|
340
|
-
use_tap_screen =
|
335
|
+
use_tap_screen = sut_parameters[ :use_tap_screen, 'false']
|
341
336
|
command_name = 'Tap'
|
342
337
|
behavior_name = 'tap_object'
|
343
338
|
end
|
@@ -355,24 +350,24 @@ module MobyBehaviour
|
|
355
350
|
'y' => ( attribute('y_absolute').to_i + y.to_i ).to_s,
|
356
351
|
'count' => tap_count.to_s,
|
357
352
|
'button' => @@_buttons_map[ button ],
|
358
|
-
'mouseMove' =>
|
353
|
+
'mouseMove' => sut_parameters[ :in_tap_move_pointer, 'false' ],
|
359
354
|
'useCoordinates' => 'true',
|
360
355
|
'useTapScreen' => use_tap_screen,
|
361
|
-
'x_off' =>
|
362
|
-
'y_off' =>
|
356
|
+
'x_off' => sut_parameters[:tap_x_offset , '0' ],
|
357
|
+
'y_off' => sut_parameters[:tap_y_offset , '0' ]
|
363
358
|
|
364
359
|
)
|
365
360
|
|
366
361
|
@sut.execute_command(command)
|
367
362
|
|
368
|
-
rescue Exception => e
|
363
|
+
rescue # Exception => e
|
369
364
|
|
370
|
-
$logger.
|
371
|
-
Kernel::raise
|
365
|
+
$logger.behaviour "FAIL;Failed #{behavior_name} with x \"#{x}\", y \"#{y}\", button \"#{button.to_s}\".;#{identity};#{behavior_name};"
|
366
|
+
Kernel::raise $!
|
372
367
|
|
373
368
|
end
|
374
369
|
|
375
|
-
$logger.
|
370
|
+
$logger.behaviour "PASS;Operation #{behavior_name} executed successfully with x \"#{x}\", y \"#{y}\", button \"#{button.to_s}\".;#{identity};#{behavior_name};"
|
376
371
|
|
377
372
|
nil
|
378
373
|
|
@@ -485,22 +480,20 @@ module MobyBehaviour
|
|
485
480
|
logging_enabled = $logger.enabled
|
486
481
|
$logger.enabled = false
|
487
482
|
|
488
|
-
|
489
483
|
raise ArgumentError.new("First parameter should be time between taps or Hash") unless tap_params.kind_of? Hash or tap_params.kind_of? Fixnum
|
490
484
|
|
491
|
-
|
492
485
|
begin
|
493
486
|
tap_down(button, false, tap_params)
|
494
487
|
sleep time
|
495
488
|
tap_up(button, false, tap_params)
|
496
489
|
rescue Exception => e
|
497
490
|
$logger.enabled = logging_enabled
|
498
|
-
$logger.
|
491
|
+
$logger.behaviour "FAIL;Failed long_tap with time \"#{time.to_s}\", button \"#{button.to_s}\".;#{identity};long_tap;"
|
499
492
|
Kernel::raise e
|
500
493
|
|
501
494
|
end
|
502
495
|
$logger.enabled = logging_enabled
|
503
|
-
$logger.
|
496
|
+
$logger.behaviour "PASS;Operation long_tap executed successfully with time \"#{time.to_s}\", button \"#{button.to_s}\".;#{identity};long_tap;"
|
504
497
|
|
505
498
|
nil
|
506
499
|
|
@@ -552,12 +545,12 @@ module MobyBehaviour
|
|
552
545
|
tap_up_object(x, y, button, tap_params)
|
553
546
|
rescue Exception => e
|
554
547
|
|
555
|
-
$logger.
|
548
|
+
$logger.behaviour "FAIL;Failed long_tap_object with time \"#{time.to_s}\", button \"#{button.to_s}\".;#{identity};long_tap_object;"
|
556
549
|
Kernel::raise e
|
557
550
|
|
558
551
|
end
|
559
552
|
|
560
|
-
$logger.
|
553
|
+
$logger.behaviour "PASS;Operation long_tap_object executed successfully with time \"#{time.to_s}\", button \"#{button.to_s}\".;#{identity};long_tap_object;"
|
561
554
|
|
562
555
|
nil
|
563
556
|
|
@@ -594,8 +587,7 @@ module MobyBehaviour
|
|
594
587
|
def tap_down( button = :Left, refresh = false, tap_params = {} )
|
595
588
|
|
596
589
|
begin
|
597
|
-
use_tap_screen = tap_params[:use_tap_screen].nil? ?
|
598
|
-
tap_params[:use_tap_screen].to_s
|
590
|
+
use_tap_screen = tap_params[:use_tap_screen].nil? ? sut_parameters[ :use_tap_screen, 'false'] : tap_params[:use_tap_screen].to_s
|
599
591
|
tap_params[:useTapScreen] = use_tap_screen
|
600
592
|
|
601
593
|
raise ArgumentError.new( "Invalid button." ) unless @@_valid_buttons.include?(button)
|
@@ -604,10 +596,10 @@ module MobyBehaviour
|
|
604
596
|
|
605
597
|
params = {
|
606
598
|
'button' => @@_buttons_map[button],
|
607
|
-
'mouseMove' =>
|
599
|
+
'mouseMove' => sut_parameters[ :in_tap_move_pointer, 'false' ],
|
608
600
|
'useTapScreen' => use_tap_screen,
|
609
|
-
'x_off' =>
|
610
|
-
'y_off' =>
|
601
|
+
'x_off' => sut_parameters[:tap_x_offset , '0' ],
|
602
|
+
'y_off' => sut_parameters[:tap_y_offset , '0' ]
|
611
603
|
}
|
612
604
|
|
613
605
|
if attribute('objectType') == 'Web' or attribute('objectType') == 'Embedded'
|
@@ -624,12 +616,12 @@ module MobyBehaviour
|
|
624
616
|
|
625
617
|
rescue Exception => e
|
626
618
|
|
627
|
-
$logger.
|
619
|
+
$logger.behaviour "FAIL;Failed tap_down with button \"#{button.to_s}\", refresh \"#{refresh.to_s}\".;#{identity};tap_down;"
|
628
620
|
Kernel::raise e
|
629
621
|
|
630
622
|
end
|
631
623
|
|
632
|
-
$logger.
|
624
|
+
$logger.behaviour "PASS;Operation tap_down executed successfully with with button \"#{button.to_s}\", refresh \"#{refresh.to_s}\".;#{identity};tap_down;"
|
633
625
|
|
634
626
|
nil
|
635
627
|
|
@@ -667,8 +659,7 @@ module MobyBehaviour
|
|
667
659
|
def tap_up( button = :Left, refresh = true, tap_params = {} )
|
668
660
|
|
669
661
|
begin
|
670
|
-
use_tap_screen = tap_params[:use_tap_screen].nil? ?
|
671
|
-
tap_params[:use_tap_screen].to_s
|
662
|
+
use_tap_screen = tap_params[:use_tap_screen].nil? ? sut_parameters[ :use_tap_screen, 'false'] : tap_params[:use_tap_screen].to_s
|
672
663
|
tap_params[:useTapScreen] = use_tap_screen
|
673
664
|
|
674
665
|
raise ArgumentError.new( "Invalid button." ) unless @@_valid_buttons.include?(button)
|
@@ -680,8 +671,8 @@ module MobyBehaviour
|
|
680
671
|
params['x'] = center_x
|
681
672
|
params['y'] = center_y
|
682
673
|
params['useCoordinates'] = 'true'
|
683
|
-
params['x_off'] =
|
684
|
-
params['y_off'] =
|
674
|
+
params['x_off'] = sut_parameters[:tap_x_offset , '0' ]
|
675
|
+
params['y_off'] = sut_parameters[:tap_y_offset , '0' ]
|
685
676
|
|
686
677
|
end
|
687
678
|
params.merge!(tap_params)
|
@@ -694,12 +685,12 @@ module MobyBehaviour
|
|
694
685
|
|
695
686
|
rescue Exception => e
|
696
687
|
|
697
|
-
$logger.
|
688
|
+
$logger.behaviour "FAIL;Failed tap_up with button \"#{button.to_s}\", refresh \"#{refresh.to_s}\".;#{identity};tap_up;"
|
698
689
|
Kernel::raise e
|
699
690
|
|
700
691
|
end
|
701
692
|
|
702
|
-
$logger.
|
693
|
+
$logger.behaviour "PASS;Operation tap_up executed successfully with with button \"#{button.to_s}\", refresh \"#{refresh.to_s}\".;#{identity};tap_up;"
|
703
694
|
|
704
695
|
nil
|
705
696
|
|
@@ -729,20 +720,20 @@ module MobyBehaviour
|
|
729
720
|
'count' => tap_count.to_s,
|
730
721
|
'button' => @@_buttons_map[button],
|
731
722
|
'mouseMove'=>'true',
|
732
|
-
'x_off' =>
|
733
|
-
'y_off' =>
|
723
|
+
'x_off' => sut_parameters[:tap_x_offset , '0' ],
|
724
|
+
'y_off' => sut_parameters[:tap_y_offset , '0' ]
|
734
725
|
)
|
735
726
|
|
736
727
|
@sut.execute_command(command)
|
737
728
|
|
738
729
|
rescue Exception => e
|
739
730
|
|
740
|
-
$logger.
|
731
|
+
$logger.behaviour "FAIL;Failed press with tap_count \"#{tap_count}\", button \"#{button.to_s}\".;#{identity};press;"
|
741
732
|
Kernel::raise e
|
742
733
|
|
743
734
|
end
|
744
735
|
|
745
|
-
$logger.
|
736
|
+
$logger.behaviour "PASS;Operation press executed successfully with tap_count \"#{tap_count}\", button \"#{button.to_s}\".;#{identity};press;"
|
746
737
|
|
747
738
|
nil
|
748
739
|
|
@@ -760,11 +751,11 @@ module MobyBehaviour
|
|
760
751
|
begin
|
761
752
|
long_tap(time, button)
|
762
753
|
rescue Exception => e
|
763
|
-
$logger.
|
754
|
+
$logger.behaviour "FAIL;Failed long_press with time \"#{time.to_s}\", button \"#{button.to_s}\".;#{identity};long_press;"
|
764
755
|
Kernel::raise e
|
765
756
|
end
|
766
757
|
|
767
|
-
$logger.
|
758
|
+
$logger.behaviour "PASS;Operation long_press executed successfully with time \"#{time.to_s}\", button \"#{button.to_s}\".;#{identity};long_press;"
|
768
759
|
|
769
760
|
nil
|
770
761
|
|
@@ -785,12 +776,12 @@ module MobyBehaviour
|
|
785
776
|
|
786
777
|
rescue Exception => e
|
787
778
|
|
788
|
-
$logger.
|
779
|
+
$logger.behaviour "FAIL;Failed hold with button \"#{button.to_s}\", refresh \"#{refresh.to_s}\".;#{identity};hold;"
|
789
780
|
Kernel::raise e
|
790
781
|
|
791
782
|
end
|
792
783
|
|
793
|
-
$logger.
|
784
|
+
$logger.behaviour "PASS;Operation hold executed successfully with with button \"#{button.to_s}\", refresh \"#{refresh.to_s}\".;#{identity};hold;"
|
794
785
|
|
795
786
|
nil
|
796
787
|
|
@@ -811,12 +802,12 @@ module MobyBehaviour
|
|
811
802
|
|
812
803
|
rescue Exception => e
|
813
804
|
|
814
|
-
$logger.
|
805
|
+
$logger.behaviour "FAIL;Failed release with button \"#{button.to_s}\", refresh \"#{refresh.to_s}\".;#{identity};release;"
|
815
806
|
Kernel::raise e
|
816
807
|
|
817
808
|
end
|
818
809
|
|
819
|
-
$logger.
|
810
|
+
$logger.behaviour "PASS;Operation release executed successfully with with button \"#{button.to_s}\", refresh \"#{refresh.to_s}\".;#{identity};release;"
|
820
811
|
|
821
812
|
nil
|
822
813
|
|
@@ -826,15 +817,15 @@ module MobyBehaviour
|
|
826
817
|
private
|
827
818
|
|
828
819
|
def center_x
|
829
|
-
x =
|
830
|
-
width =
|
820
|
+
x = attribute('x_absolute').to_i
|
821
|
+
width = attribute('width').to_i
|
831
822
|
x = x + (width/2)
|
832
823
|
x.to_s
|
833
824
|
end
|
834
825
|
|
835
826
|
def center_y
|
836
|
-
y =
|
837
|
-
height =
|
827
|
+
y = attribute('y_absolute').to_i
|
828
|
+
height = attribute('height').to_i
|
838
829
|
y = y + (height/2)
|
839
830
|
y.to_s
|
840
831
|
end
|