Ifd_Automation 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a3a26342c75a6e681f958a76a993a0e7270f0633
4
- data.tar.gz: cb569050cd9f1f7c7b98bf6c9baaae8ec4a0a7ee
2
+ SHA256:
3
+ metadata.gz: 0e93c46f8a7695b85679c5c979a23b877fdf6bc1d8233e2fe1b74bf0c4ce9c29
4
+ data.tar.gz: 378205b56f9eeafb21cf16ae0943ff569db4746757815ee88f5b3844658cc76b
5
5
  SHA512:
6
- metadata.gz: a08394b90c432e8bd465b07cfead78a5389ee278168ecd404dd6448f440402151f617a93381d7f5d9c5e96f6861a45b119c9415eb6409c2bff1171d1a2afdeb0
7
- data.tar.gz: 53fcc28e3264bce6db5759d88006bcd96c494b3ef05483c18e36a0ebbde98874a8b4b29c2311d09ce45591223190fa1c317d2d6e4f37d077dae171a57ab6292e
6
+ metadata.gz: ae91536844167f9976a8437f82ee34da8bb9e7c90cf2dd0d659b90bfb7dd27dd9db24401148aedc58aa2d7ec60f5b6075f25bb3a61f78e393d8d412ee872684b
7
+ data.tar.gz: a8b5946cb00566e404f6d9b957e6a7e23cc4b4437a24c5e1461dc91f86fecdcc1b58e6a0d70dc45170e0b6b1e3114d0aa13c7085d71a04fdbf2c78e4212c0dcf
@@ -1,3 +1,3 @@
1
1
  module IfdAutomation
2
- VERSION = "3.0.1"
2
+ VERSION = "3.0.2"
3
3
  end
@@ -4,19 +4,14 @@ require_relative '../Ifd_Automation/assertion_helper.rb'
4
4
 
5
5
  def execute_openbrowser(url_site)
6
6
  begin
7
- if $_CFWEB['Maximize Browser'] == true
8
- page.driver.browser.manage.window.maximize
7
+ if url_site == ""
8
+ puts "❌ Error: Null web page URL."
9
+ exit(1)
9
10
  end
10
- rescue StandardError => e
11
- raise "\n>>> Error: #{e}"
12
- exit
13
- end
14
-
15
- if url_site == ""
16
- raise "\n>>> Error: Null web page URL."
17
- exit
18
- else
19
11
  visit(url_site)
12
+ rescue StandardError => e
13
+ puts "❌ Error: #{e}"
14
+ exit(1)
20
15
  end
21
16
  end
22
17
 
@@ -26,12 +21,12 @@ def execute_click(element)
26
21
  begin
27
22
  foundElement.click
28
23
  rescue StandardError => e
29
- raise "\n>>> Error: #{e}"
30
- exit
24
+ puts "Error: #{e}"
25
+ exit(1)
31
26
  end
32
27
  else
33
- raise "\nError >> Not found object: #{element}"
34
- exit
28
+ puts "❌ Error >> Not found object: #{element}"
29
+ exit(1)
35
30
  end
36
31
  end
37
32
 
@@ -42,12 +37,12 @@ def execute_click_offset(element, x, y)
42
37
  page.driver.browser.mouse.move_to(foundElement.native,x.to_i,y.to_i)
43
38
  page.driver.browser.mouse.click()
44
39
  rescue Exception => e
45
- raise "\n>>> Error: #{e}"
46
- exit
40
+ puts "Error: #{e}"
41
+ exit(1)
47
42
  end
48
43
  else
49
- raise "\nError >> Not found object: #{element}"
50
- exit
44
+ puts "❌ Error: Not found object: #{element}"
45
+ exit(1)
51
46
  end
52
47
  end
53
48
 
@@ -57,12 +52,12 @@ def double_click(element)
57
52
  begin
58
53
  foundElement.double_click
59
54
  rescue StandardError => e
60
- raise "\n>>> Error: #{e}"
61
- exit
55
+ puts "Error: #{e}"
56
+ exit(1)
62
57
  end
63
58
  else
64
- raise "\nError >> Not found object: #{element}"
65
- exit
59
+ puts "❌ Error: Not found object: #{element}"
60
+ exit(1)
66
61
  end
67
62
  end
68
63
 
@@ -72,11 +67,11 @@ def execute_settext(element, text)
72
67
  begin
73
68
  foundElement.set(text)
74
69
  rescue StandardError => e
75
- raise "\n>>> Error: #{e}"
70
+ puts "Error: #{e}"
76
71
  end
77
72
  else
