scoutui 2.0.3.31.pre → 2.0.3.32.pre

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 73a3448dde2bef2a6176cd5a8845b08caca7d92c
4
- data.tar.gz: 808bda329dce2017ffd5133606337a70512a2379
3
+ metadata.gz: 94cd87322cf8c91d5ac519bc749a6e96d8984b9c
4
+ data.tar.gz: 8f0b560c94101065a3785987d4c55e2ca85726a0
5
5
  SHA512:
6
- metadata.gz: 59ba1d8747567b7a8261afd434f3a86e8c8a6913d6e28a1d7afaee997b0e72041d12c03d72ceb03fb488e116219c393957a8e366891697fa88c3b3d14f53dd37
7
- data.tar.gz: 0cca14d03c2acb9a15c87cf6b979f61a0f8a4840f39a47860842c0ed1062b5755697e644d23efb24f8ebe92e4efe50d6883f5a5178524b84a34c0aefa0aca518
6
+ metadata.gz: 37cdcff948a33c1ca3e754d38dafcf61f1ecd90350f6d6ab5ec917d307383412ece1bae34c9999913afc07cbed0be53901124e4980bf171aafebb2f30295f777
7
+ data.tar.gz: 69cc7c0745d6fd6d30b12b4c7bfd94c39bd2730c5745e4850dab7090d4cd9568b8a8894ca99cdbc6dd7fa386064446bc6abdb9e94a168a2c4a96c3f0b2a4e8f5
@@ -15,7 +15,8 @@ module Scoutui::Base
15
15
  @assertionTypes=[
16
16
  { :cmd => 'isEnabled', :pattern => '^\s*[!]*isEnabled\((.*)\)\s*$', :parse => lambda { |_a| _parseFrameLoc('isEnabled', _a) } },
17
17
  { :cmd => 'isSelected', :pattern => '^\s*[!]*isSelected\((.*)\)\s*$', :parse => lambda { |_a| _parseFrameLoc('isSelected', _a) } },
18
- { :cmd => 'isValue', :pattern => '^\s*(isValue)\s*\(.*\)\s*\=\s*(.*)\s*$', :parse => lambda { |_a| _parseWith('isValue', _a) } },
18
+ { :cmd => 'isText', :pattern => '^\s*[!]*(isText)\s*\(.*\)\s*\=\s*(.*)\s*$', :parse => lambda { |_a| _parseWith('isText', _a) } },
19
+ { :cmd => 'isValue', :pattern => '^\s*[!]*(isValue)\s*\(.*\)\s*\=\s*(.*)\s*$', :parse => lambda { |_a| _parseWith('isValue', _a) } },
19
20
  { :cmd => 'visible', :pattern => '^\s*[!]*visible\((.*)\)\s*$', :parse => nil }
20
21
  ]
21
22
 
@@ -88,6 +89,38 @@ module Scoutui::Base
88
89
  rc
89
90
  end
90
91
 
92
+
93
+ # Returns
94
+ #
95
+ # if frame exists
96
+ # {
97
+ # 'frame' => <frame>,
98
+ # 'locator' => 'locator'
99
+ # }
100
+ #
101
+ # otherwise,
102
+ #
103
+ # { 'locator => <locator> '}
104
+ def _parseFrameLocator(_a)
105
+ puts __FILE__ + (__LINE__).to_s + " _parseFrameLocator(#{_a})"
106
+ _pattern='(frame\(.*\)[\.frame\(.*\)]*)\s*,\s*(.*)\s*$'
107
+ _fMatch = _a.match(/#{_pattern}/)
108
+ puts __FILE__ + (__LINE__).to_s + " === _fMatch : #{_fMatch}"
109
+ rc=nil
110
+ if _fMatch
111
+ rc = {
112
+ 'frame' => _fMatch[1].strip,
113
+ 'locator' => _fMatch[2].strip }
114
+ else
115
+ rc = {
116
+ 'locator' => _a
117
+ }
118
+ end
119
+
120
+ puts __FILE__ + (__LINE__).to_s + " _parseFrameLocator(#{_a}) => #{rc}"
121
+ rc
122
+ end
123
+
91
124
  # _a : frame(xyz).frame(123), <locator>
92
125
  def _parseFrameLoc(_cmd, _a)
93
126
 
@@ -179,7 +212,7 @@ module Scoutui::Base
179
212
  ;
180
213
  end
181
214
 
182
- puts __FILE__ + (__LINE__).to_s + " isVisibleCmd?(#{_a}) : #{rc}"
215
+ puts __FILE__ + (__LINE__).to_s + " isVisibleFrameCmd?(#{_a}) : #{rc}"
183
216
  rc
184
217
  end
185
218
 
@@ -257,7 +290,7 @@ module Scoutui::Base
257
290
  end
258
291
 
259
292
 
260
- def isEnabled?(my_driver, _execute_when)
293
+ def isEnabled?(my_driver, _execute_when, _enableAsserts=true)
261
294
 
262
295
  rc=true
263
296
  _locator=nil
@@ -278,7 +311,7 @@ module Scoutui::Base
278
311
  Scoutui::Commands::Utils.instance.setEnableFrameSearch(_t['frame'])
279
312
  end
280
313
 
281
- _obj = Scoutui::Base::QBrowser.findElement(my_driver, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
314
+ _obj = Scoutui::Base::QBrowser.findElement(my_driver, Scoutui::Base::UserVars.instance.normalize(_locator), Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
282
315
  else
283
316
  Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " invalid assertion cmd: #{_execute_when}"
284
317
  end
@@ -305,19 +338,58 @@ module Scoutui::Base
305
338
  puts __FILE__ + (__LINE__).to_s + " _obj.enabled? => #{_enabled}"
306
339
 
307
340
  if _execute_when.match(/^\s*!isEnabled/i) && _enabled
308
- Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " !isEnabled(#{_locator}) : false"
309
- rc=false
341
+
342
+ if _enableAsserts
343
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " !isEnabled(#{_locator}) : false"
344
+ rc=false
345
+ else
346
+
347
+ begin
348
+ Selenium::WebDriver::Wait.new(timeout: 15).until {
349
+ _obj = Scoutui::Base::QBrowser.findElement(my_driver, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
350
+ puts __FILE__ + (__LINE__).to_s + " waiting .. => #{_obj.class.to_s} : enabled - #{_obj.enabled?}"
351
+
352
+ !_obj.enabled?
353
+ }
354
+
355
+ rescue Selenium::WebDriver::Error::TimeOutError
356
+ rc=!_obj.enabled?
357
+
358
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " TimeOutError waiting for !enabled - #{_locator} => #{rc}"
359
+ end
360
+
361
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " wait #{_locator} to be !enabled => #{rc}"
362
+ end
363
+
310
364
  elsif _execute_when.match(/^\s*isEnabled/i) && !_enabled
311
365
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isEnabled(#{_locator}) : false"
312
366
  rc=false
313
367
  end
314
368
 
369
+
370
+
371
+ elsif _t.has_key?('cmd') && !_t['cmd'].empty? && _t['cmd'].match(/[!]*isText/i)
372
+ rc=false
373
+
374
+ if _obj.is_a?(Selenium::WebDriver::Element)
375
+ _v = _obj.text.to_s
376
+ rc=!_v.match(/#{_t['expected_value']}/).nil?
377
+
378
+ if _t['cmd'].match(/^!\s*isText/i)
379
+ rc=!rc
380
+ end
381
+ end
382
+
315
383
  elsif _t.has_key?('cmd') && !_t['cmd'].empty? && _t['cmd'].match(/[!]*isValue/i)
316
384
  rc=false
317
385
 
318
386
  if _obj.is_a?(Selenium::WebDriver::Element)
319
387
  _v = _obj.attribute('value')
320
388
  rc=!_v.match(/#{_t['expected_value']}/).nil?
389
+
390
+ if _t['cmd'].match(/^!\s*isValue/i)
391
+ rc=!rc
392
+ end
321
393
  end
322
394
 
323
395
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " assert #{_t['locator']} expected: #{_t['expected_value']} with actual: #{_v} => #{rc}"
@@ -353,7 +425,7 @@ module Scoutui::Base
353
425
  end
354
426
 
355
427
 
356
- def isVisible?(my_driver, _execute_when)
428
+ def isVisible?(my_driver, _execute_when, _enableAsserts=true)
357
429
  rc=true
358
430
 
359
431
  begin
@@ -361,7 +433,9 @@ module Scoutui::Base
361
433
  _t = isVisibleFrameCmd?(_execute_when)
362
434
 
363
435
  if !_t.nil?
364
- _locator = _t['locator']
436
+ # 5150 _locator = _t['locator']
437
+ _locator = Scoutui::Base::UserVars.instance.normalize(_locator)
438
+
365
439
  Scoutui::Commands::Utils.instance.setEnableFrameSearch(_t['frame'])
366
440
  elsif isVisibleCmd?(_execute_when)
367
441
  _locator = _execute_when.match(/^\s*[!]*visible\((.*)\)\s*$/i)[1].to_s
@@ -382,6 +456,42 @@ module Scoutui::Base
382
456
  end
383
457
 
384
458
 
459
+ if !_enableAsserts
460
+ _rc=false
461
+
462
+ begin
463
+ if _execute_when.match(/^\s*!visible/)
464
+
465
+ Selenium::WebDriver::Wait.new(timeout: 15).until {
466
+ _obj = Scoutui::Base::QBrowser.findElement(my_driver, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
467
+ puts __FILE__ + (__LINE__).to_s + " waiting .. => #{_obj.class.to_s}"
468
+ _rc = (_obj.is_a?(Selenium::WebDriver::Element) && !_obj.displayed?) || _obj.nil?
469
+ }
470
+
471
+ elsif _execute_when.match(/^\s*visible/)
472
+
473
+ Selenium::WebDriver::Wait.new(timeout: 15).until {
474
+ _obj = Scoutui::Base::QBrowser.findElement(my_driver, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
475
+ puts __FILE__ + (__LINE__).to_s + " waiting .. => #{_obj.class.to_s}"
476
+
477
+ if _obj.is_a?(Selenium::WebDriver::Element)
478
+ puts "***** displayed? : #{_obj.displayed?}"
479
+ end
480
+
481
+ _rc = !_obj.nil? && _obj.displayed?
482
+ _rc
483
+ }
484
+ end
485
+
486
+ rescue Selenium::WebDriver::Error::TimeOutError
487
+ ;
488
+ end
489
+
490
+ puts __FILE__ + (__LINE__).to_s + " waitFor : #{_rc}"
491
+ return _rc
492
+ end
493
+
494
+
385
495
  puts __FILE__ + (__LINE__).to_s + " _obj.displayed? => #{_state}"
386
496
 
387
497
  if _execute_when.match(/^\s*!visible/i) && _state
@@ -53,6 +53,18 @@ module Scoutui::Base
53
53
  rc
54
54
  end
55
55
 
56
+ def self.isFileType?(obj)
57
+ rc=false
58
+ begin
59
+ if obj.is_a?(Selenium::WebDriver::Element)
60
+ rc=!obj.attribute('type').match(/file/i).nil?
61
+ end
62
+ rescue => ex
63
+ ;
64
+ end
65
+
66
+ rc
67
+ end
56
68
 
57
69
  def self.existsAlert?(drv)
58
70
  rc=false
@@ -0,0 +1,33 @@
1
+
2
+
3
+ require 'singleton'
4
+
5
+
6
+ module Scoutui::Base
7
+
8
+ class Requirements
9
+ include Singleton
10
+
11
+ attr_accessor :requirements
12
+
13
+ def initialize
14
+ @requirements={}
15
+ end
16
+
17
+
18
+ def add(_id, _reqs)
19
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " add(#{_id}, #{_reqs}"
20
+ @requirements[_id]=_reqs
21
+ end
22
+
23
+ def get(_id)
24
+ @requirements[_id]
25
+ end
26
+
27
+ end
28
+
29
+
30
+
31
+
32
+
33
+ end
@@ -318,7 +318,7 @@ module Scoutui::Base
318
318
  processConditions(my_driver, e, 'assertions')
319
319
  end
320
320
 
321
- def self.processAsserts(my_driver, _execute_when)
321
+ def self.processAsserts(my_driver, _execute_when, _enableAsserts=true)
322
322
 
323
323
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " processAsserts#{_execute_when}"
324
324
 
@@ -340,11 +340,13 @@ module Scoutui::Base
340
340
 
341
341
 
342
342
  if _assertType[:cmd]=='isEnabled' # Scoutui::Base::Assertions.instance.isEnabledCmd?(_a)
343
- _rc=Scoutui::Base::Assertions.instance.isEnabled?(my_driver, _a)
343
+ _rc=Scoutui::Base::Assertions.instance.isEnabled?(my_driver, _a, _enableAsserts)
344
344
  elsif _assertType[:cmd]=='visible'
345
- _rc=Scoutui::Base::Assertions.instance.isVisible?(my_driver, _a)
345
+ _rc=Scoutui::Base::Assertions.instance.isVisible?(my_driver, _a, _enableAsserts)
346
346
  elsif _assertType[:cmd]=='isSelected'
347
347
  _rc=Scoutui::Base::Assertions.instance.isEnabled?(my_driver, _a)
348
+ elsif _assertType[:cmd]=='isText'
349
+ _rc=Scoutui::Base::Assertions.instance.isEnabled?(my_driver, _a)
348
350
  elsif _assertType[:cmd]=='isValue'
349
351
  _rc=Scoutui::Base::Assertions.instance.isEnabled?(my_driver, _a)
350
352
  end
@@ -359,11 +361,25 @@ module Scoutui::Base
359
361
  _rc=Scoutui::Base::Assertions.instance.isValue?(my_driver, _a)
360
362
  elsif Scoutui::Base::Assertions.instance.isTitleCmd?(_a)
361
363
  _rc=Scoutui::Base::Assertions.instance.isTitle(my_driver, _a)
364
+ elsif _a.match(/^\s*(req|requirement)\s*\((.*)\)\s*$/i)
365
+
366
+ _reqID=_a.match(/^\s*(req|requirement)\s*\((.*)\)\s*$/i)[2].to_s
367
+
368
+ puts __FILE__ + (__LINE__).to_s + " Process REQ ASSERT: #{_reqID}";
369
+ _reqAsserts=Scoutui::Base::Requirements.instance.get(_reqID)
370
+ puts __FILE__ + (__LINE__).to_s + " => #{_reqAsserts}"
371
+
372
+ _req = Scoutui::Utils::TestUtils.instance.setReq(_reqID)
373
+ _rc=processAsserts(my_driver, _reqAsserts, _enableAsserts)
374
+ Scoutui::Utils::TestUtils.instance.setReq(_req)
362
375
  end
363
376
 
364
377
  if !_rc.nil?
365
- Scoutui::Logger::LogMgr.instance.asserts.info __FILE__ + (__LINE__).to_s + " Verify #{_a} - #{_rc}"
366
- Testmgr::TestReport.instance.getReq(_req).get_child('visible_when').add(_rc, "Verify #{_a}")
378
+
379
+ if _enableAsserts
380
+ Scoutui::Logger::LogMgr.instance.asserts.info __FILE__ + (__LINE__).to_s + " Verify #{_a} - #{_rc}"
381
+ Testmgr::TestReport.instance.getReq(_req).get_child('visible_when').add(_rc, "Verify #{_a}")
382
+ end
367
383
 
368
384
  Scoutui::Commands::Utils.instance.resetFrameSearch()
369
385
 
@@ -1081,7 +1097,30 @@ module Scoutui::Base
1081
1097
  end
1082
1098
 
1083
1099
  if !_region.nil?
1084
- eyeScout.check_window(_name, _region)
1100
+
1101
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " snapit.region: #{_region}"
1102
+ _frames = Scoutui::Base::Assertions.instance._parseFrameLocator(_region)
1103
+
1104
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "*** frames: #{_frames}"
1105
+
1106
+
1107
+
1108
+ if _frames.has_key?('frame')
1109
+ my_driver.switch_to.default_content
1110
+ Scoutui::Commands::Utils.instance.resetFrameSearch
1111
+ Scoutui::Commands::Utils.instance.setEnableFrameSearch(_frames['frame'])
1112
+
1113
+ _obj=Scoutui::Base::QBrowser.findElement(my_driver, _frames['locator]'], Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
1114
+ Scoutui::Base::QBrowser.highlight(my_driver, obj)
1115
+
1116
+ Scoutui::Base::QBrowser.switch_frame(my_driver, _frames['frame'])
1117
+
1118
+ eyeScout.check_window(_name, _frames['locator'])
1119
+ else
1120
+ eyeScout.check_window(_name, Scoutui::Base::UserVars.instance.normalize(_region))
1121
+ end
1122
+
1123
+
1085
1124
  else
1086
1125
  eyeScout.check_window(_name)
1087
1126
  end
@@ -1107,7 +1146,7 @@ module Scoutui::Base
1107
1146
  processAssertions(my_driver, e)
1108
1147
 
1109
1148
  if !_region.nil?
1110
- eyeScout.check_window(_name, _region)
1149
+ eyeScout.check_window(_name, Scoutui::Base::UserVars.instance.normalize(_region))
1111
1150
  else
1112
1151
  eyeScout.check_window(_name)
1113
1152
  end
@@ -68,10 +68,17 @@ module Scoutui::Commands
68
68
 
69
69
  # Refactor in qbrowser
70
70
 
71
- wait = Selenium::WebDriver::Wait.new(:timeout => Scoutui::Commands::Utils.instance.getTimeout)
72
-
73
71
  isDisplayed=false
74
- isDisplayed = wait.until { obj.displayed? }
72
+
73
+ begin
74
+ wait = Selenium::WebDriver::Wait.new(:timeout => Scoutui::Commands::Utils.instance.getTimeout)
75
+ isDisplayed = wait.until {
76
+ true if obj.displayed?
77
+ }
78
+ rescue Selenium::WebDriver::Error::TimeOutError => ex
79
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Timeout waiting for display?: #{_xpath}"
80
+ end
81
+
75
82
 
76
83
  if isDisplayed
77
84
 
@@ -50,6 +50,38 @@ module Scoutui::Commands
50
50
  _cmd='pause'
51
51
  _c = Scoutui::Commands::Pause.new(nil)
52
52
  _c.execute(e);
53
+
54
+ elsif Scoutui::Commands::Utils.instance.isLoadRequirements?(_action)
55
+ _cmd='loadrequirements'
56
+ _c = Scoutui::Commands::LoadRequirements.new(e)
57
+ _c.run(driver: my_driver, dut: e)
58
+ elsif Scoutui::Commands::Utils.instance.isAssignments?(_action)
59
+ _cmd='assignments'
60
+ if e['page'].has_key?('vars')
61
+ e['page']['vars'].each do |_a|
62
+
63
+ puts __FILE__ + (__LINE__).to_s + " Process Assignment.var : #{_a}"
64
+
65
+ begin
66
+ _caborted=false
67
+
68
+ if !Scoutui::Commands::Utils.instance.isAssignVar?(_a)
69
+ _m=_a.match(/([\w\_])+\=(.*)/)
70
+ _a="assign(#{_m[1]},#{_m[2]})"
71
+ end
72
+
73
+ _c = Scoutui::Commands::AssignVar.new(_a)
74
+ _rc=_c.run(driver: my_driver, dut: e)
75
+ _c.setResult(_rc)
76
+ rescue => ex
77
+ _caborted=true
78
+ end
79
+
80
+ Testmgr::TestReport.instance.getReq(_req).get_child(_cmd.downcase).add(!_caborted, "Verify command assign did not abort")
81
+ end
82
+ end
83
+
84
+
53
85
  elsif Scoutui::Commands::Utils.instance.isAssignVar?(_action)
54
86
  _cmd='assignvar'
55
87
  _c = Scoutui::Commands::AssignVar.new(_action)
@@ -136,6 +168,12 @@ module Scoutui::Commands
136
168
  _c = Scoutui::Commands::UpdateUrl.new(_action)
137
169
  _c.run(driver: my_driver)
138
170
 
171
+
172
+ elsif Scoutui::Commands::Utils.instance.isUploadFiles?(_action)
173
+ _cmd='UploadFiles'
174
+ _c = Scoutui::Commands::UploadFiles.new(_action)
175
+ rc=_c.execute(my_driver, e)
176
+
139
177
  elsif Scoutui::Commands::Utils.instance.isVerifyElt?(_action)
140
178
  _cmd='VerifyElement'
141
179
  _c = Scoutui::Commands::VerifyElement.new(_action)
@@ -44,6 +44,17 @@ module Scoutui::Commands
44
44
 
45
45
  locators.each do |elt|
46
46
 
47
+
48
+ q=Scoutui::Base::Assertions.instance._parseFrameLocator(elt)
49
+
50
+ if q.has_key?('frame')
51
+ Scoutui::Commands::Utils.instance.setEnableFrameSearch(q['frame'])
52
+ elt = q['locator']
53
+
54
+ # puts __FILE__ + (__LINE__).to_s + " highlight with frame #{q['frame']} with locator #{q['locator']} - PAUSE"
55
+ end
56
+
57
+
47
58
  _loc = Scoutui::Base::UserVars.instance.normalize(elt)
48
59
 
49
60
  # obj = Scoutui::Base::QBrowser.getObject(@drv, loc, Scoutui::Commands::Utils.instance.getTimeout)
@@ -52,8 +63,17 @@ module Scoutui::Commands
52
63
  Scoutui::Commands::Utils.instance.getFrameSearch(),
53
64
  Scoutui::Commands::Utils.instance.getTimeout)
54
65
 
66
+ if !obj.is_a?(Selenium::WebDriver::Element)
67
+ Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " highlight : unable to find #{_loc}"
68
+ end
69
+
55
70
  _rc = _highlight(obj, e)
56
71
 
72
+ if q.has_key?('frame')
73
+ @drv.switch_to.default_content
74
+ Scoutui::Commands::Utils.instance.resetFrameSearch
75
+ end
76
+
57
77
  rc &&= _rc
58
78
 
59
79
  Testmgr::TestReport.instance.getReq(_req).testcase('highlight').add(!obj.nil?, "Verify object #{_locator} to highlight exists : #{obj.class.to_s}")
@@ -0,0 +1,58 @@
1
+ require_relative './commands'
2
+
3
+ module Scoutui::Commands
4
+
5
+ class LoadRequirements < Command
6
+
7
+
8
+ def execute(drv, e=nil)
9
+ @drv=drv if !drv.nil?
10
+
11
+ rc=false
12
+ obj=nil
13
+ _locator=nil
14
+
15
+ _req = Scoutui::Utils::TestUtils.instance.getReq()
16
+
17
+ begin
18
+
19
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " LoadRequirements()"
20
+
21
+ if e['page'].has_key?('files')
22
+
23
+ e['page']['files'].each do |r|
24
+ y=YAML.load_stream File.read(r)
25
+
26
+ puts __FILE__ + (__LINE__).to_s + " *** REQMT => #{y}"
27
+
28
+ y.each do |_y|
29
+ puts __FILE__ + (__LINE__).to_s + " ===> #{_y}"
30
+ Scoutui::Base::Requirements.instance.add(_y['requirement']['name'], _y['requirement']['assertions'])
31
+ end
32
+
33
+
34
+ end
35
+
36
+
37
+ end
38
+
39
+ rc=true
40
+
41
+ rescue => ex
42
+ Scoutui::Logger::LogMgr.instance.warn "Error during processing: #{ex}"
43
+ Scoutui::Logger::LogMgr.instance.warn "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
44
+ end
45
+
46
+ if rc
47
+ Scoutui::Logger::LogMgr.instance.asserts.info "Verify requirements command passed - #{rc}"
48
+ Testmgr::TestReport.instance.getReq(_req).testcase('click').add(rc, "Verify requirements command passed")
49
+ end
50
+
51
+ setResult(rc)
52
+ end
53
+
54
+ end
55
+
56
+
57
+
58
+ end
@@ -6,7 +6,6 @@ module Scoutui::Commands
6
6
 
7
7
 
8
8
  KEYBOARD_LIST={
9
-
10
9
  '__DOWN__' => lambda { |obj| obj.send_keys(:arrow_down) },
11
10
  '__TAB__' => lambda { |obj| obj.send_keys(:tab) },
12
11
  '__CLEAR__' => lambda { |obj| obj.clear }
@@ -49,6 +48,7 @@ module Scoutui::Commands
49
48
 
50
49
  end
51
50
 
51
+
52
52
  def execute(drv=nil, _notUsed=nil)
53
53
  @drv=drv if !drv.nil?
54
54
 
@@ -81,24 +81,31 @@ module Scoutui::Commands
81
81
 
82
82
  if !obj.nil? &&
83
83
  (obj.tag_name.downcase=='body' ||
84
- !obj.attribute('type').downcase.match(/(text|textarea|password|email)/).nil? )
84
+ !obj.attribute('type').downcase.match(/(file|input|text|textarea|password|email)/).nil? )
85
85
 
86
- # Refactor in qbrowser
87
-
88
- wait = Selenium::WebDriver::Wait.new(:timeout => Scoutui::Commands::Utils.instance.getTimeout)
89
86
  isDisplayed=false
90
- isDisplayed = wait.until {
91
- true if obj.displayed?
92
- }
93
87
 
94
- if @cmd.match(/type\!/i)
88
+ # FileUpload dialog is not 'displayed'
89
+ if !Scoutui::Base::QBrowser.isFileType?(obj)
90
+ begin
91
+ wait = Selenium::WebDriver::Wait.new(:timeout => Scoutui::Commands::Utils.instance.getTimeout)
92
+ isDisplayed = wait.until {
93
+ true if obj.displayed?
94
+ }
95
+ rescue Selenium::WebDriver::Error::TimeOutError => ex
96
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Timeout waiting for display?: #{_xpath}"
97
+ end
98
+ end
99
+
100
+
101
+ if @cmd.match(/^\s*type\!/i)
95
102
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " clear()"
96
103
  obj.clear if isDisplayed
97
104
  end
98
105
 
99
106
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " send_keys(#{_val})"
100
107
 
101
- if isDisplayed
108
+ if isDisplayed || Scoutui::Base::QBrowser.isFileType?(obj)
102
109
 
103
110
  if KEYBOARD_LIST.has_key?(_val.strip)
104
111
  KEYBOARD_LIST[_val.strip].call(obj)
@@ -125,9 +132,9 @@ module Scoutui::Commands
125
132
  ## Global replaces
126
133
  _text_to_type = Scoutui::Base::UserVars.instance.get(_v2)
127
134
 
128
- puts __FILE__ + (__LINE__).to_s + " rawText : #{_text_to_type}"
135
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " rawText : #{_text_to_type}"
129
136
  _text_to_type = Scoutui::Commands::Utils.instance.expandMacro(_text_to_type)
130
- puts __FILE__ + (__LINE__).to_s + " Text to type : #{_text_to_type}"
137
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Text to type : #{_text_to_type}"
131
138
  obj.send_keys(_text_to_type)
132
139
 
133
140
  if !obj.nil? && false
@@ -160,7 +167,7 @@ module Scoutui::Commands
160
167
  end
161
168
 
162
169
  rescue => ex
163
- Scoutui::Logger::LogMgr.instance.debug "Error during processing: #{ex}"
170
+ Scoutui::Logger::LogMgr.instance.debug "Error during processing: #{ex.class}"
164
171
  puts __FILE__ + (__LINE__).to_s + "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
165
172
  end
166
173
 
@@ -0,0 +1,75 @@
1
+
2
+ module Scoutui::Commands
3
+
4
+ class UploadFiles < Command
5
+
6
+
7
+
8
+ def execute(drv, _e=nil)
9
+
10
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " uploadFiles(#{_e})"
11
+
12
+ _rc=true
13
+
14
+ @drv=drv if !drv.nil?
15
+
16
+
17
+ filelist=_e['page']['with']
18
+ to=_e['page']['to']
19
+ submit=_e['page']['submit']
20
+ close=_e['page']['close']
21
+ waitList=_e['page']['wait']
22
+
23
+ if filelist.is_a?(Array)
24
+
25
+ filelist.each do |_f|
26
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " upload #{_f}"
27
+
28
+ if _e['page'].has_key?('by')
29
+
30
+ test_settings={}
31
+ test_settings['dut']=_e['page']['by']
32
+ # Scoutui::Base::VisualTestFramework::processFile(eyeScout, test_settings, strategy=nil)
33
+ _typeCmd={ 'page' => {'action' => "click(#{_e['page']['by']})"} }
34
+ _c = Scoutui::Commands::ClickObject.new(_typeCmd)
35
+ _c.run(driver: @drv, dut: nil)
36
+ end
37
+
38
+ _typeCmd={ 'page' => {'action' => "type(#{to}, #{_f})"} }
39
+ # _typeCmd['page']['action']="type(#{to}, #{_f}"
40
+ _c = Scoutui::Commands::Type.new(_typeCmd, @drv)
41
+ _c.run(driver: @drv)
42
+
43
+ # puts __FILE__ + (__LINE__).to_s + " Uploaded - pause"; STDIN.gets;
44
+
45
+ _typeCmd={ 'page' => {'action' => "click(#{submit})"} }
46
+ _c = Scoutui::Commands::ClickObject.new(_typeCmd)
47
+ _c.run(driver: @drv, dut: nil)
48
+
49
+
50
+ Scoutui::Base::VisualTestFramework::processAsserts(@drv, waitList, false)
51
+
52
+ _typeCmd={ 'page' => {'action' => "click(#{close})"} }
53
+ _c = Scoutui::Commands::ClickObject.new(_typeCmd)
54
+ _c.run(driver: @drv, dut: nil)
55
+ puts "++ CLOSED DLG **"; # STDIN.gets
56
+ end
57
+
58
+
59
+
60
+ end
61
+
62
+
63
+
64
+ setResult(rc)
65
+
66
+ end
67
+
68
+
69
+
70
+
71
+
72
+ end
73
+
74
+
75
+ end
@@ -15,6 +15,7 @@ module Scoutui::Commands
15
15
  def initialize
16
16
  @command_list=['pause',
17
17
  'assignvar',
18
+ 'assignments',
18
19
  'existsAlert',
19
20
  'clickJsAlert',
20
21
  'fillform',
@@ -23,10 +24,12 @@ module Scoutui::Commands
23
24
  'submitform',
24
25
  'type',
25
26
  'click',
27
+ 'loadrequirements',
26
28
  'mouseover',
27
29
  'navigate',
28
30
  'select',
29
31
  'select_window',
32
+ 'uploadfiles',
30
33
  'verifyelt',
31
34
  'verifyelement',
32
35
  'verifyform']
@@ -132,7 +135,7 @@ module Scoutui::Commands
132
135
  end
133
136
  end
134
137
 
135
- puts __FILE__ + (__LINE__).to_s + " Text to type : #{_text_to_type}"
138
+ puts __FILE__ + (__LINE__).to_s + " expandMacro : #{_text_to_type}"
136
139
 
137
140
  _text_to_type.to_s
138
141
 
@@ -212,6 +215,9 @@ module Scoutui::Commands
212
215
  @timeout.to_i
213
216
  end
214
217
 
218
+ def isAssignments?(_action)
219
+ !_action.match(/^\s*(assignments)\s*$/).nil?
220
+ end
215
221
 
216
222
  def isAssignVar?(_action)
217
223
  !_action.match(/assign\(([\w]+)\s*\,(.*)\)\s*$/i).nil?
@@ -250,6 +256,10 @@ module Scoutui::Commands
250
256
  !_action.match(/fillform\(/i).nil?
251
257
  end
252
258
 
259
+ def isLoadRequirements?(_action)
260
+ !_action.match(/^\s*loadrequirements\s*$/i).nil?
261
+ end
262
+
253
263
  def isMouseOver?(_action)
254
264
  !_action.match(/mouseover\(/).nil?
255
265
  end
@@ -274,6 +284,10 @@ module Scoutui::Commands
274
284
  !_action.nil? && _action.match(/^\s*select\s*\(/i)
275
285
  end
276
286
 
287
+ def isUploadFiles?(_action)
288
+ !_action.nil? && _action.match(/^\s*uploadfiles\s*$/i)
289
+ end
290
+
277
291
  def isNavigate?(_action)
278
292
  !_action.nil? && _action.match(/(navigate|url)\(/i)
279
293
  end
@@ -286,6 +300,8 @@ module Scoutui::Commands
286
300
  @totalCommands['pause']+=1
287
301
  elsif isAssignVar?(cmd)
288
302
  @totalCommands['assignvar']+=1
303
+ elsif isAssignments?(cmd)
304
+ @totalCommands['assignments']+=1
289
305
  elsif isExistsAlert?(cmd)
290
306
  @totalCommands['existsAlert']+=1
291
307
  elsif isFrame?(cmd)
@@ -308,12 +324,16 @@ module Scoutui::Commands
308
324
  @totalCommands['click']+=1
309
325
  elsif isMouseOver?(cmd)
310
326
  @totalCommands['mouseover']+=1
327
+ elsif isLoadRequirements?(cmd)
328
+ @totalCommands['loadrequirements']+=1
311
329
  elsif isSelect?(cmd)
312
330
  @totalCommands['select']+=1
313
331
  elsif isNavigate?(cmd)
314
332
  @totalCommands['navigate']+=1
315
333
  elsif isSelectWindow?(cmd)
316
334
  @totalCommands['select_window']+=1
335
+ elsif isUploadFiles?(cmd)
336
+ @totalCommands['uploadfiles']+=1
317
337
  else
318
338
  rc=false
319
339
  end
@@ -1,3 +1,3 @@
1
1
  module Scoutui
2
- VERSION = "2.0.3.31.pre"
2
+ VERSION = "2.0.3.32.pre"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scoutui
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3.31.pre
4
+ version: 2.0.3.32.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Kim
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-28 00:00:00.000000000 Z
11
+ date: 2016-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -237,6 +237,7 @@ files:
237
237
  - lib/scoutui/base/q_applitools.rb
238
238
  - lib/scoutui/base/q_browser.rb
239
239
  - lib/scoutui/base/q_form.rb
240
+ - lib/scoutui/base/requirements.rb
240
241
  - lib/scoutui/base/test_scout.rb
241
242
  - lib/scoutui/base/test_settings.rb
242
243
  - lib/scoutui/base/user_vars.rb
@@ -249,6 +250,7 @@ files:
249
250
  - lib/scoutui/commands/fill_form.rb
250
251
  - lib/scoutui/commands/highlight.rb
251
252
  - lib/scoutui/commands/jsalert/action_jsalert.rb
253
+ - lib/scoutui/commands/load_requirements.rb
252
254
  - lib/scoutui/commands/mouse_over.rb
253
255
  - lib/scoutui/commands/pause.rb
254
256
  - lib/scoutui/commands/select_object.rb
@@ -258,6 +260,7 @@ files:
258
260
  - lib/scoutui/commands/switch_frame.rb
259
261
  - lib/scoutui/commands/type.rb
260
262
  - lib/scoutui/commands/update_url.rb
263
+ - lib/scoutui/commands/upload_files.rb
261
264
  - lib/scoutui/commands/utils.rb
262
265
  - lib/scoutui/commands/verify_element.rb
263
266
  - lib/scoutui/commands/verify_form.rb