itms_automation 2.1 → 2.5.6

Sign up to get free protection for your applications and to get access to all the features.
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,125 +0,0 @@
1
- # require "active_record"
2
-
3
- def create_database_connection(config)
4
- start = Time.now
5
- begin
6
- if config.class === "String"
7
- config = JSON.parse config
8
- else
9
- unless config.hashes.empty?
10
- config = config.hashes[0]
11
- config = JSON.parse(config) unless config.is_a? Hash
12
- config.each_pair do |k, v|
13
- config[k] = v
14
- end
15
- end
16
- end
17
-
18
- @connection = ActiveRecord::Base.establish_connection(config)
19
- ActiveRecord::Base.connection.active?
20
-
21
- if @connection.connected?
22
- print_log("passed", start, __method__, config)
23
- else
24
- print_log("failed", start, __method__, config)
25
- raise "Error: Can't connect to database"
26
- end
27
- rescue JSON::ParserError
28
- print_log("failed", start, __method__, config)
29
- raise "Error: Please check your connection configuration"
30
- rescue Exception => e
31
- print_log("failed", start, __method__, config)
32
- raise "Error: #{e.message}"
33
- end
34
- end
35
-
36
- def close_database_connection
37
- start = Time.now
38
- begin
39
- @connection.disconnect!
40
- print_log("passed", start, __method__)
41
- rescue Exception => e
42
- print_log("failed", start, __method__)
43
- raise "Error: #{e.message}"
44
- end
45
- end
46
-
47
- def execute_query(query)
48
- start = Time.now
49
- begin
50
- if @connection.connected?
51
- @result = @connection.connection.exec_query(query).to_a
52
- print_log("passed", start, __method__, query)
53
- else
54
- print_log("failed", start, __method__, query)
55
- raise "Error: Create connection to database first!"
56
- end
57
- rescue Exception => e
58
- print_log("failed", start, __method__, query)
59
- raise "Error: #{e.message}"
60
- end
61
- end
62
-
63
- def print_sql_result
64
- start = Time.now
65
- if @result.present?
66
- puts "SQL result:"
67
- puts @result.to_json
68
- else
69
- puts "WARNING: No result from SQL statement"
70
- end
71
- end
72
-
73
- def verify_sql_result_contain(expected_string)
74
- start = Time.now
75
- begin
76
- @expected = JSON.parse(expected_string)
77
- is_contain = false
78
- if @expected.kind_of?(Array) && @expected.length > @result.length
79
- print_log("failed", start, __method__, expected_string)
80
- raise "Error: Expected: #{@expected}\nGot: #{@result}\nQuery result not includes your expected"
81
- end
82
- @result.each do |row|
83
- is_contain = do_assertion_json(@expected, row)
84
- break if !@expected.kind_of?(Array) && is_contain == true
85
- end
86
- if is_contain
87
- print_log("passed", start, __method__, expected_string)
88
- else
89
- print_log("failed", start, __method__, expected_string)
90
- raise "Error: Expected: #{@expected}\nGot: #{@result}\nQuery result not includes your expected"
91
- end
92
- rescue JSON::ParserError
93
- print_log("failed", start, __method__, expected_string)
94
- raise "Error: Please check your expected"
95
- rescue Exception => e
96
- print_log("failed", start, __method__, expected_string)
97
- raise "Error: #{e.message}"
98
- end
99
- end
100
-
101
- def verify_sql_result_equal(expected_string)
102
- start = Time.now
103
- begin
104
- @expected = JSON.parse(expected_string)
105
- if !@expected.kind_of?(Array) || @expected.length != @result.length
106
- print_log("failed", start, __method__, expected_string)
107
- raise "Error: Expected: #{@expected}\nGot: #{@result}\nQuery result not equal with your expected"
108
- end
109
- @result.each_with_index do |row, index|
110
- is_contain = row.to_s == @expected[index].to_s
111
- if is_contain
112
- print_log("passed", start, __method__, expected_string)
113
- else
114
- print_log("failed", start, __method__, expected_string)
115
- raise "Error: Expected: #{@expected}\nGot: #{@result}\nQuery result not equal with your expected"
116
- end
117
- end
118
- rescue JSON::ParserError
119
- print_log("failed", start, __method__, expected_string)
120
- raise "Error: Please check your expected"
121
- rescue Exception => e
122
- print_log("failed", start, __method__, expected_string)
123
- raise "Error: #{e.message}"
124
- end
125
- end
@@ -1,606 +0,0 @@
1
- require "net/https"
2
- require "rspec"
3
-
4
- def execute_openbrowser(url_site)
5
- start = Time.now
6
- begin
7
- if url_site == ""
8
- print_log("failed", start, __method__, url_site)
9
- raise "Error: Null web page URL."
10
- end
11
- visit(url_site)
12
- print_log("passed", start, __method__, url_site)
13
- rescue StandardError => e
14
- print_log("failed", start, __method__, url_site)
15
- raise "Error: #{e.message}"
16
- end
17
- end
18
-
19
- def clear_cookie()
20
- start = Time.now
21
- begin
22
- browser = Capybara.current_session.driver.browser
23
- if browser.respond_to?(:clear_cookies)
24
- # Rack::MockSession
25
- browser.clear_cookies
26
- print_log("passed", start, __method__)
27
- elsif browser.respond_to?(:manage) and browser.manage.respond_to?(:delete_all_cookies)
28
- # Selenium::WebDriver
29
- browser.manage.delete_all_cookies
30
- print_log("passed", start, __method__)
31
- else
32
- print_log("failed", start, __method__)
33
- raise "Error: Don't know how to clear cookies. Weird driver?"
34
- end
35
- rescue Exception => e
36
- print_log("failed", start, __method__)
37
- raise "Error: #{e.message}"
38
- end
39
- end
40
-
41
- def execute_click(element)
42
- start = Time.now
43
- foundElement = find_object(element)
44
- if foundElement != nil
45
- begin
46
- foundElement.click
47
- print_log("passed", start, __method__, element)
48
- rescue StandardError => e
49
- print_log("failed", start, __method__, element)
50
- raise "Error: #{e.message}"
51
- end
52
- else
53
- print_log("failed", start, __method__, element)
54
- raise "Error: Not found object #{element}"
55
- end
56
- end
57
-
58
- def execute_click_offset(element, x, y)
59
- start = Time.now
60
- foundElement = find_object(element)
61
- if foundElement != nil
62
- begin
63
- page.driver.browser.mouse.move_to(foundElement.native, x.to_i, y.to_i)
64
- page.driver.browser.mouse.click()
65
- print_log("passed", start, __method__, element, x, y)
66
- rescue Exception => e
67
- print_log("failed", start, __method__, element, x, y)
68
- raise "Error: #{e.message}"
69
- end
70
- else
71
- print_log("failed", start, __method__, element, x, y)
72
- raise "Error: Not found object: #{element}"
73
- end
74
- end
75
-
76
- def double_click(element)
77
- start = Time.now
78
- foundElement = find_object(element)
79
- if foundElement != nil
80
- begin
81
- foundElement.double_click
82
- print_log("passed", start, __method__, element)
83
- rescue StandardError => e
84
- print_log("failed", start, __method__, element)
85
- raise "Error: #{e.message}"
86
- end
87
- else
88
- print_log("failed", start, __method__, element)
89
- raise "Error: Not found object: #{element}"
90
- end
91
- end
92
-
93
- def execute_settext(element, text)
94
- start = Time.now
95
- foundElement = find_object(element)
96
- if foundElement != nil
97
- begin
98
- foundElement.set(text)
99
- print_log("passed", start, __method__, element, text)
100
- rescue StandardError => e
101
- print_log("failed", start, __method__, element, text)
102
- raise "Error: #{e.message}"
103
- end
104
- else
105
- print_log("failed", start, __method__, element, text)
106
- raise "Error: Not found object: #{element}"
107
- end
108
- end
109
-
110
- def maximize_browser
111
- start = Time.now
112
- begin
113
- page.driver.browser.manage.window.maximize
114
- print_log("passed", start, __method__)
115
- rescue StandardError => e
116
- print_log("failed", start, __method__)
117
- raise "Error: #{e.message}"
118
- end
119
- end
120
-
121
- def switch_to_window_by_title(window_title)
122
- start = Time.now
123
- $previous_window = page.driver.browser.window_handle
124
- @window_found = false
125
- page.driver.browser.window_handles.each { |handle|
126
- page.driver.browser.switch_to.window handle
127
- if page.title == window_title
128
- @window_found = true
129
- print_log("passed", start, __method__, window_title)
130
- break
131
- end
132
- }
133
- if @window_found == false
134
- print_log("failed", start, __method__, window_title)
135
- raise "Error: Window having title \"#{window_title}\" not found"
136
- end
137
- end
138
-
139
- def scroll_to_end_page
140
- start = Time.now
141
- begin
142
- page.driver.execute_script("window.scrollTo(0,Math.max(document.documentElement.scrollHeight,document.body.scrollHeight,document.documentElement.clientHeight));")
143
- print_log("passed", start, __method__)
144
- rescue StandardError => e
145
- print_log("failed", start, __method__)
146
- raise "Error: #{e.message}"
147
- end
148
- end
149
-
150
- def scroll_to_top_page
151
- start = Time.now
152
- begin
153
- page.driver.execute_script("window.scrollTo(Math.max(document.documentElement.scrollHeight,document.body.scrollHeight,document.documentElement.clientHeight),0);")
154
- print_log("passed", start, __method__)
155
- rescue StandardError => e
156
- print_log("failed", start, __method__)
157
- raise "Error: #{e.message}"
158
- end
159
- end
160
-
161
- def verify_title(expected_title)
162
- start = Time.now
163
- begin
164
- page_title = page.title
165
- expect(page_title).to eq expected_title
166
- print_log("passed", start, __method__, expected_title)
167
- puts "Actual Page Title : #{page_title}, Expected Page Title : #{expected_title}"
168
- rescue StandardError => e
169
- print_log("failed", start, __method__, expected_title)
170
- raise "Error: #{e.message}"
171
- end
172
- end
173
-
174
- def verify_alert_text(text)
175
- start = Time.now
176
- begin
177
- alert = page.driver.browser.switch_to.alert.text
178
- expect(alert).to eq text
179
- print_log("passed", start, __method__, text)
180
- puts "Actual Page alert text : #{alert}, Expected value : #{text}"
181
- rescue StandardError => e
182
- print_log("failed", start, __method__, text)
183
- raise "Error: #{e.message}"
184
- end
185
- end
186
-
187
- def accept_alert
188
- start = Time.now
189
- begin
190
- page.driver.browser.switch_to.alert.accept
191
- print_log("passed", start, __method__)
192
- rescue Exception => e
193
- print_log("failed", start, __method__)
194
- raise "Error: #{e.message}"
195
- end
196
- end
197
-
198
- def back
199
- start = Time.now
200
- begin
201
- page.execute_script("window.history.back()")
202
- print_log("passed", start, __method__)
203
- rescue Exception => e
204
- print_log("failed", start, __method__)
205
- raise "Error: #{e.message}"
206
- end
207
- end
208
-
209
- def refresh
210
- start = Time.now
211
- begin
212
- page.execute_script("window.location.reload()")
213
- print_log("passed", start, __method__)
214
- rescue Exception => e
215
- print_log("failed", start, __method__)
216
- raise "Error: #{e.message}"
217
- end
218
- end
219
-
220
- def clear_text(element)
221
- start = Time.now
222
- foundElement = find_object(element)
223
- if foundElement != nil?
224
- begin
225
- foundElement.native.clear
226
- print_log("passed", start, __method__, element)
227
- rescue Exception => e
228
- print_log("failed", start, __method__, element)
229
- raise "Error: #{e.message}"
230
- end
231
- else
232
- print_log("failed", start, __method__, element)
233
- raise "Error: Not found object: #{element}"
234
- end
235
- end
236
-
237
- def execute_javascript(script)
238
- start = Time.now
239
- begin
240
- page.execute_script(script)
241
- print_log("passed", start, __method__, script)
242
- rescue Exception => e
243
- print_log("failed", start, __method__, script)
244
- raise "Error: Not found object: #{element}"
245
- end
246
- end
247
-
248
- def execute_select(element, option)
249
- start = Time.now
250
- foundElement = find_object(element)
251
- if foundElement != nil
252
- begin
253
- foundElement.find("option", text: option).select_option
254
- print_log("passed", start, __method__, element, option)
255
- rescue Exception => e
256
- print_log("failed", start, __method__, element, option)
257
- raise "Error: #{e.message}"
258
- end
259
- else
260
- print_log("failed", start, __method__, element, option)
261
- raise "Error: Not found object: #{element}"
262
- end
263
- end
264
-
265
- def execute_mouse_over(element)
266
- start = Time.now
267
- foundElement = find_object(element)
268
- if foundElement != nil
269
- begin
270
- page.driver.browser.action.move_to(foundElement.native, element).click.perform
271
- print_log("passed", start, __method__, element)
272
- sleep(1)
273
- rescue StandardError => e
274
- print_log("failed", start, __method__, element)
275
- raise "Error: #{e.message}"
276
- end
277
- else
278
- print_log("failed", start, __method__, element)
279
- raise "Error: Not found object: #{element}"
280
- end
281
- end
282
-
283
- def remove_element_attribute(element, attr)
284
- start = Time.now
285
- foundElement = find_object(element)
286
- if foundElement != nil
287
- begin
288
- page.driver.browser.execute_script("arguments[0].removeAttribute('#{attr}');", foundElement.native)
289
- print_log("passed", start, __method__, element, attr)
290
- sleep(1)
291
- rescue StandardError => e
292
- print_log("failed", start, __method__, element, attr)
293
- raise "Error: #{e.message}"
294
- end
295
- else
296
- print_log("failed", start, __method__, element, attr)
297
- raise "Error: Not found object: #{element}"
298
- end
299
- end
300
-
301
- # Set state
302
- def execute_setstate(element, state)
303
- start = Time.now
304
- foundElement = find_object(element)
305
- if foundElement != nil
306
- if state
307
- foundElement.select_option
308
- else
309
- foundElement.unselect_option
310
- end
311
- print_log("passed", start, __method__, element, state)
312
- else
313
- print_log("failed", start, __method__, element, state)
314
- raise "Error: Not found object: #{element}"
315
- end
316
- end
317
-
318
- def close_windows
319
- start = Time.now
320
- begin
321
- page.execute_script "window.close();"
322
- print_log("passed", start, __method__)
323
- rescue StandardError => e
324
- print_log("failed", start, __method__)
325
- raise "Error: #{e.message}"
326
- end
327
- end
328
-
329
- def resize_window_screen(x, y)
330
- start = Time.now
331
- begin
332
- page.driver.browser.manage.window.resize_to(x, y)
333
- print_log("passed", start, __method__, x, y)
334
- rescue StandardError => e
335
- print_log("failed", start, __method__, x, y)
336
- raise "Error: #{e.message}"
337
- end
338
- end
339
-
340
- def switch_to_iframe(element)
341
- start = Time.now
342
- foundElement = find_object(element)
343
- if foundElement != nil
344
- begin
345
- page.driver.switch_to_frame(foundElement)
346
- print_log("passed", start, __method__, element)
347
- rescue Exception => e
348
- print_log("failed", start, __method__, element)
349
- raise "Error: #{e.message}"
350
- end
351
- else
352
- print_log("failed", start, __method__, element)
353
- raise "Error: Not found object #{element}"
354
- end
355
- end
356
-
357
- def switch_to_default_content
358
- start = Time.now
359
- begin
360
- page.driver.browser.switch_to.default_content
361
- print_log("passed", start, __method__)
362
- rescue Exception => e
363
- print_log("failed", start, __method__)
364
- raise "Error: #{e.message}"
365
- end
366
- end
367
-
368
- def get_computed_style(element, style)
369
- start = Time.now
370
- foundElement = get_object_value(element)
371
- computedStyle = ""
372
- if foundElement != nil
373
- computedStyle = page.evaluate_script("window.getComputedStyle(document.querySelector('#{foundElement}')).#{style}")
374
- else
375
- print_log("failed", start, __method__, element, style)
376
- raise "Error: Not found object: #{element}"
377
- end
378
- print_log("passed", start, __method__, element, style)
379
- puts "Actual object style value is: #{computedStyle}"
380
- computedStyle
381
- end
382
-
383
- def get_element_text(element)
384
- start = Time.now
385
- foundElement = find_object(element)
386
- if foundElement != nil
387
- begin
388
- result = foundElement.text()
389
- print_log("passed", start, __method__, element, style)
390
- puts "Text of #{element}: #{result}"
391
- rescue StandardError => e
392
- print_log("failed", start, __method__, element)
393
- raise "Error: #{e.message}"
394
- end
395
- else
396
- print_log("failed", start, __method__, element)
397
- raise "Error: Not found object: #{element}"
398
- end
399
- end
400
-
401
- def get_element_attribute(element, value)
402
- start = Time.now
403
- foundElement = find_object(element)
404
- if foundElement != nil
405
- begin
406
- result = foundElement.value()
407
- print_log("passed", start, __method__, element, value)
408
- puts "Attribute of #{element}: #{result}"
409
- rescue StandardError => e
410
- print_log("failed", start, __method__, element, value)
411
- raise "Error: #{e.message}"
412
- end
413
- else
414
- print_log("failed", start, __method__, element, value)
415
- raise "Error: Not found object: #{element}"
416
- end
417
- end
418
-
419
- def verify_element_text(element, value)
420
- start = Time.now
421
- foundElement = find_object(element)
422
- if foundElement != nil
423
- begin
424
- actual_value = foundElement.text()
425
- expect(actual_value).to eq value
426
- print_log("passed", start, __method__, element, value)
427
- rescue Exception => e
428
- print_log("failed", start, __method__, element, value)
429
- raise "Error: #{e.message}"
430
- end
431
- else
432
- print_log("failed", start, __method__, element, value)
433
- raise "Error: Not found object: #{element}"
434
- end
435
- end
436
-
437
- def verify_element_not_has_text(element, value)
438
- start = Time.now
439
- foundElement = find_object(element)
440
- if foundElement != nil
441
- begin
442
- actual_value = foundElement.text()
443
- expect(actual_value).not_to eql value
444
- print_log("passed", start, __method__, element, value)
445
- rescue Exception => e
446
- print_log("failed", start, __method__, element, value)
447
- raise "Error: #{e.message}"
448
- end
449
- else
450
- print_log("failed", start, __method__, element, value)
451
- raise "Error: Not found object: #{element}"
452
- end
453
- end
454
-
455
- def verify_element_value(element, value)
456
- start = Time.now
457
- foundElement = find_object(element)
458
- if foundElement != nil
459
- begin
460
- actual_value = foundElement.value()
461
- expect(actual_value).to eq value
462
- print_log("passed", start, __method__, element, value)
463
- rescue Exception => e
464
- print_log("failed", start, __method__, element, value)
465
- raise "Error: #{e.message}"
466
- end
467
- else
468
- print_log("failed", start, __method__, element, value)
469
- raise "Error: Not found object: #{element}"
470
- end
471
- end
472
-
473
- def verify_element_not_has_value(element, value)
474
- start = Time.now
475
- foundElement = find_object(element)
476
- if foundElement != nil
477
- begin
478
- actual_value = foundElement.value()
479
- expect(actual_value).not_to eql value
480
- print_log("passed", start, __method__, element, value)
481
- rescue Exception => e
482
- print_log("failed", start, __method__, element, value)
483
- raise "Error: #{e.message}"
484
- end
485
- else
486
- print_log("failed", start, __method__, element, value)
487
- raise "Error: Not found object: #{element}"
488
- end
489
- end
490
-
491
- def execute_checkproperty(element, property, negate, value, isSpecialChar = false)
492
- start = Time.now
493
- validate_option_by(property)
494
- Capybara.configure do |config|
495
- config.ignore_hidden_elements = false
496
- end
497
- foundElement = find_object(element)
498
-
499
- check = false
500
- if foundElement == nil and value == ""
501
- check = true
502
- # check.should eq true
503
- expect(check).to eq true
504
- else
505
- if foundElement != nil
506
- if property.upcase == "VALUE"
507
- actual_value = foundElement.value()
508
- elsif property.upcase == "TEXT"
509
- actual_value = foundElement.text()
510
- else
511
- actual_value = foundElement["#{property}"]
512
- end
513
-
514
- if actual_value == nil
515
- actual_value = ""
516
- end
517
- else
518
- print_log("failed", start, __method__, element, property, negate, value, isSpecialChar)
519
- raise "Error: Not found object: #{element}"
520
- end
521
-
522
- Capybara.configure do |config|
523
- config.ignore_hidden_elements = true
524
- end
525
-
526
- # if IFD_Assertion.reg_compare(actual_value, value, isSpecialChar)
527
- # check = true
528
- # end
529
-
530
- begin
531
- if negate == " not"
532
- actual_value.should_not eq value
533
- expect(actual_value).not_to eql value
534
- elsif actual_value.should eq value
535
- expect(actual_value).to eq value
536
- end
537
- print_log("passed", start, __method__, element, property, negate, value, isSpecialChar)
538
- rescue Exception => e
539
- print_log("failed", start, __method__, element, property, negate, value, isSpecialChar)
540
- raise "Error: #{e.message}"
541
- end
542
- end
543
- end
544
-
545
- def get_object_and_store_as_string(object, string)
546
- text = execute_gettext(object)
547
- txt = "'" + text + "'"
548
- set_var(string, txt)
549
- end
550
-
551
- def get_object_and_store_to_file(object, file_name)
552
- $text = execute_gettext(object)
553
- open($test_data_dir + file_name, "a+") do |f|
554
- f << $text + "\n"
555
- end
556
- end
557
-
558
- def drag_and_drop_by_offset(element, x, y)
559
- start = Time.now
560
- foundElement = find_object(element)
561
- if foundElement != nil
562
- begin
563
- page.driver.browser.action.drag_and_drop_by(foundElement, x, y).perform
564
- print_log("passed", start, __method__, element, x, y)
565
- rescue Exception => e
566
- print_log("failed", start, __method__, element, x, y)
567
- raise "Error: #{e.message}"
568
- end
569
- else
570
- print_log("failed", start, __method__, element, x, y)
571
- raise "Error: Not found object: #{element}"
572
- end
573
- end
574
-
575
- def drag_and_drop_to_object(from_element, element)
576
- start = Time.now
577
- found_from_element = find_object(from_element)
578
- foundElement = find_object(element)
579
- if foundElement != nil and found_from_element != nil
580
- found_from_element.drag_to(foundElement)
581
- print_log("passed", start, __method__, from_element, element)
582
- end
583
- end
584
-
585
- def execute_sendkeys(element, key)
586
- start = Time.now
587
- validate_supported_keys(key)
588
- foundElement = find_object(element)
589
- if foundElement != nil
590
- begin
591
- foundElement.native.send_keys(key)
592
- print_log("passed", start, __method__, element, key)
593
- rescue Exception => e
594
- print_log("failed", start, __method__, element, key)
595
- raise "Error: #{e.message}"
596
- end
597
- else
598
- print_log("failed", start, __method__, element, key)
599
- raise "Error: Not found object: #{element}"
600
- end
601
- end
602
-
603
- def movemouseandclick(var, element)
604
- Selenium::WebDriver::Support::Select.new(page.driver.browser.find_element(:id, "#{var}")).select_by(:text, "#{element}")
605
- page.driver.browser.find_element(:id, "#{var}").click
606
- end