cutedriver-qt-sut-plugin 2.0.0.20210120165900

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +7 -0
  2. data/env.rb +24 -0
  3. data/installer/extconf.rb +62 -0
  4. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin.rb +23 -0
  5. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/action.rb +157 -0
  6. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/application.rb +312 -0
  7. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/attribute.rb +300 -0
  8. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/behaviour.rb +214 -0
  9. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb +317 -0
  10. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/cute_cpu.rb +145 -0
  11. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/cute_gpu.rb +147 -0
  12. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/cute_mem.rb +142 -0
  13. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/cute_pwr.rb +146 -0
  14. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/events.rb +192 -0
  15. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/file_transfer.rb +375 -0
  16. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/find.rb +82 -0
  17. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fixture.rb +214 -0
  18. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fps.rb +189 -0
  19. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/gesture.rb +1039 -0
  20. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/infologger.rb +767 -0
  21. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/key_press.rb +166 -0
  22. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/locale_db.rb +157 -0
  23. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/method.rb +112 -0
  24. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/multitouch.rb +474 -0
  25. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/os.rb +100 -0
  26. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/qt_api_method.rb +148 -0
  27. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/record.rb +134 -0
  28. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/screen_capture.rb +279 -0
  29. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/settings.rb +302 -0
  30. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/sut.rb +840 -0
  31. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/synchronization.rb +257 -0
  32. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/treewidgetitemcolumn.rb +117 -0
  33. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/type_text.rb +97 -0
  34. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/view_item.rb +97 -0
  35. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/webkit.rb +272 -0
  36. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/widget.rb +877 -0
  37. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/action.rb +30 -0
  38. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/configure_command.rb +38 -0
  39. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/drag.rb +44 -0
  40. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/find_object.rb +67 -0
  41. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/group.rb +44 -0
  42. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/infologger_command.rb +38 -0
  43. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb +171 -0
  44. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/tap.rb +54 -0
  45. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/version.rb +34 -0
  46. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb +199 -0
  47. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/agent.rb +54 -0
  48. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/application.rb +192 -0
  49. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/configure_command.rb +53 -0
  50. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/find_object.rb +48 -0
  51. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/fixture.rb +65 -0
  52. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/group.rb +57 -0
  53. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/infologger_command.rb +53 -0
  54. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/key_sequence.rb +93 -0
  55. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/screen_capture.rb +53 -0
  56. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/tap.rb +62 -0
  57. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/version.rb +46 -0
  58. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/widget.rb +98 -0
  59. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/plugin.rb +200 -0
  60. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/adapter.rb +466 -0
  61. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/communication.rb +185 -0
  62. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/controller.rb +69 -0
  63. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/find_object_generator.rb +287 -0
  64. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/fixture_parameter.rb +77 -0
  65. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/message_composer.rb +370 -0
  66. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/widget.rb +79 -0
  67. data/lib/testability-driver-qt-sut-plugin.rb +24 -0
  68. data/xml/behaviour/qt.xml +845 -0
  69. data/xml/defaults/sut_qt.xml +9 -0
  70. data/xml/keymap/qt.xml +321 -0
  71. data/xml/keymap/win.xml +174 -0
  72. data/xml/template/qt.xml +141 -0
  73. metadata +127 -0
