scoutui 2.0.3.39.pre → 2.0.3.40.pre

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
2
  SHA1:
3
- metadata.gz: 70659ad4a781a8562a58c296d27846c8de09f62f
4
- data.tar.gz: c868a849e7d2051695c51995bd3e7039db7a897c
3
+ metadata.gz: cde554dc3abdd091326a306b8081d0238f7600d1
4
+ data.tar.gz: 79992a934285ab8ff26402cfb38aeeaa73ceaede
5
5
  SHA512:
6
- metadata.gz: acaf7c63f6c423d3425f014c31190ceedc60f0238a3733c1f7c45bb8f2f9d3a856b3ca3e818333d68167c9958685037aacef15f15c04ce5e0559d6c51ecad1e7
7
- data.tar.gz: 68e3b810a1249bdaccc62c3f87232a9949db9b35076db61cc92640400454ded772f5fe447ccd57d71086359409806558cdcbe4a8172fb6c5aa75317e8f3f031f
6
+ metadata.gz: 05b7fef396b7022b454558852f425bb0d5cef219c51682bbd9ba2cf5bc8d1f23e1bce30d762e179d3c8f6e09227cb99c9bf6929857c4003b0b2290fb509d6571
7
+ data.tar.gz: 1be89b9263aa403af4febb2e91a99b292ffa892dfd95e0f69a71e761d1db6878f6c93f075880809be2c8631a9786bfd3deb4e092edc2d6d620ac56fcbc6de147
@@ -0,0 +1,30 @@
1
+ require_relative '../../lib/scoutui'
2
+
3
+ COLORS = [ RED = 0, YELLOW = 1, GREEN = 3]
4
+
5
+
6
+ COLORS.each do |x|
7
+ puts x
8
+ end
9
+
10
+
11
+
12
+ puts "RED : #{COLORS[RED]}"
13
+
14
+ Scoutui::Logger::LogMgr.instance.setLevel('debug')
15
+ Scoutui::Logger::LogMgr.instance.debug "DEBUG - Hello"
16
+
17
+ Scoutui::Logger::LogMgr.instance.setLevel('info')
18
+ Scoutui::Logger::LogMgr.instance.info "INFO - Hello"
19
+
20
+ Scoutui::Logger::LogMgr.instance.setLevel('warn')
21
+ Scoutui::Logger::LogMgr.instance.warn "WARN - Hello"
22
+
23
+ Scoutui::Logger::LogMgr.instance.setLevel('error')
24
+ Scoutui::Logger::LogMgr.instance.error "ERROR - Hello"
25
+ Scoutui::Logger::LogMgr.instance.fatal "FATAL - SHOULD SEE THIS"
26
+
27
+
28
+ Scoutui::Logger::LogMgr.instance.setLevel('fatal')
29
+ Scoutui::Logger::LogMgr.instance.fatal "FATAL - Hello"
30
+ Scoutui::Logger::LogMgr.instance.error "ERROR - SHOULD NOT SEE THIS"
@@ -67,7 +67,7 @@ ruby $SCOUTUI_BIN \
67
67
  --sauce:resolution "1280x1024" \
68
68
  --host ${HOST} \
69
69
  --failfast true \
70
- --debug \
70
+ --loglevel warn \
71
71
  --dut "${CMD}"
72
72
 
73
73
  }
@@ -181,7 +181,146 @@ module Scoutui::ApplicationModel
181
181
  result
182
182
  end
183
183
 
