itms_automation 2.1 → 2.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/bin/generate.rb +3 -37
  3. data/bin/helper.rb +23 -10
  4. data/bin/itms_automation +18 -23
  5. data/doc/installation.md +16 -0
  6. data/doc/itms-automation-API.md +103 -0
  7. data/doc/itms-automation-help.md +18 -0
  8. data/example/android/android_app/android_app_calculator.zip +0 -0
  9. data/example/android/android_app/android_app_calculator/AndroidCalculator.apk +0 -0
  10. data/example/android/android_app/android_app_calculator/features/calculator.feature +36 -0
  11. data/example/android/android_app/android_app_calculator/features/my_first.feature +13 -0
  12. data/example/android/android_app/android_app_calculator/features/screenshots/test.png +0 -0
  13. data/example/android/android_app/android_app_calculator/features/step_definitions/custom_steps.rb +5 -0
  14. data/example/android/android_app/android_app_calculator/features/support/env.rb +52 -0
  15. data/example/android/android_app/android_app_calculator/features/support/hooks.rb +26 -0
  16. data/example/android/android_web/android_web_gmail_login.zip +0 -0
  17. data/example/android/android_web/android_web_gmail_login/features/gmail_login.feature +12 -0
  18. data/example/android/android_web/android_web_gmail_login/features/my_first.feature +1 -0
  19. data/example/android/android_web/android_web_gmail_login/features/screenshots/test.png +0 -0
  20. data/example/android/android_web/android_web_gmail_login/features/step_definitions/custom_steps.rb +5 -0
  21. data/example/android/android_web/android_web_gmail_login/features/support/env.rb +51 -0
  22. data/example/android/android_web/android_web_gmail_login/features/support/hooks.rb +27 -0
  23. data/example/desktop web/desktop_web_gmail_login.zip +0 -0
  24. data/example/desktop web/desktop_web_gmail_login/features/gmail_login.feature +9 -0
  25. data/example/desktop web/desktop_web_gmail_login/features/gmail_multi_login.feature +21 -0
  26. data/example/desktop web/desktop_web_gmail_login/features/my_first.feature +1 -0
  27. data/example/desktop web/desktop_web_gmail_login/features/screenshots/test.png +0 -0
  28. data/example/desktop web/desktop_web_gmail_login/features/step_definitions/custom_steps.rb +5 -0
  29. data/example/desktop web/desktop_web_gmail_login/features/support/env.rb +51 -0
  30. data/example/desktop web/desktop_web_gmail_login/features/support/hooks.rb +26 -0
  31. data/features-skeleton/my_first.feature +5 -0
  32. data/features-skeleton/screenshots/test.png +0 -0
  33. data/features-skeleton/step_definitions/custom_steps.rb +5 -0
  34. data/features-skeleton/support/env.rb +104 -0
  35. data/features-skeleton/support/hooks.rb +74 -0
  36. data/lib/itms_automation.rb +1 -3
  37. data/lib/itms_automation/assertion_steps.rb +68 -0
  38. data/lib/itms_automation/click_elements_steps.rb +24 -0
  39. data/lib/itms_automation/configuration_steps.rb +7 -0
  40. data/lib/itms_automation/input_steps.rb +59 -0
  41. data/lib/itms_automation/javascript_handling_steps.rb +10 -0
  42. data/lib/itms_automation/methods/assertion_methods.rb +344 -0
  43. data/lib/itms_automation/methods/click_elements_methods.rb +23 -0
  44. data/lib/itms_automation/methods/configuration_methods.rb +35 -0
  45. data/lib/itms_automation/methods/error_handling_methods.rb +87 -0
  46. data/lib/itms_automation/methods/input_methods.rb +69 -0
  47. data/lib/itms_automation/methods/javascript_handling_methods.rb +9 -0
  48. data/lib/itms_automation/methods/misc_methods.rb +47 -0
  49. data/lib/itms_automation/methods/navigate_methods.rb +123 -0
  50. data/lib/itms_automation/methods/progress_methods.rb +15 -0
  51. data/lib/itms_automation/methods/required_files.rb +9 -0
  52. data/lib/itms_automation/methods/screenshot_methods.rb +6 -0
  53. data/lib/itms_automation/navigation_steps.rb +79 -0
  54. data/lib/itms_automation/progress_steps.rb +17 -0
  55. data/lib/itms_automation/screenshot_steps.rb +6 -0
  56. data/lib/itms_automation/version.rb +5 -3
  57. metadata +84 -102
  58. data/bin/console +0 -14
  59. data/bin/documentation_generator.rb +0 -119
  60. data/bin/setup +0 -8
  61. data/lib/itms_automation/all_steps.rb +0 -8
  62. data/lib/itms_automation/assertion_helper.rb +0 -29
  63. data/lib/itms_automation/auto_util.rb +0 -694
  64. data/lib/itms_automation/database_steps_helper.rb +0 -125
  65. data/lib/itms_automation/web_steps_helper.rb +0 -606
  66. data/project/Gemfile +0 -3
  67. data/project/Gemfile.lock +0 -92
  68. data/project/README.md +0 -34
  69. data/project/Rakefile +0 -24
  70. data/project/config/chrome_headless_options.yaml +0 -1
  71. data/project/config/chrome_options.yaml +0 -6
  72. data/project/config/firefox_headless_options.yaml +0 -1
  73. data/project/config/firefox_options.yaml +0 -1
  74. data/project/config/ie_options.yaml +0 -1
  75. data/project/config/remote_options.yaml +0 -6
  76. data/project/config/safari_options.yaml +0 -1
  77. data/project/cucumber.yml +0 -4
  78. data/project/features/TestSuite/WebGUI.feature +0 -5
  79. data/project/features/step_definitions/lib_steps/steps_definition.rb +0 -46
  80. data/project/features/step_definitions/repositories/project_object.yml +0 -26
  81. data/project/features/support/env.rb +0 -9
  82. data/project/features/support/hooks.rb +0 -130