78
- raise "\nError >> Not found object: #{element}"
79
- exit
73
+ puts "❌ Error: Not found object: #{element}"
74
+ exit(1)
80
75
  end
81
76
  end
82
77
 
@@ -84,8 +79,8 @@ def maximize_browser
84
79
  begin
85
80
  page.driver.browser.manage.window.maximize
86
81
  rescue StandardError => e
87
- raise "\n>>> Error: #{e}"
88
- exit
82
+ puts "Error: #{e}"
83
+ exit(1)
89
84
  end
90
85
  end
91
86
 
@@ -101,7 +96,7 @@ def switch_to_window_by_title(window_title)
101
96
  }
102
97
  if @window_found == false
103
98
  raise "Window having title \"#{window_title}\" not found"
104
- exit
99
+ exit(1)
105
100
  end
106
101
  end
107
102
 
@@ -109,8 +104,8 @@ def scroll_to_end_page
109
104
  begin
110
105
  page.driver.execute_script('window.scrollTo(0,Math.max(document.documentElement.scrollHeight,document.body.scrollHeight,document.documentElement.clientHeight));')
111
106
  rescue StandardError => e
112
- raise "\n>>> Error: #{e}"
113
- exit
107
+ puts "Error: #{e}"
108
+ exit(1)
114
109
  end
115
110
  end
116
111
 
@@ -118,8 +113,8 @@ def scroll_to_top_page
118
113
  begin
119
114
  page.driver.execute_script('window.scrollTo(Math.max(document.documentElement.scrollHeight,document.body.scrollHeight,document.documentElement.clientHeight),0);')
120
115
  rescue StandardError => e
121
- raise "\n>>> Error: #{e}"
122
- exit
116
+ puts "Error: #{e}"
117
+ exit(1)
123
118
  end
124
119
  end
125
120
 
@@ -129,8 +124,8 @@ def verify_title(expected_title)
129
124
  puts "Actual Page Title : #{page_title}, Expected Page Title : #{expected_title}"
130
125
  expect(page_title).to eq expected_title
131
126
  rescue StandardError => e
132
- raise "\n>>> Error: #{e}"
133
- exit
127
+ puts "Error: #{e}"
128
+ exit(1)
134
129
  end
135
130
  end
136
131
 
@@ -140,8 +135,8 @@ def verify_alert_text(text)
140
135
  puts "Actual Page alert text : #{alert}, Expected value : #{text}"
141
136
  expect(alert).to eq text
142
137
  rescue StandardError => e
143
- raise "\n>>> Error: #{e}"
144
- exit
138
+ puts "Error: #{e}"
139
+ exit(1)
145
140
  end
146
141
  end
147
142
 
@@ -149,8 +144,8 @@ def accept_alert
149
144
  begin
150
145
  page.driver.browser.switch_to.alert.accept
151
146
  rescue Exception => e
152
- raise "\n>>> ERROR: #{e}"
153
- exit
147
+ puts "ERROR: #{e}"
148
+ exit(1)
154
149
  end
155
150
  end
156
151
 
@@ -158,8 +153,8 @@ def back
158
153
  begin
159
154
  page.execute_script('window.history.back()')
160
155
  rescue Exception => e
161
- raise "\n>>> ERROR: #{e}"
162
- exit
156
+ puts "ERROR: #{e}"
157
+ exit(1)
163
158
  end
164
159
  end
165
160
 
@@ -167,8 +162,8 @@ def refresh
167
162
  begin
168
163
  page.execute_script('window.location.reload()')
169
164
  rescue Exception => e
170
- raise "\n>>> ERROR: #{e}"
171
- exit
165
+ puts "ERROR: #{e}"
166
+ exit(1)
172
167
  end
173
168
  end
174
169
 
@@ -178,12 +173,12 @@ def clear_text(element)
178
173
  begin
179
174
  foundElement.native.clear
180
175
  rescue Exception => e
181
- raise "\n>>> ERROR: #{e}"
182
- exit
176
+ puts "ERROR: #{e}"
177
+ exit(1)
183
178
  end
184
179
  else
185
- raise "\nError >> Not found object: #{element}"
186
- exit
180
+ puts "❌ Error: Not found object: #{element}"
181
+ exit(1)
187
182
  end
188
183
  end
189
184
 
@@ -191,8 +186,8 @@ def execute_javascript(script)
191
186
  begin
192
187
  page.execute_script(script)
193
188
  rescue Exception => e
194
- raise "\nError >> Not found object: #{element}"
195
- exit
189
+ puts "❌ Error: Not found object: #{element}"
190
+ exit(1)
196
191
  end
197
192
  end
198
193
 
