scoutui 2.0.3.42.pre → 2.0.3.43.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: 8ee09db76c41ef6b77f44a13642927e0ec73cd1b
4
- data.tar.gz: da58678fca9727811647d3cc8d49c8714fd0f7c1
3
+ metadata.gz: 6cf3942661d1fe07e101908d524e05f1c388897b
4
+ data.tar.gz: d774623387644c2afdced96ed5d0ebaa920f1d6d
5
5
  SHA512:
6
- metadata.gz: fbd59aefcd9addd80132f52bcb507f16f63c4fa5ca8720e97223b1578b219c1df4ac1c244e048d3792f56a5eea854e7c7de023bbedf40bca17b41ab9f56ec5fc
7
- data.tar.gz: 454e491830517d735ab26b5c2198d79017cf4dbcaf3c84cb645a050be682d2ae9a5a481ddb376278b602e190d038ca80a1f7b40ce24cdc2d9dc9f719688d2c36
6
+ metadata.gz: 7f39521a4b9e5ea566ada4a894a4258ed0fc762e77f090f69afe1fca3d350e1d6f8c284720f2cfe8fc0562133df844e2075109e0ac1476d71cbe1e88160fd758
7
+ data.tar.gz: 026c38f168d7826c1afd94f2f6d239b1daeff6d989e75a9cf73e81615d5c78c5acaf4d176f122a20f2d61a42b8967d88423319f45fb896c4f7778d506ef1fae9
@@ -316,6 +316,7 @@ module Scoutui::Base
316
316
  Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " invalid assertion cmd: #{_execute_when}"
317
317
  end
318
318
 
319
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " _obj : #{_obj}"
319
320
 
320
321
  if _obj.is_a?(Selenium::WebDriver::Element) && _t.has_key?('cmd') && !_t['cmd'].empty? && _t['cmd'].match(/[!]*isSelected/i)
321
322
 
@@ -333,12 +334,24 @@ module Scoutui::Base
333
334
  # Object must exist and be enabled to 'pass' assertion.
334
335
  elsif _t.has_key?('cmd') && !_t['cmd'].empty? && _t['cmd'].match(/[!]*isEnabled/i)
335
336
 
336
- if !_obj.is_a?(Selenium::WebDriver::Element)
337
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " process isEnabled(#{_obj})"
338
+
339
+ if !(_obj.is_a?(Selenium::WebDriver::Element))
337
340
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{_execute_when} => element not found"
338
341
  return false
342
+ else
343
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " check if Enabled"
339
344
  end
340
345
 
341
- _enabled = _obj.enabled? && (_obj.attribute("disabled").nil? && _obj.attribute("readonly").nil? )
346
+ # puts __FILE__ + (__LINE__).to_s + " disabled: #{_obj.attribute("disabled")}"
347
+ # puts __FILE__ + (__LINE__).to_s + " readonly: #{_obj.attribute("readonly")}"
348
+ # puts __FILE__ + (__LINE__).to_s + " foo: #{_obj.attribute("foo")} isNil?: #{_obj.attribute("foo").nil?}"
349
+ # puts __FILE__ + (__LINE__).to_s + " enabled: #{_obj.enabled?}"
350
+
351
+ # _enabled = _obj.enabled? && !(_obj.attribute("disabled") || _obj.attribute("readonly") )
352
+ # _enabled=false if _enabled.nil?
353
+
354
+ _enabled = Scoutui::Base::QBrowser.isEnabled?(_obj, my_driver, _locator)
342
355
 
343
356
  puts __FILE__ + (__LINE__).to_s + " _obj.enabled? => #{_enabled}"
344
357
 
@@ -256,24 +256,156 @@ module Scoutui::Base
256
256
  end
257
257
 
258
258
  def self.isStale?(_obj)