@@ -1,8 +0,0 @@
1
- # coding: UTF-8
2
-
3
- Dir[File.join(File.dirname(__FILE__), '*_steps.rb')].each do |f|
4
- name = File.basename(f, '.rb')
5
- unless name == 'all_steps'
6
- require "itms_automation/#{name}"
7
- end
8
- end
@@ -1,29 +0,0 @@
1
- def do_assertion_json expected_obj, actual_obj
2
- if expected_obj.kind_of? Array
3
- is_contain = true
4
- expected_obj.each_with_index do |expected, index|
5
- is_contain = do_assertion_json(expected, actual_obj)
6
- @expected.shift if is_contain == true
7
- return is_contain if is_contain == false || index == expected_obj.length - 1
8
- end
9
- elsif expected_obj.kind_of? Hash
10
- is_contain = true
11
- expected_obj_keys = expected_obj.keys
12
- expected_obj_keys.each_with_index do |key, index|
13
- if actual_obj[key].nil?
14
- raise "[%s] expected [%s] but actual value was nil." % [key, expected_obj[key].to_s]
15
- else
16
- is_contain = expected_obj[key] == actual_obj[key]
17
- return is_contain if is_contain == false || index == expected_obj_keys.length - 1
18
- end
19
- end
20
- elsif [Integer, String, Float].include? expected_obj.class
21
- return assert_string_equal(expected_obj, actual_obj)
22
- else
23
- raise "Verify sql result error: Not support expected type #{expected_obj.class} yet"
24
- end
25
- end
26
-
27
- def assert_string_equal expected, actual
28
- actual.to_s == expected.to_s
29
- end
@@ -1,694 +0,0 @@
1
- #-----------------------------------------------------
2
- # support define and bind variable dynamically
3
- #-----------------------------------------------------
4
- $dyn_vars = nil
5
-
6
- # set value to a variable
7
- def set_var(var_name, var_value)
8
- if $dyn_vars == nil
9
- $dyn_vars = binding
10
- end
11
-
12
- strEval = var_name + "=" + var_value
13
- eval strEval, $dyn_vars
14
- end
15
-
16
- def check_dynamic_value(value)
17
- if !value.is_a? Fixnum
18
- if value.include? "params="
19
- resolve_params value
20
- else
21
- bind_with_dyn_vars value
22
- end
23
- else
24
- value
25
- end
26
- end
27
-
28
- # bind string with $dyn_vars context
29
- def bind_with_dyn_vars(str)
30
- if $dyn_vars == nil
31
- $dyn_vars = binding
32
- end
33
-
34
- strEval = '"' + str + '"'
35
- return eval strEval, $dyn_vars
36
- end
37
-
38
- # evaluate operation/statement with $dyn_vars context
39
- def eval_with_dyn_vars(operation)
40
- if $dyn_vars == nil
41
- $dyn_vars = binding
42
- end
43
-
44
- eval operation, $dyn_vars
45
- end
46
-
47
- def bind_with_dyn_json_vars(json, bind_json)
48
- if json.kind_of? Hash
49
- json.each_pair do |k, v|
50
- if v.kind_of? String
51
- bind_json[bind_with_dyn_vars(k)] = bind_with_dyn_json_vars(v, bind_json)
52
- elsif v.kind_of? Hash
53
- temp = Hash.new
54
- v.each_pair do |k1, v1|
55
- temp[bind_with_dyn_vars(k1)] = bind_with_dyn_json_vars(v1, temp)
56
- end
57
- bind_json[bind_with_dyn_vars(k)] = temp
58
- elsif v.kind_of? Array
59
- temp1 = Array.new
60
- v.each { |item|
61
- temp2 = Hash.new
62
- bind_with_dyn_json_vars(item, temp2)
63
- temp1 << temp2
64
- }
65
- bind_json[bind_with_dyn_vars(k)] = temp1
66
- end
67
- end
68
- elsif json.kind_of? Array
69
- temp1 = Array.new
70
- json.each { |item|
71
- temp2 = Hash.new
72
- bind_with_dyn_json_vars(item, temp2)
73
- temp1 << temp2
74
- }
75
- return temp1
76
- else
77
- return bind_with_dyn_vars(json)
78
- end
79
- end
80
-
81
- def var_collect(string_var)
82
- if string_var =~ /^.*{year}.*$/
83
- string_var = replace_year(string_var)
84
- end
85
-
86
- if string_var =~ /^.*{month}.*$/
87
- string_var = replace_month(string_var)
88
- end
89
-
90
- if string_var =~ /^.*{day}.*$/
91
- string_var = replace_day(string_var)
92
- end
93
-
94
- if string_var =~ /^.*{store_value}.*$/
95
- string_var = $context_value
96
- end
97
-
98
- return string_var
99
- end
100
-
101
- def replace_year(str)
102
- t = Time.now()
103
- return str.gsub("{year}", t.year.to_s)
104
- end
105
-
106
- def replace_month(str)
107
- t = Time.now()
108
- _month = t.month
109
- if _month < 10
110
- return str.gsub("{month}", "0#{_month.to_s}")
111
- else
112
- return str.gsub("{month}", "#{_month.to_s}")
113
- end
114
- return str
115
- end
116
-
117
- def replace_day(str)
118
- t = Time.now()
119
- _day = t.day
120
- if _day < 10
121
- return str.gsub("{day}", "0#{_day.to_s}")
122
- else
123
- return str.gsub("{day}", "#{_day.to_s}")
124
- end
125
- return str
126
- end
127
-
128
- def print_variable(variable)
129
- puts "VALUE OF #{variable}: #{eval_with_dyn_vars(variable)}"
130
- end
131
-
132
- def duration(start)
133
- current = Time.now
134
- return current - start
135
- end
136
-
137
- def print_log(status, start, method, *args)
138
- icon = status === "passed" ? "✅" : "❌"
139
- str = ""
140
- args = *args
141
- args_length = args.length - 1
142
- args.each_with_index do |a, i|
143
- if i < args_length
144
- str += "\"#{a}\", "
145
- else
146
- str += "\"#{a}\""
147
- end
148
- end
149
-
150
- puts "#{icon} Step: #{method}(#{str}) (#{duration(start)})"
151
- end
152
-
153
- def get_object_value(str_obj)
154
- string_object = str_obj.gsub(/"/, "'")
155
- hash_object = $OBJECT[string_object]
156
- if hash_object == nil
157
- raise "❌ Error: #{str_obj} NAME MAYBE NOT FOUND!!!"
158
- end
159
- if hash_object.keys[0].to_s.upcase != "CSS_SELECTOR"
160
- raise "❌ Error: #{str_obj} should be formatted as Css Selector."
161
- end
162
- hash_object[hash_object.keys[0]]
163
- end
164
-
165
- def put_log str
166
- start = Time.now
167
- p str if $print_log == true
168
- end
169
-
170
- def check_valid_option_by?(option_by)
171
- %w(text value).include? option_by
172
- end
173
-
174
- def validate_option_by(option_by)
175
- raise "Please select valid option, invalid option - #{option_by}" unless check_valid_option_by? option_by
176
- end
177
-
178
- def check_valid_keys?(key)
179
- %w(:cancel :help :backspace :tab :clear :return :enter :shift :control :alt :pause :escape :space :page_up :page_down :end :home :left :up :right :down :insert :delete :semicolon :equals).include? key
180
- end
181
-
182
- def validate_supported_keys(key)
183
- raise "Please select valid keys, invalid key - #{key}" unless check_valid_option_by? key
184
- end
185
-
186
- def find_object string_object
187
- startTime = Time.new.to_i
188
- string_object = string_object.gsub(/"/, "'")
189
- locator_matching = /(.*?)(\{.*?\})/.match(string_object)
190
- dyn_pros = {}
191
- if locator_matching != nil
192
- string_object = locator_matching[1]
193
- eval(locator_matching[2].gsub(/['][\s,\t]*?:[\s,\t]*?[']?/, "'=>'")).each { |k, v|
194
- dyn_pros[k.to_s.upcase] = v
195
- }
196
- end
197
- hash_object = $OBJECT[string_object]
198
- if hash_object == nil
199
- raise "❌ find_object error: >>> Object: #{string_object} is not found in Object Repository."
200
- end
201
- upcase_attrb = {}
202
- if hash_object != nil
203
- hash_object.each {|k,v|
204
- k = k.to_s.upcase
205
- if k =~ /ph_/i
206
- if dyn_pros[k] != nil
207
- if v =~ /<ph_value>/i
208
- upcase_attrb[k[3..k.size-1]] = v.gsub(/<ph_value>/i, dyn_pros[k])
209
- else
210
- upcase_attrb[k[3..k.size-1]] = dyn_pros[k]
211
- end
212
- dyn_pros.delete(k)
213
- end
214
- else
215
- upcase_attrb[k.to_s.upcase] = v
216
- end
217
- }
218
- end
219
- ph_attrs = {}
220
- dyn_pros.each{|k,v|
221
- if k =~ /ph_/i
222
- ph_attrs[k] = v
223
- else
224
- upcase_attrb[k.to_s.upcase] = v
225
- end
226
- }
227
- if upcase_attrb.size > 0
228
- strId = ""
229
- strClass = ""
230
- strName = ""
231
- strTagname = ""
232
- strCssSelector = ""
233
- strXpathSelector = ""
234
- strText = ""
235
- strRelated = ""
236
- strRelatedType = ""
237
-
238
- index = nil
239
- minWidth = -1
240
- maxWidth = -1
241
- minHeight = -1
242
- maxHeight = -1
243
-
244
- ano_pros = {}
245
-
246
- upcase_attrb.each{|key, value|
247
- upcase_key = key.to_s.upcase
248
- case upcase_key
249
- when "XPATH_SELECTOR"
250
- strXpathSelector = value
251
- when "CSS_SELECTOR"
252
- strCssSelector = value
253
- when "ID"
254
- strId = value
255
- when "CLASS"
256
- strClass = value
257
- when "NAME"
258
- strName = value
259
- when "TAGNAME"
260
- strTagname = value
261
- when "TEXT"
262
- strText = value
263
- when "INDEX"
264
- index = value
265
- else
266
- raise "❌ find_object error: >>> Wrong format type: #{key.to_s} of object: #{string_object}. Available supported format are: XPATH_SELECTOR | CSS_SELECTOR | ID | NAME | CLASS | TEXT | TAGNAME | INDEX"
267
- end
268
- }
269
- continue_run = true;
270
- ref_object = nil;
271
-
272
- if strRelated != nil and strRelated.length > 0
273
- ref_object = find_object(strRelated)
274
- if (ref_object == nil)
275
- continue_run = false
276
- end
277
- end
278
-
279
- if continue_run == true
280
- begin
281
- if strCssSelector != nil and strCssSelector.length > 0
282
- foundElements = get_objects_by_css_selector(strCssSelector)
283
- elsif strXpathSelector != nil and strXpathSelector.length > 0
284
- foundElements = get_objects_by_xpath_selector(strXpathSelector)
285
- else
286
- strGenerateXpathSel = generate_xpath_selector(strId, strClass, strName, strTagname)
287
- if strGenerateXpathSel.length > 0
288
- foundElements = get_objects_by_xpath_selector(strGenerateXpathSel)
289
- else
290
- if (check_string_letters_only(strId))
291
- foundElements = get_objects_by_Id(strId)
292
- elsif (check_string_letters_only(strName))
293
- foundElements = get_objects_by_Name(strName)
294
- elsif (check_string_letters_only(strClass))
295
- foundElements = get_objects_by_Class(strClass)
296
- elsif (check_string_letters_only(strTagname))
297
- foundElements = get_objects_by_Tagname(strTagname)
298
- end
299
- end
300
- end
301
- if foundElements == nil or foundElements.length == 0
302
- currentTime = Time.new.to_i
303
- else
304
- break
305
- end
306
- test = currentTime - startTime
307
- puts "\n Finding the object #{string_object}... TIME-OUT:: #{test} < #{$wait_time}"
308
- sleep(0.5)
309
- end while (currentTime - startTime) < $wait_time
310
-
311
- if foundElements != nil or foundElements.length != 0
312
- if index != nil and index.to_i >= 0
313
- matched_index = 0;
314
- return_element = nil
315
- foundElements.each{|cur_element|
316
- passCheck = find_object_check_object(cur_element, ref_object, strRelatedType, strId, strClass, strName, strTagname, strText, minWidth, maxWidth, minHeight, maxHeight, ano_pros)
317
- if passCheck
318
- if matched_index == index.to_i
319
- return_element = cur_element
320
- break
321
- else
322
- matched_index = matched_index + 1
323
- end
324
- end
325
- }
326
- return return_element
327
- else
328
- return_element = nil
329
- foundElements.each{|cur_element|
330
- passCheck = find_object_check_object(cur_element, ref_object, strRelatedType, strId, strClass, strName, strTagname, strText, minWidth, maxWidth, minHeight, maxHeight, ano_pros)
331
- if passCheck
332
- return_element = cur_element
333
- break
334
- end
335
- }
336
- return return_element
337
- end # if index != nil and index.to_i >= 0
338
- end #if foundElements != nil or foundElements.length != 0
339
- end #if continue = true
340
- end
341
- return nil
342
- end
343
-
344
- def generate_xpath_selector(strId, strClass, strName, strTagname)
345
- strGenerateXpathSel = ""
346
- if strId != nil and strId.length > 0 and (strId =~ /^#/) == nil
347
- strGenerateXpathSel = "[@id='#{strId}']"
348
- end
349
- if strClass != nil and strClass.length > 0 and (strClass =~ /^#/) == nil
350
- strGenerateXpathSel = "#{strGenerateXpathSel}[@class='#{strClass}']"
351
- end
352
- if strName != nil and strName.length > 0 and (strName =~ /^#/) == nil
353
- strGenerateXpathSel = "#{strGenerateXpathSel}[@name='#{strName}']"
354
- end
355
-
356
- if strGenerateXpathSel.length > 0
357
- if strTagname != nil and strTagname.length > 0
358
- strGenerateXpathSel = "//#{strTagname}#{strGenerateXpathSel}"
359
- else
360
- strGenerateXpathSel = "//*#{strGenerateXpathSel}"
361
- end
362
- end
363
-
364
- return strGenerateXpathSel
365
- end
366
-
367
- def check_string_letters_only(strToCheck)
368
- if strToCheck != nil and strToCheck.length > 0 and strToCheck =~ /^[a-zA-Z]+$/
369
- return true
370
- end
371
- return false
372
- end
373
-
374
- def get_objects_by_Id(strId)
375
- foundElements = nil
376
- begin
377
- foundElements = page.all("*[@id='#{strId}']")
378
- rescue StandardError => e
379
- raise "Error: #{e.message}"
380
- end
381
-
382
- return foundElements
383
- end
384
-
385
- def get_objects_by_Class(strClass)
386
- foundElements = nil
387
- begin
388
- foundElements = page.all("*[@class='#{strClass}']")
389
- rescue StandardError => e
390
- raise "Error: #{e.message}"
391
- end
392
-
393
- return foundElements
394
- end
395
-
396
- def get_objects_by_Name(strName)
397
- foundElements = nil
398
- begin
399
- foundElements = page.all("*[@name='#{strName}']")
400
- rescue StandardError => e
401
- raise "Error: #{e.message}"
402
- end
403
-
404
- return foundElements
405
- end
406
-
407
- def get_objects_by_Tagname(strTagname)
408
- foundElements = nil
409
- begin
410
- foundElements = page.all("#{strTagname}")
411
- rescue StandardError => e
412
- raise "Error: #{e.message}"
413
- end
414
-
415
- return foundElements
416
- end
417
-
418
- def get_objects_by_css_selector(strCssSelector)
419
- foundElements = nil
420
- begin
421
- foundElements = page.all(:css, strCssSelector)
422
- rescue StandardError => e
423
- raise "Error: #{e.message}"
424
- end
425
- foundElements
426
- end
427
-
428
- def get_objects_by_xpath_selector(strXpathSelector)
429
- foundElements = nil
430
- begin
431
- foundElements = page.all(:xpath, strXpathSelector)
432
- rescue StandardError => e
433
- raise "Error: #{e.message}"
434
- end
435
- foundElements
436
- end
437
-
438
- def find_object_check_object(cur_element, ref_object, ref_object_type, strId, strClass, strName, strTagname, strText, minWidth, maxWidth, minHeight, maxHeight, ano_pros)
439
- passCheck = true
440
- if cur_element != nil
441
- # Check ref_object
442
- if (ref_object != nil)
443
- if find_object_check_ref_object(ref_object, ref_object_type, cur_element) == false
444
- passCheck = false
445
- end
446
- end
447
-
448
- # Check ID
449
- if strId != nil and strId.length > 0
450
- if strId =~ /^#/
451
- strId = strId[1..-1]
452
- end
453
- if find_object_check_Id(cur_element, strId) == false
454
- passCheck = false
455
- end
456
- end
457
-
458
- # Check Class
459
- if passCheck and strClass != nil and strClass.length > 0
460
- if strClass =~ /^#/
461
- strClass = strClass[1..-1]
462
- end
463
- if find_object_check_Class(cur_element, strClass) == false
464
- passCheck = false
465
- end
466
- end
467
-
468
- # Check Name
469
- if passCheck and strName != nil and strName.length > 0
470
- if strName =~ /^#/
471
- strName = strName[1..-1]
472
- end
473
- if find_object_check_Name(cur_element, strName) == false
474
- passCheck = false
475
- end
476
- end
477
-
478
- # Check Tag name
479
- if passCheck and strTagname != nil and strTagname.length > 0
480
- if find_object_check_Tagname(cur_element, strTagname) == false
481
- passCheck = false
482
- end
483
- end
484
-
485
- # Check Text
486
- if passCheck and strText != nil and strText.length > 0
487
- if (strText =~ /^#/)
488
- strText = strText[1..-1]
489
- end
490
-
491
- if find_object_check_Text(cur_element, strText) == false
492
- passCheck = false
493
- end
494
- end
495
-
496
- # Check minWidth
497
- if passCheck and minWidth > 0
498
- if !find_object_check_minWidth(cur_element, minWidth)
499
- passCheck = false
500
- end
501
- end
502
-
503
- # Check maxWidth
504
- if passCheck and maxWidth > 0
505
- if !find_object_check_maxWidth(cur_element, maxWidth)
506
- passCheck = false
507
- end
508
- end
509
-
510
- # Check minHeight
511
- if passCheck and minHeight > 0
512
- if !find_object_check_minHeight(cur_element, minHeight)
513
- passCheck = false
514
- end
515
- end
516
-
517
- # Check maxHeight
518
- if passCheck and maxHeight > 0
519
- if !find_object_check_maxHeight(cur_element, maxHeight)
520
- passCheck = false
521
- end
522
- end
523
-
524
- # Check another properties
525
- if passCheck and ano_pros.length > 0
526
- ano_pros.each{|property, value|
527
- if value =~ /^#/
528
- value = value[1..-1]
529
- end
530
- if !find_object_check_property(cur_element, property, value)
531
- passCheck = false
532
- break
533
- end
534
- }
535
- end
536
-
537
- return passCheck
538
- end
539
-
540
- return false
541
- end
542
-
543
- def find_object_check_Id(element, strId)
544
- actual_Id = element[:id]
545
- if actual_Id != nil and actual_Id.length > 0
546
- actual_Id = actual_Id.strip
547
- if reg_compare(actual_Id, strId)
548
- return true
549
- end
550
- end
551
-
552
- return false
553
- end
554
-
555
- def find_object_check_Class(element, strClass)
556
- actual_Class = element[:class]
557
- if actual_Class != nil and actual_Class.length > 0
558
- actual_Class = actual_Class.strip
559
- if reg_compare(actual_Class, strClass)
560
- return true
561
- end
562
- end
563
-
564
- return false
565
- end
566
-
567
- def find_object_check_Name(element, strName)
568
- actual_Name = element[:name]
569
- if actual_Name != nil and actual_Name.length > 0
570
- actual_Name = actual_Name.strip
571
- if reg_compare(actual_Name, strName)
572
- return true
573
- end
574
- end
575
-
576
- return false
577
- end
578
-
579
- def find_object_check_Tagname(element, strTagname)
580
- actual_Tagname = element.tag_name()
581
- if actual_Tagname != nil and actual_Tagname.length > 0
582
- actual_Tagname = actual_Tagname.strip
583
- if reg_compare(actual_Tagname, strTagname)
584
- return true
585
- end
586
- end
587
-
588
- return false
589
- end
590
-
591
- def find_object_check_Xpath(element, strXpath)
592
-
593
- end
594
-
595
- def find_object_check_Text(element, strText)
596
- actual_Text = element.text()
597
- if actual_Text != nil and actual_Text.length > 0
598
- actual_Text = actual_Text.strip
599
- if reg_compare(actual_Text, strText)
600
- return true
601
- end
602
- end
603
-
604
- return false
605
- end
606
-
607
- def find_object_check_minWidth(element, minWidth)
608
- width = element[:width]
609
- if (width >= minWidth)
610
- return true
611
- end
612
-
613
- return false
614
- end
615
-
616
- def find_object_check_maxWidth(element, maxWidth)
617
- width = element[:width]
618
- if (width <= maxWidth)
619
- return true
620
- end
621
-
622
- return false
623
- end
624
-
625
- def find_object_check_minHeight(element, minHeight)
626
- height = element[:height]
627
- if (height <= minHeight)
628
- return true
629
- end
630
-
631
- return false
632
- end
633
-
634
- def find_object_check_maxHeight(element, maxHeight)
635
- height = element[:height]
636
- if (height <= maxHeight)
637
- return true
638
- end
639
-
640
- return false
641
- end
642
-
643
- def find_object_check_ref_object(ref_object, ref_type, target_element)
644
- begin
645
- ref = ref_object.native
646
- target = target_element.native
647
- if(ref_type == "up" or ref_type == "down")
648
- ref_x1 = ref.location.x - 10
649
- ref_x2 = ref.location.x + ref.size.width + 10
650
- target_x1 = target.location.x
651
- target_x2 = target_x1 + target.size.width
652
- elsif(ref_type == "left" or ref_type == "right")
653
- ref_y1 = ref.location.y - 10
654
- ref_y2 = ref.location.y + ref_object.native.size.height + 10
655
- target_y1 = target.location.y
656
- target_y2 = target_y1 + target.size.height
657
- elsif(ref_type == "child" or ref_type == "parent")
658
- ref_W = ref.location.x + ref.size.width
659
- ref_H = ref.location.y + ref.size.height
660
- target_W = target.location.x + target.size.width
661
- target_H = target.location.y + target.size.height
662
- end
663
-
664
- if(ref_type == "up" and
665
- target_x1 > ref_x1 and target_x2 < ref_x2 and # has same column or X Position
666
- target.location.y < ref.location.y) # at row or Y position, target is upper
667
- return true
668
- elsif(ref_type == "down" and
669
- target_x1 > ref_x1 and target_x2 < ref_x2 and # has same column or X Position
670
- target.location.y > ref.location.y) # at row or Y position, target is at down
671
- return true
672
- elsif(ref_type == "left" and
673
- target.location.x < ref.location.x and # at column or X Position, target is at left
674
- target_y1 > ref_y1 and target_y2 < ref_y2) # at row or Y position, target is same as ref object
675
- return true
676
- elsif(ref_type == "right" and
677
- target.location.x > ref.location.x and # at column or X Position, target is at right
678
- target_y1 > ref_y1 and target_y2 < ref_y2) # at row or Y position, target is same as ref object
679
- return true
680
- elsif(ref_type == "child" and
681
- (target_W < ref_W) and (target_H < ref_H) and
682
- (target.location.x > ref.location.x) and (target.location.y > ref.location.y))
683
- return true
684
- elsif(ref_type == "parent" and
685
- (target_W > ref_W) and (target_H > ref_H) and
686
- (target.location.x < ref.location.x) and (target.location.y < ref.location.y))
687
- return true
688
- end
689
- rescue StandardError => e
690
- puts "Error: #{e.message}"
691
- end
692
-
693
- return false;
694
- end