24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
# File 'lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/find_object_generator.rb', line 24
def generate_message
sut_parameters = $parameters[ @_sut.id ]
filter_type = sut_parameters[ :filter_type, 'none' ]
plugin_timeout = sut_parameters[ :qttas_plugin_timeout, 10000 ].to_i
if filter_type != 'none'
filters = {}
sut_parameters.if_found( :filter_properties ){ | key, value | filters[ 'filterProperties' ] = value }
sut_parameters.if_found( :plugin_blacklist ){ | key, value | filters[ 'pluginBlackList' ] = value }
sut_parameters.if_found( :plugin_whitelist ){ | key, value | filters[ 'pluginWhiteList' ] = value }
sut_parameters.if_found( :use_view_crop ){ | key, value | filters[ 'useViewCrop' ] = value }
case filter_type
when 'dynamic'
value = TDriver::AttributeFilter.filter_string
filters[ 'attributeWhiteList' ] = value unless value.blank?
when 'static'
sut_parameters.if_found( :attribute_blacklist ){ | key, value | filters[ 'attributeBlackList' ] = value }
sut_parameters.if_found( :attribute_whitelist ){ | key, value | filters[ 'attributeWhiteList' ] = value }
end
else
filters = {}
end
xml = "<TasCommands plugin_timeout=\"#{plugin_timeout}\" service=\"findObject\" #{ @_app_details.to_attributes }"
unless @_params.empty?
xml << '><Target>'
objects = ""
@_params.reverse_each{ | parameters |
if parameters == @_params.last
objects = "<object #{ parameters.to_attributes } />"
else
objects = "<object #{ parameters.to_attributes }>#{ objects }</object>"
end
}
xml << objects
xml << '<Command name="findObject">'
filters.each{ | name, value | xml << "<param name=\"#{ name }\" value=\"#{ value }\" />" }
xml << '</Command></Target></TasCommands>'
else
xml << ' />'
end
xml
end
|