259
- rc=false
259
+ _noSuch=false
260
+ _isStale=false
261
+
262
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isStale?(#{_obj})"
260
263
 
261
264
  begin
262
265
 
263
266
  if _obj.is_a?(Selenium::WebDriver::Element)
264
267
  _obj.enabled?
268
+ _obj.tag_name
269
+ _obj.attribute('type')
270
+ else
271
+ puts __FILE__ + (__LINE__).to_s + " | isStale? => nil"
272
+ return nil
265
273
  end
266
274
 
267
275
  rescue Selenium::WebDriver::Error::NoSuchElementError
268
- rc=true
276
+ _noSuch=true
269
277
 
270
278
  rescue Selenium::WebDriver::Error::StaleElementReferenceError
271
- rc=true
279
+ _isStale=true
280
+
281
+ rescue => ex
282
+ Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " #{ex}"
283
+ puts ex.backtrace
272
284
  end
273
285
 
286
+ puts __FILE__ + (__LINE__).to_s + " | isStale?(#{_obj}) : nosuch=#{_noSuch}, stale=#{_isStale}"
287
+ return (_noSuch || _isStale)
288
+ end
289
+
290
+
291
+ def self.isEnabled?(_obj, my_driver=nil, _locator=nil)
292
+ rc=false
293
+
294
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isEnabled?(#{_obj})"
295
+
296
+ begin
297
+ if _obj.is_a?(Selenium::WebDriver::Element)
298
+
299
+ (0..2).each do |i|
300
+
301
+ _isStale = Scoutui::Base::QBrowser.isStale?(_obj)
302
+
303
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{i} => isStale?(#{_obj}, #{_locator}), isStale: #{_isStale}"
304
+
305
+
306
+
307
+ if _isStale && !_locator.nil?
308
+
309
+ wait = Selenium::WebDriver::Wait.new(:timeout => Scoutui::Commands::Utils.instance.getTimeout)
310
+ isDisplayed = wait.until {
311
+ if Scoutui::Base::QBrowser.isStale?(_obj)
312
+ puts __FILE__ + (__LINE__).to_s + " ** refetch #{_locator} **"
313
+ _obj=Scoutui::Base::QBrowser.findElement(my_driver, Scoutui::Base::UserVars.instance.normalize(_locator), Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
314
+ end
315
+ true if _obj.enabled?
316
+ }
317
+
318
+ end
319
+
320
+ puts __FILE__ + (__LINE__).to_s + " enabled => #{_obj.enabled?}"
321
+
322
+ if _obj.enabled?
323
+ _disabled=_obj.attribute("disabled")
324
+ _rdonly = _obj.attribute("readonly")
325
+
326
+ puts __FILE__ + (__LINE__).to_s + " disabled: #{_disabled} nil: #{_disabled.nil?}"
327
+ puts __FILE__ + (__LINE__).to_s + " readonly: #{_rdonly} nil: #{_rdonly.nil?}"
328
+ puts __FILE__ + (__LINE__).to_s + " enabled: #{_obj.enabled?}"
329
+
330
+ rc = _obj.enabled? && !(_obj.attribute("disabled") || _obj.attribute("readonly") )
331
+
332
+ rc = _obj.enabled? && (_disabled.nil? || !_disabled)
333
+ rc=false if rc.nil?
334
+ next
335
+ end
336
+ end
337
+
338
+ else
339
+ Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " isEnabled?(not Element)"
340
+ end
341
+
342
+ rescue => ex
343
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{ex}"
344
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + ex.backtrace
345
+ end
346
+
347
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isEnabled?(#{_obj}) : #{rc}"
274
348
  rc
275
349
  end
276
350
 
351
+ def self.getElement(drv, _locator, _frames, _timeout=nil)
352
+
353
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " getElement(#{_locator})"
354
+ _isntStale=true
355
+ obj = Scoutui::Base::QBrowser.findElement(drv,
356
+ _locator,
357
+ _frames,
358
+ _timeout)
359
+
360
+ puts __FILE__ + (__LINE__).to_s + " | locator: #{_locator}"
361
+ puts __FILE__ + (__LINE__).to_s + " | obj : #{obj}"
362
+ puts __FILE__ + (__LINE__).to_s + " | stale : " + Scoutui::Base::QBrowser.isStale?(obj).to_s
363
+
364
+ cnt=0
365
+ if obj.is_a?(Selenium::WebDriver::Element) && Scoutui::Base::QBrowser.isStale?(obj) && !_locator.nil?
366
+
367
+ _isntStale=false
368
+
369
+ (0..7).each do |i|
370
+
371
+ cnt+=1
372
+ begin
373
+ wait = Selenium::WebDriver::Wait.new(:timeout => Scoutui::Commands::Utils.instance.getTimeout)
374
+ _isntStale = wait.until {
375
+ _rc=Scoutui::Base::QBrowser.isStale?(obj)
376
+ puts __FILE__ + (__LINE__).to_s + " stale(#{_locator}) : #{_rc}"
377
+ if _rc
378
+ obj = Scoutui::Base::QBrowser.findElement(drv, _locator,
379
+ _frames,
380
+ _timeout)
381
+ end
382
+ !_rc
383
+ }
384
+ rescue Selenium::WebDriver::Error::TimeOutError
385
+ ;
386
+ end
387
+
388
+
389
+ puts __FILE__ + (__LINE__).to_s + " #{i} ==> stale(#{_locator}) : #{_isntStale}"
390
+
391
+ if !_isntStale
392
+ puts __FILE__ + (__LINE__).to_s + " #{i} => obj is STALE : #{_locator}"
393
+ obj = Scoutui::Base::QBrowser.findElement(drv, _locator,
394
+ _frames,
395
+ _timeout)
396
+ else
397
+ break
398
+ end
399
+
400
+ end
401
+
402
+
403
+ end
404
+
405
+ puts __FILE__ + (__LINE__).to_s + " getElement(#{_locator}) : #{obj}, cnt:#{cnt}, isntStale:#{_isntStale}"
406
+ obj
407
+ end
408
+
277
409
  def self.findElement(drv, _locator, _frames, _timeout=nil)
278
410
 
279
411
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " findElement(#{_locator}, #{Scoutui::Commands::Utils.instance.getFrameSearch})"
@@ -951,7 +951,7 @@ module Scoutui::Base
951
951
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isEnabled #{_a} : failed"
952
952
  _executeIt=false
953
953
  else
954
- puts __FILE__ + (__LINE__).to_s + " IS_ENABLED : #{_a}"; STDIN.gets()
954
+ puts __FILE__ + (__LINE__).to_s + " IS_ENABLED : #{_a}";
955
955
  end
956
956
 
957
957
 
@@ -4,6 +4,31 @@ module Scoutui::Commands
4
4
 
5
5
  class ClickObject < Command
6
6
 
7
+ def _then(pageElt)
8
+ return if pageElt.nil?
9
+
10
+ if !pageElt.nil? && pageElt['page'].has_key?('then')
11
+ pageElt['page']['then'].each do |_subcmd|
12
+ if _subcmd.is_a?(String)
13
+
14
+
15
+ puts __FILE__ + (__LINE__).to_s + " | then => #{_subcmd}"
16
+
17
+ if _subcmd.match(/^\s*press\(__TAB__\)$/)
18
+ @drv.action.send_keys(:tab).perform
19
+ elsif _subcmd.match(/^\s*press\(__DOWN__\)$/)
20
+ @drv.action.send_keys(:arrow_down).perform
21
+ elsif _subcmd.match(/^\s*press\(__UP__\)$/)
22
+ @drv.action.send_keys(:arrow_up).perform
23
+ elsif _subcmd.match(/^\s*press\(__ENTER__\)\s*$/)
24
+ @drv.action.send_keys(:enter).perform
25
+ end
26
+
27
+ end
28
+ end
29
+ end
30
+ end
31
+
7
32
  def _whenClicked(page_elt)
8
33
 
9
34
  return if page_elt.nil?
@@ -62,7 +87,25 @@ module Scoutui::Commands
62
87
 
63
88
  begin
64
89
 
65
- obj = Scoutui::Base::QBrowser.findElement(@drv, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
90
+ obj = Scoutui::Base::QBrowser.getElement(@drv, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
91
+
92
+ if false
93
+ obj = Scoutui::Base::QBrowser.findElement(@drv, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
94
+
95
+ if Scoutui::Base::QBrowser.isStale?(obj) && !_locator.nil?
96
+
97
+ wait = Selenium::WebDriver::Wait.new(:timeout => Scoutui::Commands::Utils.instance.getTimeout)
98
+ isDisplayed = wait.until {
99
+ if Scoutui::Base::QBrowser.isStale?(obj)
100
+ obj = Scoutui::Base::QBrowser.findElement(@drv, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
101
+ end
102
+ true if obj.enabled?
103
+ }
104
+
105
+ end
106
+ end
107
+
108
+
66
109
 
67
110
  if obj
68
111
 
@@ -96,12 +139,27 @@ module Scoutui::Commands
96
139
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " highlight then click : #{obj}"
97
140
  end
98
141
 
99
- @drv.action.move_to(obj).perform
142
+ (0..5).each do |_i|
143
+ _retry = true
144
+ puts __FILE__ + (__LINE__).to_s + " #{_i} => click(#{obj})"
145
+ begin
146
+ obj = Scoutui::Base::QBrowser.getElement(@drv, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
147
+ @drv.action.move_to(obj).perform
148
+ bm=Benchmark.measure { obj.click }
149
+ setBenchmark(bm)
150
+ _retry = false
151
+ _clicked=true
152
+
153
+ rescue Selenium::WebDriver::Error::UnknownError
154
+ puts __FILE__ + (__LINE__).to_s + " Selenium::WebDriver::Error::UnknownError"
155
+ _retry=true
156
+ end
157
+
158
+ break if !_retry
159
+ end
160
+
100
161
 
101
- bm=Benchmark.measure { obj.click }
102
- setBenchmark(bm)
103
162
 
104
- _clicked=true
105
163
 
106
164
  page_elt = Scoutui::Utils::TestUtils.instance.getPageElement(_locator)
107
165
 
@@ -114,6 +172,8 @@ module Scoutui::Commands
114
172
  end
115
173
 
116
174
  _whenClicked(page_elt)
175
+ _then(page_elt)
176
+
117
177
  else
118
178
  Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Unable to click object that is not displayed."
119
179
  end
@@ -69,8 +69,6 @@ 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
74
72
 
75
73
  if @cmd.match(/^\s*type[\!]*\((.*),\s*'(.*)\s*'\)\s*$/)
76
74
  _xpath = @cmd.match(/^\s*type[\!]*\((.*),\s*'(.*)\s*'\)\s*$/)[1]
@@ -82,22 +80,17 @@ module Scoutui::Commands
82
80
 
83
81
  Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + "Process TYPE #{_val} into #{_xpath}"
84
82
 
85
- obj = Scoutui::Base::QBrowser.findElement(@drv, _xpath, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
86
-
87
- wait = Selenium::WebDriver::Wait.new(:timeout => Scoutui::Commands::Utils.instance.getTimeout)
88
- isDisplayed = wait.until {
89
- if Scoutui::Base::QBrowser.isStale?(obj)
90
- obj = Scoutui::Base::QBrowser.findElement(@drv, _xpath, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
91
- end
92
- true if obj.displayed?
93
- }
83
+ obj = Scoutui::Base::QBrowser.getElement(@drv, _xpath, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
94
84
 
95
85
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " type(#{_val})"
96
86
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " tag : #{obj.tag_name}" if obj.is_a?(Selenium::WebDriver::Element)
97
87
 
98
- if !obj.nil? &&
99
- (obj.tag_name.downcase=='body' ||
100
- !obj.attribute('type').downcase.match(/(file|input|text|textarea|password|email)/).nil? )
88
+ typeInto = !obj.nil? &&
89
+ (obj.tag_name.downcase=='body' ||
90
+ !obj.attribute('type').downcase.match(/(file|input|text|textarea|password|email)/).nil? )
91
+
92
+
93
+ if typeInto
101
94
 
102
95
  isDisplayed=false
103
96
 
@@ -119,6 +112,15 @@ module Scoutui::Commands
119
112
 
120
113
  if @cmd.match(/^\s*type\!/i)
121
114
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " clear()"
115
+
116
+ (0..3).each do |j|
117
+ if Scoutui::Base::QBrowser.isStale?(obj)
118
+ obj = Scoutui::Base::QBrowser.getElement(@drv, _xpath, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
119
+ else
120
+ break
121
+ end
122
+ end
123
+
122
124
  obj.clear if isDisplayed
123
125
  end
124
126
 
@@ -165,11 +167,34 @@ module Scoutui::Commands
165
167
  _text_to_type = Scoutui::Commands::Utils.instance.expandMacro(_text_to_type)
166
168
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Text to type : #{_text_to_type}"
167
169
 
168
- if Scoutui::Base::QBrowser.isStale?(obj)
169
- obj = Scoutui::Base::QBrowser.findElement(@drv, _xpath, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
170
+ if true
171
+ _stale=true
172
+ _inRow=0
173
+ _cnt=0
174
+ (0..7).each do |i|
175
+ _cnt+=1
176
+ _stale=Scoutui::Base::QBrowser.isStale?(obj)
177
+ if _stale
178
+ _inRow=0
179
+ sleep 0.5
180
+ obj = Scoutui::Base::QBrowser.getElement(@drv, _xpath, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
181
+ else
182
+ _inRow+=1
183
+
184
+ break if _inRow >= 3
185
+
186
+ obj = Scoutui::Base::QBrowser.getElement(@drv, _xpath, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
187
+ end
188
+
189
+ end
190
+
191
+
192
+
193
+ puts __FILE__ + (__LINE__).to_s + " Stale: #{_stale}, i: #{_cnt}, _inRow:#{_inRow}"
170
194
  end
171
195
 
172
- obj.send_keys(_text_to_type)
196
+ obj.send_keys(_text_to_type)
197
+
173
198
 
174
199
  if !pageElt.nil? && pageElt['page'].has_key?('then')
175
200
  pageElt['page']['then'].each do |_subcmd|
@@ -1,3 +1,3 @@
1
1
  module Scoutui
2
- VERSION = "2.0.3.42.pre"
2
+ VERSION = "2.0.3.43.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.42.pre
4
+ version: 2.0.3.43.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-19 00:00:00.000000000 Z
11
+ date: 2016-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler