scoutui 2.0.3.51.pre → 2.0.3.52.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: 6c5cc805fe6fbfbc8493fbba16daf30ce96ed97a
4
- data.tar.gz: 6713d51d7c4dda1a06c7ed3da8be5ab87d08eee2
3
+ metadata.gz: fa5ebb44b58d0fd1eb73d96c9a2b522833c4accc
4
+ data.tar.gz: fa634ef22871fd4bc3968945ea234d32d8798462
5
5
  SHA512:
6
- metadata.gz: 9c185fb0012d0fa6176d1112f58a41cbccadc92535803a74bf57cae78aa267656baaaf158e2165d4d574e2652ce60c5a57c88db3d9466849839663f74d70bb8a
7
- data.tar.gz: 47cf0a7f0360242c67f9dadb5c36c671e4e530831f08335021356b0c14411c3a68d5ffe126f7ad18a833e664d50d008a54cf513c333fd0169ac0e8551363a648
6
+ metadata.gz: bf786bed73a483ef5d89eb9718772571cbd742d89a17c711274510092412d6763174a53d85ab91392b553bbba61e9ad89da6b992e546494e10887d00476e2ecd
7
+ data.tar.gz: 9ee8d83cc685f41229d71256a6b0fc0bad3a1634d749fe80db12bbc4271f2ad046bebd97ec7974065c8ca6d9a4d7459cbaedf62502b098a057f5ea88e8d28570
data/README.md CHANGED
@@ -59,6 +59,13 @@ To run unit tests:
59
59
  To run a specific unit test:
60
60
 
61
61
  $ rspec spec/json_spec.rb
62
+
63
+ To build:
64
+
65
+ $ bundle exec rake build
66
+
67
+ To push the build (gem)
68
+ $ gem push <gem file>
62
69
 
63
70
  ## Running the examples
64
71
 
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+
3
+ ToWhom=$1
4
+
5
+ echo "HELLO ${ToWhom}" > /tmp/sayhello.out
@@ -0,0 +1,22 @@
1
+ page:
2
+ name: Assign my vars
3
+ action: assignments
4
+ vars:
5
+ - assign(MyEntity, ScoutUI)
6
+ ---
7
+ page:
8
+ name: Simple Cmd
9
+ id: MultiLs
10
+ action: defineCommand
11
+ commands: sed -e 's/domain/${MyEntity}/g' /tmp/userlist-v2.txt > /tmp/mydata.txt
12
+ ---
13
+ page:
14
+ name: Run Multi
15
+ action: executeCommands
16
+ commands:
17
+ - id: MultiLs
18
+ ---
19
+ page:
20
+ name: Pause afger MultiLs
21
+ action: pause
22
+ skip: false
@@ -17,11 +17,47 @@ module Scoutui::Base
17
17
  { :cmd => 'isSelected', :pattern => '^\s*[!]*isSelected\((.*)\)\s*$', :parse => lambda { |_a| _parseFrameLoc('isSelected', _a) } },
18
18
  { :cmd => 'isText', :pattern => '^\s*[!]*(isText)\s*\(.*\)\s*\=\s*(.*)\s*$', :parse => lambda { |_a| _parseWith('isText', _a) } },
19
19
  { :cmd => 'isValue', :pattern => '^\s*[!]*(isValue)\s*\(.*\)\s*\=\s*(.*)\s*$', :parse => lambda { |_a| _parseWith('isValue', _a) } },
20
- { :cmd => 'visible', :pattern => '^\s*[!]*visible\((.*)\)\s*$', :parse => nil }
20
+ { :cmd => 'visible', :pattern => '^\s*[!]*visible\((.*)\)\s*$', :parse => nil },
21
+ { :cmd => 'url', :pattern => '^\s*url\((.*)\)\s*$', :parse => lambda { |_a| _parseWith('url', _a) } },
22
+ { :cmd => 'compare', :pattern => '/^\s*(\$\{.*\})\s*(==|!=)(.*)$', :parse => nil }
21
23
  ]
22
24
 
23
25
  end
24
26
 