@@ -205,12 +200,12 @@ def execute_select(element, text)
205
200
  page.execute_script("$('##{foundElement[:id]}').val('#{option_value}')")
206
201
  page.execute_script("$('##{foundElement[:id]}').trigger('liszt:updated').trigger('change')")
207
202
  rescue Exception => e
208
- raise "\n>>> ERROR: #{e}"
209
- exit
203
+ puts "ERROR: #{e}"
204
+ exit(1)
210
205
  end
211
206
  else
212
- raise "\nError >> Not found object: #{element}"
213
- exit
207
+ puts "❌ Error: Not found object: #{element}"
208
+ exit(1)
214
209
  end
215
210
  end
216
211
 
@@ -221,12 +216,12 @@ def execute_mouse_over(element)
221
216
  page.driver.browser.action.move_to(foundElement.native, element).click.perform
222
217
  sleep(1)
223
218
  rescue StandardError => e
224
- raise "\n>>> Error: #{e}"
225
- exit
219
+ puts "Error: #{e}"
220
+ exit(1)
226
221
  end
227
222
  else
228
- raise "\nError >> Not found object: #{element}"
229
- exit
223
+ puts "❌ Error: Not found object: #{element}"
224
+ exit(1)
230
225
  end
231
226
  end
232
227
 
@@ -237,12 +232,12 @@ def remove_element_attribute(element, attr)
237
232
  page.driver.browser.execute_script("arguments[0].removeAttribute('#{attr}');", foundElement.native)
238
233
  sleep(1)
239
234
  rescue StandardError => e
240
- raise "\n>>> Error: #{e}"
241
- exit
235
+ puts "Error: #{e}"
236
+ exit(1)
242
237
  end
243
238
  else
244
- raise "\nError >> Not found object: #{element}"
245
- exit
239
+ puts "❌ Error: Not found object: #{element}"
240
+ exit(1)
246
241
  end
247
242
  end
248
243
 
@@ -256,8 +251,8 @@ def execute_setstate(element, state)
256
251
  foundElement.unselect_option
257
252
  end
258
253
  else
259
- raise "\nError >> Not found object: #{element}"
260
- exit
254
+ puts "❌ Error: Not found object: #{element}"
255
+ exit(1)
261
256
  end
262
257
  end
263
258
 
@@ -265,8 +260,8 @@ def close_windows
265
260
  begin
266
261
  page.execute_script "window.close();"
267
262
  rescue StandardError => e
268
- raise "\n>>> Error: #{e}"
269
- exit
263
+ puts "Error: #{e}"
264
+ exit(1)
270
265
  end
271
266
  end
272
267
 
@@ -275,8 +270,8 @@ def resize_window_screen(x, y)
275
270
  page.driver.browser.manage.window.resize_to(x, y)
276
271
  puts page.driver.browser.manage.window.size
277
272
  rescue StandardError => e
278
- raise "\n>>> Error: #{e}"
279
- exit
273
+ puts "Error: #{e}"
274
+ exit(1)
280
275
  end
281
276
  end
282
277
 
@@ -284,8 +279,8 @@ def switch_to_frame(element)
284
279
  begin
285
280
  page.driver.browser.switch_to.frame element
286
281
  rescue Exception => e
287
- raise "\n>>> Error: #{e}"
288
- exit
282
+ puts "Error: #{e}"
283
+ exit(1)
289
284
  end
290
285
  end
291
286
 
@@ -295,15 +290,15 @@ def get_computed_style(element, style)
295
290
  if foundElement != nil
296
291
  computedStyle = page.evaluate_script("window.getComputedStyle(document.querySelector('#{foundElement}')).#{style}")
297
292
  else
298
- raise "\nError >> Not found object: #{element}"
299
- exit
293
+ puts "❌ Error: Not found object: #{element}"
294
+ exit(1)
300
295
  end
301
296
  puts "\nActual object style value is: #{computedStyle}"
302
297
  computedStyle
303
298
  end
304
299
 
305
300
  def put_log str
306
- p str if $_CFWEB['Print Log'] == true
301
+ p str if $print_log == true
307
302
  end
308
303
 
309
304
  def get_object_value(str_obj)
@@ -311,11 +306,11 @@ def get_object_value(str_obj)
311
306
  hash_object = $OBJECT[string_object]
312
307
  if hash_object == nil
313
308
  raise ">>> OBJECT: #{str_obj} NAME MAYBE NOT FOUND!!!"
314
- exit
309
+ exit(1)
315
310
  end
316
311
  if hash_object.keys[0].to_s.upcase != "CSS_SELECTOR"
317
312
  raise ">>> OBJECT: #{str_obj} should be formatted as Css Selector."