184
+ def flattenPageObject(h, path="")
185
+ rc=iterate(h, path)
186
+ if rc.is_a?(Array)
187
+ return rc[0]
188
+ end
189
+
190
+ nil
191
+ end
192
+
193
+ def iterate(h, path="")
194
+ rc=true
195
+ assertions=[]
196
+
197
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ===== iterate(#{h}, #{path}) ====="
198
+
199
+ if h.is_a?(String)
200
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " => process #{h}"
201
+ if h.match(/^\s*(page)\s*\(.*\)\s*$/i)
202
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " => process Page #{h}"
203
+ page_elt = getPageElement(h)
204
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " => #{page_elt}"
205
+ assertions << iterate(page_elt, path)
206
+ else
207
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " UNKNOWN: #{h}"
208
+ assertions << "#{h} : unknown"
209
+ end
210
+
211
+ elsif h.is_a?(Hash) && h.has_key?('locator')
212
+
213
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " == add #{h} =="
214
+ assertions << { :path => path, :data => h }
215
+
216
+ elsif h.is_a?(Hash)
217
+
218
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "Keys.size: #{h.keys[0]}"
219
+
220
+ if h.keys.size==1 && h[h.keys[0]].is_a?(Hash) && h[h.keys[0]].has_key?('locator')
221
+
222
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " add assertion #{h}"
223
+ assertions << { :path => path, :data => h }
184
224
 
225
+ elsif h.keys.size==1 && h[h.keys[0]].is_a?(Hash)
226
+
227
+ # "id": {
228
+ # }
229
+
230
+ _id = h.keys[0]
231
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " LocatorID : #{_id}"
232
+
233
+ if true
234
+ h[_id].each_pair { |_k, _h|
235
+
236
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " | id(#{_id}) => #{_k}, #{_h}"
237
+
238
+ if _h.keys.size==1 && _h[_h.keys[0]].is_a?(Hash) && !_h[_h.keys[0]].has_key?('locator')
239
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " id(#{_id}) => #{_h}"
240
+ _a = iterate(_h, "#{path}.#{_id}")
241
+ _a.each do |_e|
242
+ assertions << _e
243
+ end
244
+ elsif _h.keys.size==1 && _h[_h.keys[0]].is_a?(Hash) && _h[_h.keys[0]].has_key?('locator')
245
+ assertions << { :path => "#{path}.#{_id}", :data => h[_h.keys[0]] }
246
+ elsif _h.is_a?(Hash) && _h.has_key?('locator')
247
+ assertions << { :path => "#{path}.#{_id}.#{_k}", :data => _h }
248
+ else
249
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " | id(#{path}.#{_id}.#{_k}) - #{_h}"
250
+
251
+ _h.each do |k, v|
252
+ # puts __FILE__ + (__LINE__).to_s + " processing #{_id}.#{k}, #{v}"
253
+ if v.is_a?(Hash) && v.has_key?('locator')
254
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " processing #{_id}.#{_k}.#{k}"
255
+ elsif v.is_a?(Hash) || v.is_a?(Array)
256
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " processing #{_id}.#{k} - #{v}"
257
+ _a = iterate(v, "#{path}.#{_id}.#{k}")
258
+ _a.each do |_e|
259
+ assertions << _e
260
+ end
261
+ else
262
+ Scoutui::Logger::LogMgr.instance.debug("Assert => k is #{k}, value is #{v}")
263
+ # assertions << "#{k} #{v}"
264
+ rc=rc && true
265
+ end
266
+ end
267
+
268
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " adding assertions id(#{_id}.#{_k}) - #{_h}"
269
+ assertions << "id(#{_id}.#{_k}) - #{_h}"
270
+ end
271
+
272
+ }
273
+ end
274
+
275
+
276
+
277
+ else
278
+
279
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ** process #{h} **"
280
+ _list=Array.new
281
+ h.each do |k, v|
282
+ if v.is_a?(Hash) && v.has_key?('locator')
283
+
284
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " add to assertion #{k} => #{v}"
285
+ _list.push({ :path => "#{path}.get(#{k})", :dat => v })
286
+
287
+ Scoutui::Logger::LogMgr.instance.debug " _list ==> #{_list}"
288
+ elsif v.is_a?(Hash) || v.is_a?(Array)
289
+
290
+ # login_form => {"userid"=>{"locator"=>"#userid"}, "password"=>{"locator"=>"#pass"}}
291
+
292
+
293
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " >>>> #{k} => #{v} <<<<<"
294
+
295
+
296
+ _a = iterate(v, "#{path}.get(#{k})")
297
+ _a.each do |_e|
298
+ assertions << _e
299
+ end
300
+ else
301
+ Scoutui::Logger::LogMgr.instance.debug(__FILE__ + (__LINE__).to_s + " k is #{k}, value is #{v}")
302
+ assertions << "#{k} #{v}"
303
+ end
304
+ end
305
+
306
+ # assertions << _list.flatten
307
+ if !_list.empty?
308
+ _list.each do |_e|
309
+ assertions << _e
310
+ end
311
+ end
312
+
313
+ end
314
+
315
+ else
316
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Huh?"
317
+ assertions << nil
318
+ end
319
+
320
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " assertions => #{assertions}"
321
+ assertions
322
+
323
+ end
185
324
 
186
325
  end
187
326
 
@@ -331,9 +331,14 @@ module Scoutui::Base
331
331
 
332
332
  ##
333
333
  # Object must exist and be enabled to 'pass' assertion.
334
- elsif _obj.is_a?(Selenium::WebDriver::Element) && _t.has_key?('cmd') && !_t['cmd'].empty? && _t['cmd'].match(/[!]*isEnabled/i)
334
+ elsif _t.has_key?('cmd') && !_t['cmd'].empty? && _t['cmd'].match(/[!]*isEnabled/i)
335
335
 
336
- _enabled = _obj.enabled?
336
+ if !_obj.is_a?(Selenium::WebDriver::Element)
337
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{_execute_when} => element not found"
338
+ return false
339
+ end
340
+
341
+ _enabled = _obj.enabled? && (_obj.attribute("disabled").nil? && _obj.attribute("readonly").nil? )
337
342
 
338
343
  puts __FILE__ + (__LINE__).to_s + " _obj.enabled? => #{_enabled}"
339
344
 
@@ -436,12 +441,19 @@ module Scoutui::Base
436
441
  _locator = _t['locator']
437
442
  _locator = Scoutui::Base::UserVars.instance.normalize(_locator)
438
443
 
444
+
445
+ _locator = Scoutui::Base::UserVars.instance.get(_locator)
446
+
439
447
  if _t.has_key?('frame') && !_t['frame'].nil?
440
448
  Scoutui::Commands::Utils.instance.setEnableFrameSearch(_t['frame'])
441
449
  end
442
450
 
443
451
  elsif isVisibleCmd?(_execute_when)
444
452
  _locator = _execute_when.match(/^\s*[!]*visible\((.*)\)\s*$/i)[1].to_s
453
+
454
+
455
+ _locator = Scoutui::Base::UserVars.instance.normalize(_locator)
456
+ _locator = Scoutui::Base::UserVars.instance.get(_locator)
445
457
  else
446
458
  Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " invalid visible cmd: #{_execute_when}"
447
459
  end
@@ -718,9 +730,9 @@ module Scoutui::Base
718
730
  end
719
731
 
720
732
 
721
- def isEnabled(my_driver, page_elt, _req=nil, _immediate=false)
722
- Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isEanbled(#{page_elt}"
723
- end
733
+ # def isEnabled(my_driver, page_elt, _req=nil, _immediate=false)
734
+ # Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isEanbled(#{page_elt}"
735
+ # end
724
736
 
725
737
 
726
738
 
@@ -948,8 +948,10 @@ module Scoutui::Base
948
948
 
949
949
  elsif Scoutui::Base::Assertions.instance.isEnabledCmd?(_a)
950
950
  if !Scoutui::Base::Assertions.instance.isEnabled?(my_driver, _a)
951
- Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isEnabled #{_e} : failed"
951
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isEnabled #{_a} : failed"
952
952
  _executeIt=false
953
+ else
954
+ puts __FILE__ + (__LINE__).to_s + " IS_ENABLED : #{_a}"; STDIN.gets()
953
955
  end
954
956
 
955
957
 
@@ -197,7 +197,7 @@ module Scoutui::Commands
197
197
  elsif Scoutui::Commands::Utils.instance.isType?(_action)
198
198
  _cmd='Type'
199
199
  _c = Scoutui::Commands::Type.new(_action)
200
- _c.run(driver: my_driver)
200
+ _c.run(driver: my_driver, dut: e)
201
201
  else
202
202
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Unknown command : #{_action}"
203
203
  rc=false
@@ -49,7 +49,7 @@ module Scoutui::Commands
49
49
  end
50
50
 
51
51
 
52
- def execute(drv=nil, _notUsed=nil)
52
+ def execute(drv=nil, pageElt=nil)
53
53
  @drv=drv if !drv.nil?
54
54
 
55
55
  _isKb=false
@@ -69,8 +69,16 @@ module Scoutui::Commands
69
69
  _rc=true
70
70
  _isKb=true
71
71
  else
72
- _xpath = @cmd.match(/^\s*type[\!]*\(([^,]*),\s*/)[1].to_s
73
- _val = @cmd.match(/^\s*type[\!]*\([^,]*,\s*(.*)\)/)[1].to_s
72
+ # _xpath = @cmd.match(/^\s*type[\!]*\(([^,]*),\s*/)[1].to_s
73
+ # _val = @cmd.match(/^\s*type[\!]*\([^,]*,\s*(.*)\)/)[1].to_s
74
+
75
+ if @cmd.match(/^\s*type[\!]*\((.*),\s*'(.*)\s*'\)\s*$/)
76
+ _xpath = @cmd.match(/^\s*type[\!]*\((.*),\s*'(.*)\s*'\)\s*$/)[1]
77
+ _val = @cmd.match(/^\s*type[\!]*\((.*),\s*'(.*)\s*'\)\s*$/)[2]
78
+ else
79
+ _xpath = @cmd.match(/^\s*type[\!]*\((.*),\s*(.*)\s*\)\s*$/)[1]
80
+ _val = @cmd.match(/^\s*type[\!]*\((.*),\s*(.*)\s*\)\s*$/)[2]
81
+ end
74
82
 
75
83
  Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + "Process TYPE #{_val} into #{_xpath}"
76
84
 
@@ -147,6 +155,27 @@ module Scoutui::Commands
147
155
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Text to type : #{_text_to_type}"
148
156
  obj.send_keys(_text_to_type)
149
157
 
158
+ if !pageElt.nil? && pageElt['page'].has_key?('then')
159
+ pageElt['page']['then'].each do |_subcmd|
160
+ if _subcmd.is_a?(String)
161
+
162
+
163
+ puts __FILE__ + (__LINE__).to_s + " | then => #{_subcmd}"
164
+
165
+ if _subcmd.match(/^\s*press\(__TAB__\)$/)
166
+ @drv.action.send_keys(:tab).perform
167
+ elsif _subcmd.match(/^\s*press\(__DOWN__\)$/)
168
+ @drv.action.send_keys(:arrow_down).perform
169
+ elsif _subcmd.match(/^\s*press\(__UP__\)$/)
170
+ @drv.action.send_keys(:arrow_up).perform
171
+ elsif _subcmd.match(/^\s*press\(__ENTER__\)\s*$/)
172
+ @drv.action.send_keys(:enter).perform
173
+ end
174
+
175
+ end
176
+ end
177
+ end
178
+
150
179
  if !obj.nil? && false
151
180
  arr=_text_to_type.split(/__ENTER__/)
152
181
 
@@ -55,7 +55,7 @@ module Scoutui::Eyes
55
55
  end
56
56
 
57
57
  def download_diffs(results, view_key, destination)
58
- Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " download_diffs(#{destination}"
58
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " download_diffs(#{results}, #{destination})"
59
59
  session_id = get_session_id(results.url)
60
60
  batch_id = get_batch_id(results.url)
61
61
  diff_urls = get_diff_urls(batch_id, session_id, view_key)
@@ -1,23 +1,23 @@
1
-
2
-
3
1
  require 'singleton'
4
2
  require 'logging'
5
3
 
6
4
  module Scoutui::Logger
7
5
 
8
-
9
-
10
6
  class LogMgr
11
7
  include Singleton
12
8
 
9
+ LOGLEVELS = [ DEBUG = 0, INFO = 1, WARN = 2, ERROR = 3, FATAL = 4]
10
+
13
11
  attr_accessor :root
14
12
  attr_accessor :commands
15
13
  attr_accessor :benchmarks
14
+ attr_accessor :level
16
15
 
17
16
  def initialize
18
17
 
19
18
  @root = Logging.logger(STDOUT)
20
19
  @root.level = :debug
20
+ @level = LOGLEVELS[DEBUG]
21
21
 
22
22
  Logging.appenders.stderr('Standard Error', :level => :error)
23
23
 
@@ -65,6 +65,20 @@ module Scoutui::Logger
65
65
 
66
66
  def setLevel(_level)
67
67
  @root.level = _level.to_sym
68
+
69
+ _l = _level.to_s
70
+ if _l.match(/debug/i)
71
+ @level = LOGLEVELS[DEBUG]
72
+ elsif _l.match(/info/i)
73
+ @level = LOGLEVELS[INFO]
74
+ elsif _l.match(/warn/i)
75
+ @level = LOGLEVELS[WARN]
76
+ elsif _l.match(/error/i)
77
+ @level = LOGLEVELS[ERROR]
78
+ elsif _l.match(/fatal/i)
79
+ @level = LOGLEVELS[FATAL]
80
+ end
81
+
68
82
  end
69
83
 
70
84
  def warn(txt)
@@ -102,16 +116,16 @@ module Scoutui::Logger
102
116
 
103
117
  def log(level, txt)
104
118
 
105
- if level.match(/info/i)
106
- @root.info txt
119
+ if level.match(/debug/i)
120
+ @root.debug txt if DEBUG >= @level
121
+ elsif level.match(/info/i)
122
+ @root.info txt if INFO >= @level
107
123
  elsif level.match(/warn/i)
108
- @root.warn txt
109
- elsif level.match(/debug/i)
110
- @root.debug txt
124
+ @root.warn txt if WARN >= @level
111
125
  elsif level.match(/error/i)
112
- @root.error txt
126
+ @root.error txt if ERROR >= @level
113
127
  elsif level.match(/fatal/i)
114
- @root.fatal txt
128
+ @root.fatal txt if FATAL >= @level
115
129
  end
116
130
 
117
131
  end
@@ -1,3 +1,3 @@
1
1
  module Scoutui
2
- VERSION = "2.0.3.39.pre"
2
+ VERSION = "2.0.3.40.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.39.pre
4
+ version: 2.0.3.40.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-08-10 00:00:00.000000000 Z
11
+ date: 2016-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -224,6 +224,7 @@ files:
224
224
  - examples/data_driven/data/queries.yml
225
225
  - examples/data_driven/data/requirements.yml
226
226
  - examples/db/sqlclient.rb
227
+ - examples/enums/my_enum.rb
227
228
  - examples/ex1/commands.holidays.yml
228
229
  - examples/ex1/commands.yml
229
230
  - examples/ex1/test-example.sh