27
+ def compareValue(_a)
28
+ _match = _a.match(/^\s*(\$\{.*\})\s*(==|!=)(.*)$/)
29
+ _var = _match[1]
30
+ _cond = _match[2]
31
+ _val = _match[3]
32
+
33
+ _rc=false
34
+
35
+ _uservar_val = Scoutui::Base::UserVars.instance.getVar(_var)
36
+ _uservar_val = Scoutui::Base::UserVars.instance.get(_var) if _uservar_val.nil?
37
+
38
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " execute_when.condition => #{_uservar_val} equals #{_val}"
39
+
40
+ if _cond=='=='
41
+ _rc=(_uservar_val.match(/#{_val}/) || _uservar_val==_val)
42
+ else
43
+ _rc=(!_uservar_val.match(/#{_val}/) || _uservar_val!=_val)
44
+ end
45
+
46
+ _rc
47
+ end
48
+
49
+ def isUrlMatch(my_driver, _a)
50
+ current_url = my_driver.current_url.to_s
51
+ expected_url = _a.match(/^\s*(url)\s*\((.*)\)/)[2].to_s
52
+
53
+ expected_regex = Regexp.new(Scoutui::Base::UserVars.instance.normalize(expected_url))
54
+ rc=!current_url.match(expected_regex).nil?
55
+
56
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " verify current url #{current_url} matches #{rc}"
57
+
58
+ return rc
59
+ end
60
+
25
61
 
26
62
  def isValidAssertType(_a)
27
63
 
@@ -629,7 +665,7 @@ module Scoutui::Base
629
665
 
630
666
  if _v.is_a?(String)
631
667
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{_v} is a string - next"
632
- Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_S + " TBD" # Pause", gets
668
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " TBD" # Pause", gets
633
669
  next
634
670
  end
635
671
 
@@ -1148,7 +1184,12 @@ module Scoutui::Base
1148
1184
 
1149
1185
  condition = page_elt['visible_when'].match(/(visible)\((.*)\)/)[1].to_s
1150
1186
  tmpObj = page_elt['visible_when'].match(/(visible)\((.*)\)/)[2].to_s
1151
- expectedVal = page_elt['visible_when'].match(/(visible)\s*\(.*\)\s*\=\s*(.*)/)[2].to_s
1187
+
1188
+ if page_elt['visible_when'].match(/^\s*(visible)\s*\(.*\)\s*$/)
1189
+ expectedVal='true'
1190
+ else
1191
+ expectedVal = page_elt['visible_when'].match(/(visible)\s*\(.*\)\s*\=\s*(.*)/)[2].to_s
1192
+ end
1152
1193
 
1153
1194
  _locator = Scoutui::Base::UserVars.instance.get(tmpObj)
1154
1195
  depObj = Scoutui::Base::QBrowser.getObject(my_driver, _locator, Scoutui::Commands::Utils.instance.getTimeout)
@@ -144,7 +144,10 @@ module Scoutui::Base
144
144
 
145
145
  end
146
146
 
147
- if Scoutui::Base::Assertions.instance.visible_when_always(_k, _v, _obj, _req)
147
+
148
+ if Scoutui::Base::Assertions.instance.visible_when_visible(_k, _v, _obj, my_driver, _req)
149
+ next
150
+ elsif Scoutui::Base::Assertions.instance.visible_when_always(_k, _v, _obj, _req)
148
151
  next
149
152
  elsif Scoutui::Base::Assertions.instance.visible_when_never(_k, _v, _obj, _req)
150
153
  next
@@ -354,7 +357,7 @@ module Scoutui::Base
354
357
  # recsult=processAsserts(my_driver, e[STEP_KEY]["asserts"])
355
358
  def self.processAsserts(my_driver, _execute_when, _enableAsserts=true)
356
359
 
357
- Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " processAsserts#{_execute_when}"
360
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " processAsserts(#{_execute_when}, #{_enableAsserts})"
358
361
 
359
362
  result=true
360
363
 
@@ -366,7 +369,6 @@ module Scoutui::Base
366
369
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " assert: => #{_a}"
367
370
 
368
371
  _rc=nil
369
-
370
372
  _bm=nil
371
373
 
372
374
  _assertType=Scoutui::Base::Assertions.instance.isValidAssertType(_a)
@@ -401,6 +403,10 @@ module Scoutui::Base
401
403
  _bm=Benchmark.measure {
402
404
  _rc=Scoutui::Base::Assertions.instance.isEnabled?(my_driver, _a)
403
405
  }
406
+ elsif _assertType[:cmd]=='url'
407
+ _bm=Benchmark.measure {
408
+ _rc=Scoutui::Base::Assertions.instance.isUrlMatch(my_driver, _a)
409
+ }
404
410
  end
405
411
 
406
412
  elsif Scoutui::Base::Assertions.instance.isRoleCmd?(_a)
@@ -445,7 +451,7 @@ module Scoutui::Base
445
451
  _obj = processPageElement(my_driver, nil, _a)
446
452
 
447
453
  # 5150
448
- puts __FILE__ + (__LINE__).to_s + " *** WHAT type of assertion => #{_obj}"; STDIN.gets
454
+ #puts __FILE__ + (__LINE__).to_s + " *** WHAT type of assertion => #{_obj}"; STDIN.gets
449
455
 
450
456
  elsif !_a.match(/^\s*accessibility\s*$/).nil?
451
457
  puts __FILE__ + (__LINE__).to_s + " *** Accessibility ***"
@@ -1023,8 +1029,14 @@ module Scoutui::Base
1023
1029
  _execute_when.each do |_a|
1024
1030
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " execute_when => #{_a.class} : #{_a}"
1025
1031
 
1032
+ _assertType=Scoutui::Base::Assertions.instance.isValidAssertType(_a)
1033
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " assertType : #{_assertType}"
1026
1034
 
1027
- if _a.to_s.match(/^\s*(\$\{.*\})\s*(==|!=)(.*)$/)
1035
+ if _assertType && _assertType[:cmd]=='url'
1036
+ _executeIt=Scoutui::Base::Assertions.instance.isUrlMatch(my_driver, _a)
1037
+ elsif _assertType && _assertType[:cmd]=='compare'
1038
+ _executeIt=Scoutui::Base::Assertions.instance.compareValue(_a)
1039
+ elsif _a.to_s.match(/^\s*(\$\{.*\})\s*(==|!=)(.*)$/)
1028
1040
 
1029
1041
  _match = _a.match(/^\s*(\$\{.*\})\s*(==|!=)(.*)$/)
1030
1042
  _var = _match[1]
@@ -1153,6 +1165,41 @@ module Scoutui::Base
1153
1165
  end
1154
1166
 
1155
1167
 
1168
+ # 5150
1169
+ if e[STEP_KEY].has_key?('executejs')
1170
+
1171
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ExecuteJS"
1172
+
1173
+ e[STEP_KEY]['executejs'].each_key do |k|
1174
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " => #{k}"
1175
+
1176
+
1177
+ # page:
1178
+ # name: LoadJS
1179
+ # action: loadjs
1180
+ # files:
1181
+ # - "../commands/general.js"
1182
+ _cmd='loadjs'
1183
+ _pg={"page" => { "action" => "loadjs", "files" => ["../commands/general.js"] } }
1184
+ _c = Scoutui::Commands::LoadJs.new(_pg)
1185
+ _c.run(driver: my_driver, dut: _pg)
1186
+
1187
+
1188
+ # page:
1189
+ # name: Run JS function
1190
+ # executejs:
1191
+ # updateLoginBackground:
1192
+ # - "//body"
1193
+ # - "signin signin-3 cnqr-theme-11"
1194
+
1195
+
1196
+
1197
+ end
1198
+
1199
+
1200
+ end
1201
+
1202
+
1156
1203
  if !isRun(e).nil?
1157
1204
 
1158
1205
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ========> RUN <================="
@@ -40,6 +40,152 @@ module Scoutui::Commands
40
40
  end
41
41
 
42
42
  def execute(drv, e=nil)
43
+
44
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " click_object.execute: #{@cmd}"
45
+ obj=nil
46
+
47
+ @drv=drv if !drv.nil?
48
+
49
+ bm=nil
50
+ all_windows = @drv.window_handles.size
51
+
52
+ _req = Scoutui::Utils::TestUtils.instance.getReq()
53
+
54
+ _locator = @cmd.match(/^\s*click\s*\((.*)\)\s*$/)[1].to_s.strip
55
+ Scoutui::Logger::LogMgr.instance.command.info __FILE__ + (__LINE__).to_s + " clickObject => #{_locator}"
56
+
57
+
58
+ # _locator = Scoutui::Base::UserVars.instance.get(_locator)
59
+ _locator = Scoutui::Base::UserVars.instance.normalize(_locator)
60
+
61
+ Scoutui::Logger::LogMgr.instance.command.info __FILE__ + (__LINE__).to_s + " | translate : #{_locator}" if Scoutui::Utils::TestUtils.instance.isDebug?
62
+
63
+ _clicked=false
64
+
65
+ _startTime=Time.now
66
+ _endTime=nil
67
+ _clickTime=0
68
+
69
+
70
+
71
+ begin
72
+
73
+ if _locator
74
+
75
+ (0..10).each do |_i|
76
+
77
+ _retry = true
78
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{_i} => click(#{_locator})"
79
+
80
+ begin
81
+
82
+ _startTime=Time.now
83
+
84
+ wait = Selenium::WebDriver::Wait.new(:timeout => 30)
85
+ isEnabled = wait.until {
86
+ obj=Scoutui::Base::QBrowser.getElement(@drv, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
87
+ obj.is_a?(Selenium::WebDriver::Element) && obj.enabled? && obj.displayed?
88
+ }
89
+
90
+ if isEnabled # && obj.is_a?(Selenium::WebDriver::Element)
91
+
92
+ @drv.action.move_to(obj).perform
93
+ bm=Benchmark.measure {
94
+ obj.click
95
+ }
96
+
97
+ _endTime=Time.now
98
+ _clickTime = (_endTime - _startTime)
99
+
100
+ setBenchmark(bm)
101
+ _retry = false
102
+ _clicked=true
103
+
104
+ if e.is_a?(Hash) && e.has_key?('page') && e['page'].has_key?('highlight') && e['page']['highlight']
105
+ #
106
+ # page:
107
+ # highlight: true
108
+ #
109
+ obj=Scoutui::Base::QBrowser.highlight(@drv, obj)
110
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " highlight then click : #{obj}"
111
+ end
112
+
113
+ end
114
+
115
+
116
+ rescue Selenium::WebDriver::Error::StaleElementReferenceError => ex
117
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Retry #{_i} - Selenium::WebDriver::Error::UnknownError"
118
+ puts __FILE__ + (__LINE__).to_s + ex.backtrace.join("\n\t")
119
+ _retry=true
120
+
121
+
122
+ rescue Selenium::WebDriver::Error::TimeOutError => ex
123
+ _retry=true
124
+
125
+ rescue Selenium::WebDriver::Error::UnknownError => ex
126
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Retry #{_i} - Selenium::WebDriver::Error::UnknownError"
127
+ puts __FILE__ + (__LINE__).to_s + ex.backtrace.join("\n\t")
128
+ _retry=true
129
+ end
130
+
131
+ break if !_retry
132
+
133
+ sleep(0.5)
134
+ end
135
+
136
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " clicked(#{_locator}): #{_clicked}"
137
+
138
+ page_elt = Scoutui::Utils::TestUtils.instance.getPageElement(_locator)
139
+
140
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " PageElement(#{_locator}) => #{page_elt}"
141
+
142
+ if all_windows > @drv.window_handles.size
143
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " WINDOW was CLOSED. Activate first window as our default";
144
+ @drv.switch_to.window @drv.window_handles.first
145
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Switched to first window"
146
+ end
147
+
148
+ _whenClicked(page_elt)
149
+
150
+ if e.is_a?(Hash) && e.has_key?('page') && e['page'].has_key?('then')
151
+ thenClause = Scoutui::Commands::ThenClause.new(@drv)
152
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " thenClause => #{thenClause.class}"
153
+ thenClause.execute(e)
154
+ end
155
+
156
+
157
+ # _then(e)
158
+
159
+ else
160
+ Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Unable to click object that is not displayed."
161
+ end
162
+
163
+
164
+
165
+ rescue => ex
166
+ Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " #{ex.class.to_s} : Error during processing: #{ex.message}"
167
+ Scoutui::Logger::LogMgr.instance.warn " Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
168
+ end
169
+
170
+
171
+ Scoutui::Logger::LogMgr.instance.asserts.info "Verify object to click exists #{_locator} : #{obj.class.to_s} - #{!obj.nil?.to_s}"
172
+ Scoutui::Logger::LogMgr.instance.asserts.info __FILE__ + (__LINE__).to_s + " Verify clicked #{_locator} - #{_clicked.to_s}"
173
+
174
+ Testmgr::TestReport.instance.getReq(_req).testcase('click').add(!obj.nil?, "Verify object to click exists #{_locator} : #{obj.class.to_s}")
175
+ Testmgr::TestReport.instance.getReq(_req).testcase('click').add(_clicked, "Verify clicked #{_locator}", _clickTime)
176
+
177
+
178
+ if !_clicked
179
+ puts __FILE__ + (__LINE__).to_s + " PAUSE ON FAILED CLICK"; STDIN.gets
180
+ end
181
+
182
+ setResult(_clicked)
183
+ end
184
+
185
+
186
+ def execute_bak(drv, e=nil)
187
+
188
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " click_object.execute: #{@cmd}"
43
189
  @drv=drv if !drv.nil?
44
190
 
45
191
  bm=nil
@@ -47,7 +193,7 @@ module Scoutui::Commands
47
193
 
48
194
  _req = Scoutui::Utils::TestUtils.instance.getReq()
49
195
 
50
- _locator = @cmd.match(/click\s*\((.*)\)/)[1].to_s.strip
196
+ _locator = @cmd.match(/^\s*click\s*\((.*)\)\s*$/)[1].to_s.strip
51
197
  Scoutui::Logger::LogMgr.instance.command.info __FILE__ + (__LINE__).to_s + " clickObject => #{_locator}"
52
198
 
53
199
 
@@ -79,6 +225,8 @@ module Scoutui::Commands
79
225
  isDisplayed = wait.until {
80
226
  true if obj.displayed?
81
227
  }
228
+ rescue Selenium::WebDriver::Error::StaleElementReferenceError => ex
229
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{ex.class}"
82
230
  rescue Selenium::WebDriver::Error::TimeOutError => ex
83
231
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Timeout waiting for display?: #{_locator}"
84
232
  end
@@ -86,7 +234,8 @@ module Scoutui::Commands
86
234
 
87
235
  if isDisplayed
88
236
 
89
- isEnabled = wait.until { obj.enabled? }
237
+ wait = Selenium::WebDriver::Wait.new(:timeout => 30)
238
+ isEnabled = wait.until { obj.displayed? && obj.enabled? }
90
239
 
91
240
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " obj is enabled : #{isEnabled}"
92
241
 
@@ -100,14 +249,19 @@ module Scoutui::Commands
100
249
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " highlight then click : #{obj}"
101
250
  end
102
251
 
103
- (0..5).each do |_i|
252
+ (0..10).each do |_i|
104
253
  _retry = true
105
254
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{_i} => click(#{obj})"
106
255
  begin
107
256
 
108
257
  _startTime=Time.now
109
258
 
110
- obj = Scoutui::Base::QBrowser.getElement(@drv, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
259
+ wait = Selenium::WebDriver::Wait.new(:timeout => 30)
260
+ isEnabled = wait.until {
261
+ obj=Scoutui::Base::QBrowser.getElement(@drv, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
262
+ obj.enabled? && obj.displayed?
263
+ }
264
+
111
265
  @drv.action.move_to(obj).perform
112
266
  bm=Benchmark.measure {
113
267
  obj.click
@@ -121,12 +275,21 @@ module Scoutui::Commands
121
275
  _clicked=true
122
276
 
123
277
 
124
- rescue Selenium::WebDriver::Error::UnknownError
278
+ rescue Selenium::WebDriver::Error::StaleElementReferenceError => ex
279
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Retry #{_i} - Selenium::WebDriver::Error::UnknownError"
280
+ puts __FILE__ + (__LINE__).to_s + ex.backtrace.join("\n\t")
281
+ _retry=true
282
+
283
+
284
+ rescue Selenium::WebDriver::Error::UnknownError => ex
125
285
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Retry #{_i} - Selenium::WebDriver::Error::UnknownError"
286
+ puts __FILE__ + (__LINE__).to_s + ex.backtrace.join("\n\t")
126
287
  _retry=true
127
288
  end
128
289
 
129
290
  break if !_retry
291
+
292
+ sleep(0.5)
130
293
  end
131
294
 
132
295
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " clicked(#{_locator}): #{_clicked}"
@@ -150,7 +313,7 @@ module Scoutui::Commands
150
313
  end
151
314
 
152
315
 
153
- # _then(e)
316
+ # _then(e)
154
317
 
155
318
  else
156
319
  Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Unable to click object that is not displayed."
@@ -171,9 +334,12 @@ module Scoutui::Commands
171
334
  Testmgr::TestReport.instance.getReq(_req).testcase('click').add(_clicked, "Verify clicked #{_locator}", _clickTime)
172
335
 
173
336
 
337
+ if !_clicked
338
+ Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " FAILED CLICK"
339
+ end
340
+
174
341
  setResult(_clicked)
175
342
  end
176
-
177
343
  end
178
344
 
179
345
 
@@ -76,6 +76,11 @@ module Scoutui::Commands
76
76
  _c = Scoutui::Commands::LoadData.new(e)
77
77
  _c.run(driver: my_driver, dut: e)
78
78
 
79
+ elsif Scoutui::Commands::Utils.instance.isLoadJs?(_action)
80
+ _cmd='loadjs'
81
+ _c = Scoutui::Commands::LoadJs.new(e)
82
+ _c.run(driver: my_driver, dut: e)
83
+
79
84
  elsif Scoutui::Commands::Utils.instance.isLoadRequirements?(_action)
80
85
  _cmd='loadrequirements'
81
86
  _c = Scoutui::Commands::LoadRequirements.new(e)
@@ -28,7 +28,10 @@ module Scoutui::Commands
28
28
  c=nil
29
29
 
30
30
  if e['page']['commands'].is_a?(String)
31
- c=CmdShellMgr::DSL.instance.cmd(:cmd => "command(#{e['page']['id'].to_s}, #{e['page']['commands'].to_s})")
31
+
32
+ _normCmd = Scoutui::Base::UserVars.instance.normalize(e['page']['commands'].to_s)
33
+
34
+ c=CmdShellMgr::DSL.instance.cmd(:cmd => "command(#{e['page']['id'].to_s}, #{_normCmd.to_s})")
32
35
  elsif e['page']['commands'].is_a?(Array)
33
36
 
34
37
  _cmd=""
@@ -24,7 +24,11 @@ module Scoutui::Commands
24
24
  c=nil
25
25
 
26
26
  if e['page']['commands'].is_a?(String)
27
- c=CmdShellMgr::DSL.instance.cmd(:cmd => "execute(#{e['page']['commands'].to_s})")
27
+
28
+ _cmd = Scoutui::Base::UserVars.instance.normalize(e['page']['commands'].to_s)
29
+
30
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " normalized(cmd) => #{_cmd}"
31
+ c=CmdShellMgr::DSL.instance.cmd(:cmd => "execute(#{_cmd})")
28
32
  elsif e['page']['commands'].is_a?(Array)
29
33
 
30
34
  e['page']['commands'].each do |_cmd|
@@ -32,7 +36,7 @@ module Scoutui::Commands
32
36
  if !_cmd.nil?
33
37
  _id = _cmd['id'].to_s
34
38
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " execute(#{_id})"
35
- c=CmdShellMgr::DSL.instance.cmd(:cmd => "execute(#{_id})")
39
+ c=CmdShellMgr::DSL.instance.cmd(:cmd => "execute(#{_id})", )
36
40
 
37
41
  if c.is_a?(CmdShellMgr::Command) && _cmd.has_key?('asserts')
38
42
  _cmd['asserts'].each do |_a|
@@ -0,0 +1,57 @@
1
+ require_relative './commands'
2
+
3
+ module Scoutui::Commands
4
+
5
+ class LoadJs < Command
6
+
7
+
8
+ def execute(drv, e=nil)
9
+ puts __FILE__ + (__LINE__).to_s + " LoadJs.execute(#{e})"
10
+ @drv=drv if !drv.nil?
11
+
12
+ rc=false
13
+ js=""
14
+
15
+ _req = Scoutui::Utils::TestUtils.instance.getReq()
16
+
17
+ begin
18
+
19
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " LoadJs()"
20
+
21
+ if e['page'].has_key?('files')
22
+
23
+ e['page']['files'].each do |_js|
24
+
25
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " => #{_js}"
26
+
27
+ f = File.open(_js, 'r')
28
+ js << f.read
29
+
30
+ end
31
+
32
+ end
33
+
34
+ rc=true
35
+
36
+ rescue => ex
37
+ Scoutui::Logger::LogMgr.instance.warn "Error during processing: #{ex}"
38
+ Scoutui::Logger::LogMgr.instance.warn "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
39
+ end
40
+
41
+ if rc
42
+ Scoutui::Logger::LogMgr.instance.asserts.info "Verify requirements command passed - #{rc}"
43
+ Testmgr::TestReport.instance.getReq(_req).testcase('click').add(rc, "Verify requirements command passed")
44
+ end
45
+
46
+ if rc
47
+ puts __FILE__ + (__LINE__).to_s + " JS => #{js}"
48
+ end
49
+
50
+ setResult(rc)
51
+ end
52
+
53
+ end
54
+
55
+
56
+
57
+ end
@@ -27,6 +27,7 @@ module Scoutui::Commands
27
27
  'loaddata',
28
28
  'connect',
29
29
  'loaddb',
30
+ 'loadjs',
30
31
  'executecommands',
31
32
  'definecommands',
32
33
  'loadrequirements',
@@ -287,6 +288,10 @@ module Scoutui::Commands
287
288
  !_action.match(/^\s*loaddata\s*$/i).nil?
288
289
  end
289
290
 
291
+ def isLoadJs?(_action)
292
+ !_action.match(/^\s*loadjs\s*$/i).nil?
293
+ end
294
+
290
295
 
291
296
  def isLoadRequirements?(_action)
292
297
  !_action.match(/^\s*loadrequirements\s*$/i).nil?
@@ -370,6 +375,8 @@ module Scoutui::Commands
370
375
  @totalCommands['loaddb']+=1
371
376
  elsif isLoadData?(cmd)
372
377
  @totalCommands['loaddata']+=1
378
+ elsif isLoadJs?(cmd)
379
+ @totalCommands['loadjs']+=1
373
380
  elsif isLoadRequirements?(cmd)
374
381
  @totalCommands['loadrequirements']+=1
375
382
  elsif isSelect?(cmd)
@@ -388,10 +388,19 @@ module Scoutui::Utils
388
388
  @options[:host].to_s
389
389
  end
390
390
 
391
+ def setHost(_h)
392
+ @options[:host]=_h
393
+ Scoutui::Base::UserVars.instance.set(:host, @options[:host].to_s)
394
+ end
395
+
391
396
  def getReporter()
392
397
  @options[:report]
393
398
  end
394
399
 
400
+ def setReporter(_r)
401
+ @options[:report]=_r
402
+ end
403
+
395
404
  def setDebug(b)
396
405
  @options[:debug]=b
397
406
  end
@@ -1,3 +1,3 @@
1
1
  module Scoutui
2
- VERSION = "2.0.3.51.pre"
2
+ VERSION = "2.0.3.52.pre"
3
3
  end
data/scoutui.gemspec CHANGED
@@ -35,5 +35,5 @@ Gem::Specification.new do |spec|
35
35
  spec.add_development_dependency "testmgr", ">= 0.3.2.pre"
36
36
  spec.add_development_dependency "tiny_tds"
37
37
  spec.add_development_dependency "DataMgr", ">= 0.1.1.1.pre"
38
- spec.add_development_dependency "CmdShellMgr", ">= 0.1.1.0.pre"
38
+ spec.add_development_dependency "CmdShellMgr", ">= 0.1.1.2.pre"
39
39
  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.51.pre
4
+ version: 2.0.3.52.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-10-10 00:00:00.000000000 Z
11
+ date: 2016-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -198,14 +198,14 @@ dependencies:
198
198
  requirements:
199
199
  - - ">="
200
200
  - !ruby/object:Gem::Version
201
- version: 0.1.1.0.pre
201
+ version: 0.1.1.2.pre
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - ">="
207
207
  - !ruby/object:Gem::Version
208
- version: 0.1.1.0.pre
208
+ version: 0.1.1.2.pre
209
209
  description: Leverage a fully functional e2e framework that's integrated with Applitool's
210
210
  Eyes and Sauce Labs!
211
211
  email:
@@ -234,6 +234,8 @@ files:
234
234
  - examples/carmax/tests/test-carmax.sh
235
235
  - examples/ci_reporter/ci_example.rb
236
236
  - examples/cmdshell/commands/cmd.yml
237
+ - examples/cmdshell/commands/hello.sh
238
+ - examples/cmdshell/commands/hello.yml
237
239
  - examples/converters/jsonupdate.rb
238
240
  - examples/converters/jsony.rb
239
241
  - examples/data_driven/data/queries.yml
@@ -308,6 +310,7 @@ files:
308
310
  - lib/scoutui/commands/jsalert/action_jsalert.rb
309
311
  - lib/scoutui/commands/load_data.rb
310
312
  - lib/scoutui/commands/load_db.rb
313
+ - lib/scoutui/commands/load_js.rb
311
314
  - lib/scoutui/commands/load_requirements.rb
312
315
  - lib/scoutui/commands/mouse_over.rb
313
316
  - lib/scoutui/commands/pause.rb