318
- exit
313
+ exit(1)
319
314
  end
320
315
  hash_object[hash_object.keys[0]]
321
316
  end
@@ -327,12 +322,12 @@ def get_element_text(element)
327
322
  result = foundElement.text()
328
323
  puts "Text of #{element}: #{result}"
329
324
  rescue StandardError => e
330
- raise "\n>>> Error: #{e}"
331
- exit
325
+ puts "Error: #{e}"
326
+ exit(1)
332
327
  end
333
328
  else
334
- raise "\nError >> Not found object: #{element}"
335
- exit
329
+ puts "❌ Error: Not found object: #{element}"
330
+ exit(1)
336
331
  end
337
332
  end
338
333
 
@@ -343,12 +338,12 @@ def get_element_attribute(element,value)
343
338
  result = foundElement.value()
344
339
  puts "Attribute of #{element}: #{result}"
345
340
  rescue StandardError => e
346
- raise "\n>>> Error: #{e}"
347
- exit
341
+ puts "Error: #{e}"
342
+ exit(1)
348
343
  end
349
344
  else
350
- raise "\nError >> Not found object: #{element}"
351
- exit
345
+ puts "❌ Error: Not found object: #{element}"
346
+ exit(1)
352
347
  end
353
348
  end
354
349
 
@@ -360,12 +355,12 @@ def verify_element_text(element,value)
360
355
  put_log "Actual result is: '#{actual_value}' -- Expected result is: '#{value}'"
361
356
  expect(actual_value).to eq value
362
357
  rescue Exception => e
363
- raise "\n>>> ERROR: #{e} "
364
- exit
358
+ puts "ERROR: #{e} "
359
+ exit(1)
365
360
  end
366
361
  else
367
- raise "\nError >> Not found object: #{element}"
368
- exit
362
+ puts "❌ Error: Not found object: #{element}"
363
+ exit(1)
369
364
  end
370
365
  end
371
366
 
@@ -377,13 +372,13 @@ def verify_element_not_has_text(element,value)
377
372
  put_log "Actual result is: '#{actual_value}' -- Expected result is: '#{value}'"
378
373
  expect(actual_value).not_to eql value
379
374
  rescue Exception => e
380
- raise "\n>>> ERROR: #{e}"
381
- exit
375
+ puts "ERROR: #{e}"
376
+ exit(1)
382
377
  end
383
378
 
384
379
  else
385
- raise "\nError >> Not found object: #{element}"
386
- exit
380
+ puts "❌ Error: Not found object: #{element}"
381
+ exit(1)
387
382
  end
388
383
  end
389
384
 
@@ -395,12 +390,12 @@ def verify_element_value(element,value)
395
390
  put_log "Actual result is: '#{actual_value}' -- Expected result is: '#{value}'"
396
391
  expect(actual_value).to eq value
397
392
  rescue Exception => e
398
- raise "\n>>> ERROR: #{e}"
399
- exit
393
+ puts "ERROR: #{e}"
394
+ exit(1)
400
395
  end
401
396
  else
402
- raise "\nError >> Not found object: #{element}"
403
- exit
397
+ puts "❌ Error: Not found object: #{element}"
398
+ exit(1)
404
399
  end
405
400
  end
406
401
 
@@ -412,12 +407,12 @@ def verify_element_not_has_value(element,value)
412
407
  put_log "Actual result is: '#{actual_value}' -- Expected result is: '#{value}'"
413
408
  expect(actual_value).not_to eql value
414
409
  rescue Exception => e
415
- raise "\n>>> ERROR: #{e}"
416
- exit
410
+ puts "ERROR: #{e}"
411
+ exit(1)
417
412
  end
418
413
  else
419
- raise "\nError >> Not found object: #{element}"
420
- exit
414
+ puts "❌ Error: Not found object: #{element}"
415
+ exit(1)
421
416
  end
422
417
  end
423
418
 
@@ -451,7 +446,7 @@ def execute_checkproperty(element, property, negate, value, isSpecialChar=false)
451
446
  actual_value = ''
452
447
  end
453
448
  else
454
- put_log "\nError >> Not found object: #{element}"
449
+ put_log "❌ Error: Not found object: #{element}"
455
450
  end
456
451
 
457
452
  Capybara.configure do |config|
@@ -502,7 +497,8 @@ def find_object string_object
502
497
  end
503
498
  hash_object = $OBJECT[string_object]
504
499
  if hash_object == nil
505
- raise "ERROR: >>> Object: #{string_object} is not found in Object Repository."
500
+ puts "ERROR: >>> Object: #{string_object} is not found in Object Repository."
501
+ exit(1)
506
502
  end