@@ -0,0 +1,317 @@
1
+ ############################################################################
2
+ ##
3
+ ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
+ ## All rights reserved.
5
+ ## Contact: Nokia Corporation (testabilitydriver@nokia.com)
6
+ ##
7
+ ## This file is part of TDriver.
8
+ ##
9
+ ## If you have questions regarding the use of this file, please contact
10
+ ## Nokia at testabilitydriver@nokia.com .
11
+ ##
12
+ ## This library is free software; you can redistribute it and/or
13
+ ## modify it under the terms of the GNU Lesser General Public
14
+ ## License version 2.1 as published by the Free Software Foundation
15
+ ## and appearing in the file LICENSE.LGPL included in the packaging
16
+ ## of this file.
17
+ ##
18
+ ############################################################################
19
+
20
+ module MobyBehaviour
21
+
22
+ module QT
23
+
24
+ # == description
25
+ # Behaviours for configuring the logging services on the target.
26
+ #
27
+ # == behaviour
28
+ # QtConfigureBehaviour
29
+ #
30
+ # == requires
31
+ # testability-driver-qt-sut-plugin
32
+ #
33
+ # == sut_type
34
+ # qt
35
+ #
36
+ # == input_type
37
+ # All
38
+ #
39
+ # == sut_version
40
+ # *
41
+ #
42
+ # == objects
43
+ # sut;application
44
+ #
45
+ module ConfigureBehaviour
46
+
47
+ include MobyBehaviour::QT::Behaviour
48
+
49
+ @@_valid_levels = [ :FATAL, :ERROR, :INFO, :WARNING, :DEBUG ]
50
+
51
+ # == description
52
+ # Enabled the logging on the target for the given application or sut (qttasserver).
53
+ # Logs are written to the target in (/logs/testability)
54
+ #
55
+ # == returns
56
+ # NilClass
57
+ # description: -
58
+ # example: -
59
+ #
60
+ # == exceptions
61
+ # ArgumentError
62
+ # description: In case the given parameters are not valid.
63
+ def enable_logger
64
+ configure_logger( {:logEnabled => true} )
65
+ end
66
+
67
+ # == description
68
+ # Disable the logging on the target for the given application or sut (qttasserver).
69
+ # Logs are left as they are.
70
+ #
71
+ # == returns
72
+ # NilClass
73
+ # description: -
74
+ # example: -
75
+ #
76
+ # == exceptions
77
+ # ArgumentError
78
+ # description: In case the given parameters are not valid.
79
+ def disable_logger
80
+ configure_logger( {:logEnabled => false} )
81
+ end
82
+
83
+ # == description
84
+ # Set the log level for the application or sut (qttasserver). Affects only the running process.
85
+ # Will not be stored as permanent setting.
86
+ #
87
+ # == arguments
88
+ # level
89
+ # Symbol
90
+ # description:
91
+ # The log level.
92
+ # See [link="#log_levels_table"]Valid log levels table[/link] for valid keys.
93
+ # example: :INFO
94
+ #
95
+ # == tables
96
+ # log_levels_table
97
+ # title: Valid log levels
98
+ # |Level|Type|Description|
99
+ # |:FATAL|Symbol|Log fatal level message|
100
+ # |:ERROR|Symbol|Log fatal and error level messages|
101
+ # |:INFO|Symbol|Log fatal, error and info level messages|
102
+ # |:WARNING|Symbol|Log fatal, error, info and warning level messages|
103
+ # |:DEBUG|Symbol|Log all messages|
104
+ #
105
+ # == returns
106
+ # NilClass
107
+ # description: -
108
+ # example: -
109
+ #
110
+ # == exceptions
111
+ # ArgumentError
112
+ # description: In case the given level is not valid.
113
+ def set_log_level(level)
114
+ configure_logger( {:logLevel => level} )
115
+ end
116
+
117
+ # == description
118
+ # Change the folder to where the logs are written to for the application or sut (qttasserver).
119
+ #
120
+ # == arguments
121
+ # folder
122
+ # String
123
+ # description:
124
+ # New location for the logs.
125
+ # example: '/tmp/logs'
126
+ #
127
+ # == returns
128
+ # NilClass
129
+ # description: -
130
+ # example: -
131
+ def set_log_folder(folder)
132
+ configure_logger( {:logFolder => folder} )
133
+ end
134
+
135
+ # == description
136
+ # Can be used to set logging to be done to qDebug. All tdriver target logging
137
+ # will go to qDebug not the log file.
138
+ #
139
+ # == arguments
140
+ # to_qdebug
141
+ # Boolean
142
+ # description:
143
+ # True to logs message to qDebug instead of a file.
144
+ # example: true
145
+ #
146
+ # == returns
147
+ # NilClass
148
+ # description: -
149
+ # example: -
150
+ def log_to_qdebug(to_qdebug = true)
151
+ configure_logger( {:logToQDebug => to_qdebug} )
152
+ end
153
+
154
+ # == description
155
+ # Set the qDebug message to be append to the logs or not.
156
+ # By default qDebug messages are not written to the logs.
157
+ #
158
+ # == arguments
159
+ # include
160
+ # Boolean
161
+ # description:
162
+ # True to log qDebug messages and false to not
163
+ # example: true
164
+ #
165
+ # == returns
166
+ # NilClass
167
+ # description: -
168
+ # example: -
169
+ def log_qdebug(include = true)
170
+ configure_logger( {:logQDebug => include} )
171
+ end
172
+
173
+ # == description
174
+ # Set max size for the log file. When the level is reached the log file is renamed
175
+ # as old_"name of log file".log and a new file is started. By default the size is
176
+ # 100000.
177
+ #
178
+ # == arguments
179
+ # size
180
+ # Fixnum
181
+ # description:
182
+ # The new log file size
183
+ # example: 500000
184
+ #
185
+ # == returns
186
+ # NilClass
187
+ # description: -
188
+ # example: -
189
+ def set_log_size(size)
190
+ configure_logger( {:logSize => size} )
191
+ end
192
+
193
+ # == description
194
+ # Clears the log file.
195
+ #
196
+ # == returns
197
+ # NilClass
198
+ # description: -
199
+ # example: -
200
+ def clear_log
201
+ configure_logger( {:clearLog => true} )
202
+ end
203
+
204
+ # == description
205
+ # Set the logger to log listed events. Events have to be separated by comma.
206
+ # e.g MouseEvent, Paint
207
+ # The event name does not have to be complete. e.g Mouse will log all events with the
208
+ # word Mouse.
209
+ #
210
+ # == arguments
211
+ # event_list
212
+ # String
213
+ # description:
214
+ # Comma separated list of events
215
+ # example: 'Mouse','Touch'
216
+ #
217
+ # == returns
218
+ # NilClass
219
+ # description: -
220
+ # example: -
221
+ #
222
+ def log_events( event_list = '')
223
+ begin
224
+
225
+ params = {:logEvents => 'true'}
226
+ perform_command( MobyCommand::ConfigureCommand.new( "configureEventLogging", params, event_list ) )
227
+
228
+ rescue Exception => e
229
+
230
+ $logger.behaviour "FAIL;Failed to enable event logging. With event_list \"#{event_list};log_events"
231
+ raise e
232
+
233
+ end
234
+
235
+ $logger.behaviour "PASS;Event logging enabled. With event_list \"#{event_list};log_events"
236
+
237
+ end
238
+
239
+ # == description
240
+ # Stop logging events.
241
+ #
242
+ # == returns
243
+ # NilClass
244
+ # description: -
245
+ # example: -
246
+ #
247
+ def stop_event_logging
248
+ begin
249
+
250
+ params = {:logEvents => 'false'}
251
+ perform_command( MobyCommand::ConfigureCommand.new( "configureEventLogging", params) )
252
+
253
+ rescue Exception => e
254
+
255
+ $logger.behaviour "FAIL;Failed to stop event logging.;stop_event_logging"
256
+ raise e
257
+
258
+ end
259
+
260
+ $logger.behaviour "PASS;Event logging stopped.;stop_event_logging"
261
+
262
+ end
263
+
264
+ private
265
+
266
+ # Configure the logger for qttasserver and plugins
267
+ # Parameters are to be passed as a hash with one or more
268
+ # of the following values:
269
+ # :logLevel => :DEBUG (or :FATAL, :ERROR, :INFO or :WARNING. DEBUG will log the most)
270
+ # :logToQDebug => true/false
271
+ # :logFolder => '/tmp/logs/'
272
+ # :logQDebug => true/false
273
+ # :logSize => 10000
274
+ # :logEnabled => true/false
275
+ def configure_logger( params_hash = nil)
276
+
277
+ begin
278
+ raise ArgumentError.new( "No parameters given." ) unless params_hash
279
+
280
+ log_level = params_hash[:logLevel]
281
+
282
+ if log_level
283
+ raise ArgumentError.new( "Invalid log level." ) unless @@_valid_levels.include?(log_level)
284
+ end
285
+
286
+ perform_command(MobyCommand::ConfigureCommand.new( "configureLogger", params_hash ))
287
+
288
+ rescue Exception => e
289
+
290
+ $logger.behaviour "FAIL;Failed to configure logger. With params \"#{params_hash.to_s};configure_logger"
291
+ raise e
292
+
293
+ end
294
+
295
+ $logger.behaviour "PASS;Succesfully configured logger. With params \"#{params_hash.to_s};configure_logger"
296
+
297
+ end
298
+
299
+ def perform_command(command)
300
+
301
+ if self.class == MobyBase::SUT
302
+ execute_command( command )
303
+ else
304
+ command.application_id = get_application_id
305
+ @sut.execute_command( command )
306
+ end
307
+
308
+ end
309
+
310
+ # enable hooking for performance measurement & debug logging
311
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
312
+
313
+ end # ConfigureBehaviour
314
+
315
+ end # QT
316
+
317
+ end # MobyBehaviour
@@ -0,0 +1,145 @@
1
+ ############################################################################
2
+ ##
3
+ ## Copyright (C) 2017 Link Motion Oy
4
+ ## Author(s): Juhapekka Piiroinen <juhapekka.piiroinen@link-motion.com>
5
+ ##
6
+ ## All rights reserved.
7
+ ## Contact: Link Motion (info@link-motion.com)
8
+ ##
9
+ ## This file is part of CuteDriver.
10
+ ##
11
+ ## This library is free software; you can redistribute it and/or
12
+ ## modify it under the terms of the GNU Lesser General Public
13
+ ## License version 2.1 as published by the Free Software Foundation
14
+ ## and appearing in the file LICENSE.LGPL included in the packaging
15
+ ## of this file.
16
+ ##
17
+ ############################################################################
18
+
19
+ module MobyBehaviour
20
+
21
+ module QT
22
+
23
+ # == description
24
+ #
25
+ # == behaviour
26
+ # QtCpu
27
+ #
28
+ # == requires
29
+ # testability-driver-qt-sut-plugin
30
+ #
31
+ # == input_type
32
+ # *
33
+ #
34
+ # == sut_type
35
+ # QT
36
+ #
37
+ # == sut_version
38
+ # *
39
+ #
40
+ # == objects
41
+ # *
42
+ #
43
+ module Cpu
44
+
45
+ include MobyBehaviour::QT::Behaviour
46
+
47
+ # == description
48
+ # Start collecting CPU usage per second data for the app.
49
+ #
50
+ # == returns
51
+ # NilClass
52
+ # description: -
53
+ # example: -
54
+ #
55
+ # == exceptions
56
+ # ArgumentError
57
+ # description: In case the given parameters are not valid.
58
+ #
59
+ def start_cpu_measurement
60
+
61
+ begin
62
+
63
+ log_cpu(:interval => 1, :filePath => '/tmp')
64
+
65
+ rescue Exception
66
+
67
+ $logger.behaviour "FAIL;Failed start_cpu_measurement.;#{ identity };start_cpu_measurement;"
68
+ raise
69
+
70
+ end
71
+
72
+ $logger.behaviour "PASS;Operation start_cpu_measurement executed successfully.;#{ identity };start_cpu_measurement;"
73
+
74
+ nil
75
+
76
+ end
77
+
78
+ # == description
79
+ # Stop collecting CPU usage data for the object.
80
+ #
81
+ # == returns
82
+ # Array
83
+ # description: An Array of CPU entries. Each entry is a hash table that contains the value and time stamp {value => 42.00, cpuLoad => 42.00, time_stamp => 06:49:42.259}
84
+ # example: [{value => 42.0, cpuLoad => 42.0, time_stamp => 06:49:42.259}, {value => 32.0, cpuLoad => 32.0, time_stamp => 06:49:43.259}]
85
+ #
86
+ # == exceptions
87
+ # ArgumentError
88
+ # description: In case the given parameters are not valid.
89
+ #
90
+ def stop_cpu_measurement
91
+
92
+ begin
93
+
94
+ results = parse_results_cpu( stop_cpu_log() )
95
+
96
+ rescue Exception
97
+
98
+ $logger.behaviour "FAIL;Failed stop_cpu_measurement.;#{ identity };stop_cpu_measurement;"
99
+
100
+ raise
101
+
102
+ end
103
+
104
+ $logger.behaviour "PASS;Operation stop_cpu_measurement executed successfully.;#{ identity };stop_cpu_measurement;"
105
+
106
+ results
107
+
108
+ end
109
+
110
+
111
+ private
112
+
113
+ def parse_results_cpu( results_xml )
114
+
115
+ state_object = @sut.state_object( results_xml )
116
+
117
+ results = []
118
+
119
+ count = state_object.logData.attribute( 'entryCount' ).to_i
120
+
121
+ for i in 0...count
122
+
123
+ cpuLoad = state_object.logEntry(:id => i.to_s).attribute('cpuLoad').to_f
124
+
125
+ time_stamp = state_object.logEntry(:id => i.to_s).attribute('timeStamp')
126
+
127
+ entry = {:value => cpuLoad, :cpuLoad => cpuLoad, :time_stamp => time_stamp}
128
+
129
+ results.push(entry)
130
+
131
+ end
132
+
133
+ results
134
+
135
+ end
136
+
137
+ # enable hooking for performance measurement & debug logging
138
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
139
+
140
+ end # Cpu
141
+
142
+ end # QT
143
+
144
+ end # MobyBase
145
+