507
503
  upcase_attrb = {}
508
504
  if hash_object != nil
@@ -610,9 +606,9 @@ def find_object string_object
610
606
  break
611
607
  end
612
608
  test = currentTime - startTime
613
- puts "\n#TIME-OUT:#{test} < #{$_CFWEB['Wait Time']}"
609
+ puts "\n Finding the object #{string_object}... TIME-OUT:: #{test} < #{$wait_time}"
614
610
  sleep(0.5)
615
- end while (currentTime - startTime) < $_CFWEB['Wait Time']
611
+ end while (currentTime - startTime) < $wait_time
616
612
 
617
613
  if foundElements != nil or foundElements.length != 0
618
614
  if index != nil and index.to_i >= 0
@@ -682,7 +678,7 @@ def get_objects_by_Id(strId)
682
678
  begin
683
679
  foundElements = page.all("*[@id='#{strId}']")
684
680
  rescue StandardError => e
685
- raise "\n>>> Error: #{e}"
681
+ puts "Error: #{e}"
686
682
  end
687
683
 
688
684
  return foundElements
@@ -693,7 +689,7 @@ def get_objects_by_Class(strClass)
693
689
  begin
694
690
  foundElements = page.all("*[@class='#{strClass}']")
695
691
  rescue StandardError => e
696
- raise "\n>>> Error: #{e}"
692
+ puts "Error: #{e}"
697
693
  end
698
694
 
699
695
  return foundElements
@@ -704,7 +700,7 @@ def get_objects_by_Name(strName)
704
700
  begin
705
701
  foundElements = page.all("*[@name='#{strName}']")
706
702
  rescue StandardError => e
707
- raise "\n>>> Error: #{e}"
703
+ puts "Error: #{e}"
708
704
  end
709
705
 
710
706
  return foundElements
@@ -715,7 +711,7 @@ def get_objects_by_Tagname(strTagname)
715
711
  begin
716
712
  foundElements = page.all("#{strTagname}")
717
713
  rescue StandardError => e
718
- raise "\n>>> Error: #{e}"
714
+ puts "Error: #{e}"
719
715
  end
720
716
 
721
717
  return foundElements
@@ -726,7 +722,7 @@ def get_objects_by_css_selector(strCssSelector)
726
722
  begin
727
723
  foundElements = page.all(:css, strCssSelector)
728
724
  rescue StandardError => e
729
- raise "\n>>> Error: #{e}"
725
+ puts "Error: #{e}"
730
726
  end
731
727
  foundElements
732
728
  end
@@ -736,7 +732,7 @@ def get_objects_by_xpath_selector(strXpathSelector)
736
732
  begin
737
733
  foundElements = page.all(:xpath, strXpathSelector)
738
734
  rescue StandardError => e
739
- raise "\n>>> Error: #{e}"
735
+ puts "Error: #{e}"
740
736
  end
741
737
  foundElements
742
738
  end
@@ -985,7 +981,7 @@ def find_object_check_ref_object(ref_object, ref_type, target_element)
985
981
  return true
986
982
  end
987
983
  rescue StandardError => e
988
- raise "\n>>> Error: #{e}"
984
+ puts "Error: #{e}"
989
985
  end
990
986
 
991
987
  return false;
@@ -1011,12 +1007,12 @@ def drag_and_drop_by_offset(element, x, y)
1011
1007
  begin
1012
1008
  page.driver.browser.action.drag_and_drop_by(foundElement, x, y).perform
1013
1009
  rescue Exception => e
1014
- raise "\n>>> ERROR: #{e}"
1015
- exit
1010
+ puts "ERROR: #{e}"
1011
+ exit(1)
1016
1012
  end
1017
1013
  else
1018
- raise "\nError >> Not found object: #{element}"
1019
- exit
1014
+ puts "❌ Error: Not found object: #{element}"
1015
+ exit(1)
1020
1016
  end
1021
1017
  end
1022
1018
 
@@ -1035,12 +1031,12 @@ def execute_sendkeys(element, key)
1035
1031
  begin
1036
1032
  foundElement.native.send_keys(key)
1037
1033
  rescue Exception => e
1038
- raise "\n>>> ERROR: #{e}"
1039
- exit
1034
+ puts "ERROR: #{e}"
1035
+ exit(1)
1040
1036
  end
1041
1037
  else
1042
- raise "\nError >> Not found object: #{element}"
1043
- exit
1038
+ puts "❌ Error: Not found object: #{element}"
1039
+ exit(1)
1044
1040
  end
1045
1041
  end
1046
1042