scoutui 2.0.5.4 → 2.0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/scoutui_driver.rb +20 -10
- data/lib/scoutui/appmodel/q_model.rb +12 -12
- data/lib/scoutui/base/assertions.rb +58 -5
- data/lib/scoutui/base/q_browser.rb +5 -0
- data/lib/scoutui/base/result_assertion.rb +54 -0
- data/lib/scoutui/base/user_vars.rb +1 -1
- data/lib/scoutui/base/visual_test_framework.rb +100 -17
- data/lib/scoutui/commands/clauses/then_clause.rb +8 -5
- data/lib/scoutui/commands/commands.rb +12 -4
- data/lib/scoutui/commands/define_commands.rb +3 -3
- data/lib/scoutui/commands/jsalert/action_jsalert.rb +64 -9
- data/lib/scoutui/commands/load_js.rb +1 -1
- data/lib/scoutui/commands/load_requirements.rb +2 -2
- data/lib/scoutui/commands/mouse_over.rb +1 -1
- data/lib/scoutui/commands/select_object.rb +1 -1
- data/lib/scoutui/commands/select_window.rb +2 -2
- data/lib/scoutui/commands/strategy.rb +15 -3
- data/lib/scoutui/commands/switch_frame.rb +10 -10
- data/lib/scoutui/commands/type.rb +31 -9
- data/lib/scoutui/commands/update_url.rb +4 -1
- data/lib/scoutui/commands/upload_files.rb +2 -2
- data/lib/scoutui/commands/utils.rb +24 -2
- data/lib/scoutui/commands/verify_element.rb +62 -11
- data/lib/scoutui/eyes/eye_scout.rb +11 -3
- data/lib/scoutui/eyes/utils.rb +2 -2
- data/lib/scoutui/utils/utils.rb +44 -13
- data/lib/scoutui/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6dacda3f47090eebe3db6eabf36196b344021da
|
4
|
+
data.tar.gz: a133fff58bd29f175a76a09dd6b84059029fa65a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a720ce6295325c4b0784368782f61b91495338d832ac70dfa68ed04fc165d35f1839b68021eab4356bf5ea9fc02a985d4d0f802e27140e00768d4a77166f1540
|
7
|
+
data.tar.gz: a7a47e786526d6d0a7a3e3eccd6ff86be48254d4999dbae016e3245fea9d2f3099365e0505d8b311b5d00fca640bc98cf4d89b5a884ad398a17bd6027ef4f826
|
data/bin/scoutui_driver.rb
CHANGED
@@ -10,13 +10,23 @@ require 'logger'
|
|
10
10
|
# --title <Applitools Title>
|
11
11
|
# --browser <chrome|firefox|ie>
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
runner = Scoutui::Base::TestScout.new(nav)
|
18
|
-
|
19
|
-
runner.
|
20
|
-
|
21
|
-
|
22
|
-
|
13
|
+
results=nil
|
14
|
+
|
15
|
+
begin
|
16
|
+
nav = Scoutui::Navigator.new(Scoutui::Utils::TestUtils.instance.parseCommandLine())
|
17
|
+
runner = Scoutui::Base::TestScout.new(nav)
|
18
|
+
runner.start()
|
19
|
+
results=runner.report()
|
20
|
+
rescue => ex
|
21
|
+
# puts __FILE__ + (__LINE__).to_s + " #{ex.class.to_s} Error during processing: #{ex.message}"
|
22
|
+
puts ex.backtrace if !ex.message.match(/^SCOUTUI/)
|
23
|
+
end
|
24
|
+
|
25
|
+
rc=0
|
26
|
+
if results.nil?
|
27
|
+
rc=2
|
28
|
+
elsif !results.nil? && !results[:rc]
|
29
|
+
rc=1
|
30
|
+
end
|
31
|
+
|
32
|
+
exit(rc)
|
@@ -101,32 +101,32 @@ module Scoutui::ApplicationModel
|
|
101
101
|
def itemize(condition='visible_when', _action='hover', _pgObj=nil)
|
102
102
|
@results=hits(nil, @app_model, condition, _action, _pgObj)
|
103
103
|
|
104
|
-
|
104
|
+
Scoutui::Logger::LogMgr.instance.debug "[itemize] => #{@results}"
|
105
105
|
|
106
106
|
@results
|
107
107
|
end
|
108
108
|
|
109
109
|
|
110
110
|
def hits(parent, h, condition, _action, pg)
|
111
|
-
#
|
111
|
+
# Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " collect_item_attributes(#{h})"
|
112
112
|
result = []
|
113
113
|
|
114
114
|
|
115
115
|
if h.is_a?(Hash)
|
116
116
|
|
117
117
|
h.each do |k, v|
|
118
|
-
|
118
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Key: #{k} => #{v}"
|
119
119
|
if k == condition
|
120
120
|
# h[k].each {|k, v| result[k] = v } # <= tweak here
|
121
121
|
if !v.is_a?(Array) && v.match(/^\s*#{_action}\s*\((.*)\)\s*$/i)
|
122
122
|
|
123
123
|
pageObject=v.match(/^\s*#{_action}\s*\((.*)\)\s*$/i)[1]
|
124
124
|
|
125
|
-
|
125
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " <pg, pageObject> : <#{pg}, #{pageObject}>"
|
126
126
|
# result[k] = v
|
127
127
|
|
128
|
-
#
|
129
|
-
#
|
128
|
+
# Scoutui::Logger::LogMgr.instance.debug '*******************'
|
129
|
+
# Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " HIT : #{h[k]}"
|
130
130
|
# result << { h[k] => v }
|
131
131
|
|
132
132
|
if pg.nil?
|
@@ -139,14 +139,14 @@ module Scoutui::ApplicationModel
|
|
139
139
|
elsif v.is_a?(Array)
|
140
140
|
|
141
141
|
v.each do |vh|
|
142
|
-
|
142
|
+
Scoutui::Logger::LogMgr.instance.debug " =====> #{vh}"
|
143
143
|
|
144
144
|
if vh.is_a?(Hash) && vh.has_key?(condition) && vh[condition].match(/^\s*#{_action}\s*/i)
|
145
145
|
|
146
146
|
pageObject=vh[condition].match(/^\s*#{_action}\s*\((.*)\)\s*$/i)[1]
|
147
147
|
|
148
148
|
|
149
|
-
|
149
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " matched on #{_action}, pg:#{pg}, #{pageObject}"
|
150
150
|
|
151
151
|
if pg.nil?
|
152
152
|
result << parent
|
@@ -173,8 +173,8 @@ module Scoutui::ApplicationModel
|
|
173
173
|
|
174
174
|
result << _rc
|
175
175
|
|
176
|
-
|
177
|
-
#
|
176
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ADDING #{k} : #{_rc}"
|
177
|
+
# Scoutui::Logger::LogMgr.instance.debug "====> #{k} : #{_rc.class} : #{_rc.length}"
|
178
178
|
|
179
179
|
|
180
180
|
result.flatten!
|
@@ -189,7 +189,7 @@ module Scoutui::ApplicationModel
|
|
189
189
|
|
190
190
|
|
191
191
|
result=nil if result.empty?
|
192
|
-
|
192
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " result : #{result}"
|
193
193
|
result
|
194
194
|
end
|
195
195
|
|
@@ -261,7 +261,7 @@ module Scoutui::ApplicationModel
|
|
261
261
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " | id(#{path}.#{_id}.#{_k}) - #{_h}"
|
262
262
|
|
263
263
|
_h.each do |k, v|
|
264
|
-
#
|
264
|
+
# Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " processing #{_id}.#{k}, #{v}"
|
265
265
|
if v.is_a?(Hash) && v.has_key?('locator')
|
266
266
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " processing #{_id}.#{_k}.#{k}"
|
267
267
|
elsif v.is_a?(Hash) || v.is_a?(Array)
|
@@ -13,6 +13,7 @@ module Scoutui::Base
|
|
13
13
|
|
14
14
|
def initialize
|
15
15
|
@assertionTypes=[
|
16
|
+
{ :cmd => 'isChecked', :pattern => '^\s*[!]*isChecked\((.*)\)\s*$', :parse => lambda { |_a| _parseFrameLoc('isChecked', _a) } },
|
16
17
|
{ :cmd => 'isEnabled', :pattern => '^\s*[!]*isEnabled\((.*)\)\s*$', :parse => lambda { |_a| _parseFrameLoc('isEnabled', _a) } },
|
17
18
|
{ :cmd => 'isSelected', :pattern => '^\s*[!]*isSelected\((.*)\)\s*$', :parse => lambda { |_a| _parseFrameLoc('isSelected', _a) } },
|
18
19
|
{ :cmd => 'isText', :pattern => '^\s*[!]*(isText)\s*\(.*\)\s*\=\s*(.*)\s*$', :parse => lambda { |_a| _parseWith('isText', _a) } },
|
@@ -39,7 +40,15 @@ module Scoutui::Base
|
|
39
40
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " execute_when.condition => #{_uservar_val} equals #{_val}"
|
40
41
|
|
41
42
|
if _cond=='=='
|
42
|
-
|
43
|
+
|
44
|
+
if _val.match(/\/.*\//)
|
45
|
+
_regex = Regexp.new(_val.match(/\/(.*)\//)[1].to_s)
|
46
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Val: #{_uservar_val} REGEX : #{_regex} => #{!_uservar_val.match(_regex).nil?}"
|
47
|
+
_rc = !_uservar_val.match(_regex).nil?
|
48
|
+
else
|
49
|
+
_rc=(_uservar_val.match(/#{_val}/) || _uservar_val==_val)
|
50
|
+
end
|
51
|
+
|
43
52
|
else
|
44
53
|
_rc=(!_uservar_val.match(/#{_val}/) || _uservar_val!=_val)
|
45
54
|
end
|
@@ -265,6 +274,7 @@ module Scoutui::Base
|
|
265
274
|
|
266
275
|
def isTitle(my_driver, _execute_when)
|
267
276
|
|
277
|
+
_result=Scoutui::Base::ResultAssertion.new()
|
268
278
|
rc=nil
|
269
279
|
|
270
280
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isTitle(#{_execute_when}"
|
@@ -276,14 +286,48 @@ module Scoutui::Base
|
|
276
286
|
expected_title = Regexp.new(_locator)
|
277
287
|
rc=!expected_title.match(current_title).nil?
|
278
288
|
|
289
|
+
_result.setReport("Actual: #{current_title} Expected: #{_locator}", rc)
|
279
290
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isTitle?(#{_execute_when}) => #{rc}"
|
280
291
|
rc
|
292
|
+
_result
|
293
|
+
end
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
def isChecked?(my_driver, _execute_when)
|
298
|
+
rc=true
|
299
|
+
|
300
|
+
_locator = _execute_when.match(/^\s*[!]*(isChecked)\((.*)\)\s*$/i)[2].to_s
|
301
|
+
|
302
|
+
_locator = Scoutui::Base::UserVars.instance.normalize(_locator)
|
303
|
+
|
304
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isChecked => #{_locator}"
|
305
|
+
|
306
|
+
_obj = Scoutui::Base::QBrowser.findElement(my_driver, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
|
307
|
+
|
308
|
+
_state = _obj.attribute("checked")
|
309
|
+
|
310
|
+
_state = false if _state.nil? || _state.empty?
|
311
|
+
|
312
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " _obj.checked? => #{_state}"
|
313
|
+
|
314
|
+
if _execute_when.match(/^\s*!(isChecked)/i) && _state
|
315
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " !isChecked(#{_locator}) : false"
|
316
|
+
rc=false
|
317
|
+
elsif _execute_when.match(/^\s*(isChecked)/i) && !_state
|
318
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isChecked(#{_locator}) : false"
|
319
|
+
rc=false
|
320
|
+
end
|
321
|
+
|
322
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isChecked?(#{_execute_when}) => #{rc}"
|
323
|
+
rc
|
281
324
|
end
|
282
325
|
|
283
326
|
def isValue?(my_driver, page_elt)
|
284
327
|
|
285
328
|
rc = false
|
286
329
|
_txt = nil
|
330
|
+
_result=Scoutui::Base::ResultAssertion.new()
|
287
331
|
|
288
332
|
if page_elt.is_a?(String) && page_elt.match(/^\s*(text|value)\s*\(/)
|
289
333
|
#
|
@@ -297,6 +341,8 @@ module Scoutui::Base
|
|
297
341
|
|
298
342
|
xpath = Scoutui::Base::UserVars.instance.get(tmpObj)
|
299
343
|
|
344
|
+
xpath = Scoutui::Base::UserVars.instance.normalize(xpath) # 5150
|
345
|
+
|
300
346
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " locator : #{xpath}"; #gets
|
301
347
|
|
302
348
|
obj = Scoutui::Base::QBrowser.getObject(my_driver, xpath, Scoutui::Commands::Utils.instance.getTimeout)
|
@@ -314,13 +360,18 @@ module Scoutui::Base
|
|
314
360
|
elsif condition.match(/^\s*value/)
|
315
361
|
_txt = obj.attribute('value')
|
316
362
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " value : #{_txt}"
|
317
|
-
|
318
|
-
|
363
|
+
expected_regex = Regexp.new(expectedVal)
|
364
|
+
expandedExpected = Scoutui::Commands::Utils.instance.expandMacro(expectedVal)
|
365
|
+
|
366
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Expanded(#{expectedVal}) : #{expandedExpected}"
|
367
|
+
rc = (!_txt.to_s.match(expected_regex).nil?) || _txt.to_s==expandedExpected
|
319
368
|
else
|
320
369
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Unknown conditon: #{condition}"
|
321
370
|
end
|
322
371
|
|
323
|
-
|
372
|
+
|
373
|
+
_result.setReport("actual: #{_txt} expected: #{expectedVal}")
|
374
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "txt/val: #{_txt} expected: #{expectedVal} rc => #{rc}"
|
324
375
|
end
|
325
376
|
|
326
377
|
|
@@ -332,7 +383,9 @@ module Scoutui::Base
|
|
332
383
|
|
333
384
|
end
|
334
385
|
|
335
|
-
rc
|
386
|
+
_result.setResult(rc)
|
387
|
+
# rc
|
388
|
+
_result
|
336
389
|
end
|
337
390
|
|
338
391
|
|
@@ -450,6 +450,11 @@ module Scoutui::Base
|
|
450
450
|
locateBy=:xpath
|
451
451
|
hits=nil
|
452
452
|
|
453
|
+
locator = Scoutui::Base::UserVars.instance.normalize(locator)
|
454
|
+
_parsed = Scoutui::Base::QBrowser.parseLocator(locator)
|
455
|
+
|
456
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{locator} ==> #{_parsed}"
|
457
|
+
|
453
458
|
|
454
459
|
if locator.match(/^\s*css\s*\=\s*/i)
|
455
460
|
locateBy = :css
|
@@ -0,0 +1,54 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module Scoutui::Base
|
4
|
+
|
5
|
+
|
6
|
+
class ResultAssertion
|
7
|
+
|
8
|
+
attr_accessor :result
|
9
|
+
attr_accessor :report
|
10
|
+
|
11
|
+
def initialize(rc=nil)
|
12
|
+
@result=rc
|
13
|
+
@report=""
|
14
|
+
end
|
15
|
+
|
16
|
+
def setResult(b)
|
17
|
+
@result=b
|
18
|
+
end
|
19
|
+
|
20
|
+
def setReport(_s, _result=nil)
|
21
|
+
@report=_s
|
22
|
+
if !_result.nil?
|
23
|
+
setResult(_result)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def report
|
28
|
+
@report
|
29
|
+
end
|
30
|
+
|
31
|
+
def executed?
|
32
|
+
!@result.nil?
|
33
|
+
end
|
34
|
+
|
35
|
+
def passed?
|
36
|
+
@result
|
37
|
+
end
|
38
|
+
|
39
|
+
def failed?
|
40
|
+
executed? && !passed?
|
41
|
+
end
|
42
|
+
|
43
|
+
def toString()
|
44
|
+
if !executed?
|
45
|
+
return "not executed"
|
46
|
+
end
|
47
|
+
|
48
|
+
@result.to_s
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
@@ -407,9 +407,13 @@ module Scoutui::Base
|
|
407
407
|
_execute_when.each do |_a|
|
408
408
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " assert: => #{_a}"
|
409
409
|
|
410
|
+
_tmpResult=nil
|
411
|
+
_assertText=nil
|
410
412
|
_rc=nil
|
411
413
|
_bm=nil
|
412
414
|
|
415
|
+
_assertMessage = "Assert #{_a}."
|
416
|
+
|
413
417
|
_assertType=Scoutui::Base::Assertions.instance.isValidAssertType(_a)
|
414
418
|
|
415
419
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " assertType : #{_assertType}"
|
@@ -451,6 +455,11 @@ module Scoutui::Base
|
|
451
455
|
_bm=Benchmark.measure {
|
452
456
|
_rc=Scoutui::Base::Assertions.instance.compareValue(_a)
|
453
457
|
}
|
458
|
+
|
459
|
+
elsif _assertType[:cmd]=='isChecked'
|
460
|
+
_bm=Benchmark.measure {
|
461
|
+
_rc=Scoutui::Base::Assertions.instance.isChecked?(my_driver, _a)
|
462
|
+
}
|
454
463
|
end
|
455
464
|
|
456
465
|
elsif Scoutui::Base::Assertions.instance.isRoleCmd?(_a)
|
@@ -465,13 +474,50 @@ module Scoutui::Base
|
|
465
474
|
}
|
466
475
|
elsif Scoutui::Base::Assertions.instance.isValueCmd?(_a)
|
467
476
|
_bm=Benchmark.measure {
|
468
|
-
|
477
|
+
_tmpResult=Scoutui::Base::Assertions.instance.isValue?(my_driver, _a)
|
478
|
+
_rc=_tmpResult.passed?
|
469
479
|
}
|
470
480
|
elsif Scoutui::Base::Assertions.instance.isTitleCmd?(_a)
|
471
481
|
_bm=Benchmark.measure {
|
472
|
-
|
482
|
+
_tmpResult=Scoutui::Base::Assertions.instance.isTitle(my_driver, _a)
|
483
|
+
_rc=_tmpResult.passed?
|
473
484
|
}
|
474
485
|
|
486
|
+
elsif _a.match(/^\s*count\(.*\)\s*(==|!=|>=|<=|<|>)\s*(\d+|\$\{.*\})$/)
|
487
|
+
|
488
|
+
_mResult = _a.match(/^\s*count\((.*)\)\s*(==|!=|>=|<=|<|>)\s*(\d+|\$\{.*\})$/)
|
489
|
+
_locator = _mResult[1]
|
490
|
+
_op = _mResult[2]
|
491
|
+
_v = Scoutui::Base::UserVars.instance.normalize(_mResult[3]).to_i
|
492
|
+
|
493
|
+
## _v should be an integer
|
494
|
+
|
495
|
+
_bm=Benchmark.measure {
|
496
|
+
hits = Scoutui::Base::QBrowser.findElements( { :driver => my_driver, :locator => _locator })
|
497
|
+
|
498
|
+
|
499
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Process COUNT : #{_locator} is #{_op} val #{_v} => #{hits.length}"
|
500
|
+
|
501
|
+
|
502
|
+
if _op=='=='
|
503
|
+
_rc = hits.length == _v
|
504
|
+
elsif _op=='>='
|
505
|
+
_rc = hits.length >= _v
|
506
|
+
elsif _op=='<='
|
507
|
+
_rc = hits.length <= _v
|
508
|
+
elsif _op=='<'
|
509
|
+
_rc = hits.length < _v
|
510
|
+
elsif _op=='>'
|
511
|
+
_rc = hits.length > _v
|
512
|
+
elsif _op=='!='
|
513
|
+
_rc = hits.length != _v
|
514
|
+
end
|
515
|
+
|
516
|
+
_tmpResult=Scoutui::Base::ResultAssertion.new()
|
517
|
+
_tmpResult.setReport("Assert count(#{_locator}) #{_op} #{_v}. Actual: #{hits.length} Expected: #{_v}. : #{_rc}", _rc)
|
518
|
+
}
|
519
|
+
|
520
|
+
|
475
521
|
|
476
522
|
elsif _a.match(/^\s*[fF]ocused\(.*\)\s*$/)
|
477
523
|
|
@@ -488,11 +534,12 @@ module Scoutui::Base
|
|
488
534
|
}
|
489
535
|
|
490
536
|
if _rc
|
491
|
-
|
537
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " focused() - MATCHED"
|
492
538
|
end
|
493
539
|
|
494
540
|
elsif _a.match(/^\s*([fF]ocused\.[Vv]alue\((.*)\))\s*$/)
|
495
541
|
_expectedValue = _a.match(/^\s*([fF]ocused.[Vv]alue\((.*)\))\s*$/)[2].to_s
|
542
|
+
_expectedValue = Scoutui::Base::UserVars.instance.normalize(_expectedValue)
|
496
543
|
_activeElt=nil
|
497
544
|
_value=nil
|
498
545
|
|
@@ -504,7 +551,7 @@ module Scoutui::Base
|
|
504
551
|
|
505
552
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " activeElt.value : |#{_value.to_s}|"
|
506
553
|
|
507
|
-
_rc=!(_value.to_s.match(/#{_expectedValue}/).nil?)
|
554
|
+
_rc=!(_value.to_s.match(/#{_expectedValue}/).nil?) || (_value.to_s==_expectedValue)
|
508
555
|
end
|
509
556
|
}
|
510
557
|
|
@@ -534,11 +581,14 @@ module Scoutui::Base
|
|
534
581
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " activeElt.value : |#{_activeElt.attribute('value').to_s}|"
|
535
582
|
end
|
536
583
|
|
537
|
-
|
584
|
+
# _rc=!(_activeElt.text.to_s.match(/#{_targetTxt}/).nil?) # || _activeElt.text.to_s==_targetTxt.to_s
|
585
|
+
_rc= (!_activeElt.text.to_s.match(Regexp.new(_targetTxt)).nil?) || (_activeElt.text.to_s==_targetTxt)
|
538
586
|
|
539
|
-
|
540
|
-
|
587
|
+
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " isMatch : #{_rc}"
|
588
|
+
|
589
|
+
if _a.match(/^\s*![fF]ocused\./)
|
541
590
|
_rc=!_rc
|
591
|
+
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " verify #{_targetTxt} != #{_activeElt.text} => #{_rc}"
|
542
592
|
end
|
543
593
|
|
544
594
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " FocusedText : #{_activeElt.text} => #{_rc}"
|
@@ -546,6 +596,7 @@ module Scoutui::Base
|
|
546
596
|
}
|
547
597
|
|
548
598
|
if _activeElt.is_a?(Selenium::WebDriver::Element)
|
599
|
+
_assertText = "Verify #{_a} - focused: #{_activeElt.text}, expected: #{_targetTxt} - #{_rc}"
|
549
600
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ASSERT: focusTxt: #{_targetTxt} vs #{_activeElt.text} => #{_rc}"
|
550
601
|
end
|
551
602
|
|
@@ -568,7 +619,7 @@ module Scoutui::Base
|
|
568
619
|
|
569
620
|
elsif !_a.match(/^page\([\w\d]+\)/).nil?
|
570
621
|
|
571
|
-
|
622
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "\n\n=== Validate Page ==="
|
572
623
|
|
573
624
|
_obj = processPageElement(my_driver, nil, _a)
|
574
625
|
|
@@ -576,7 +627,7 @@ module Scoutui::Base
|
|
576
627
|
#puts __FILE__ + (__LINE__).to_s + " *** WHAT type of assertion => #{_obj}"; STDIN.gets
|
577
628
|
|
578
629
|
elsif !_a.match(/^\s*accessibility\s*$/).nil?
|
579
|
-
|
630
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " *** Accessibility ***"
|
580
631
|
|
581
632
|
|
582
633
|
# 5150
|
@@ -586,6 +637,18 @@ module Scoutui::Base
|
|
586
637
|
end
|
587
638
|
|
588
639
|
# textAreas = Scoutui::Base::QBrowser.getObjects( { :driver => my_driver, :locator => '//textarea' })
|
640
|
+
|
641
|
+
|
642
|
+
# elsif _a.match(/^\s*[!](existsalert|existsalert|exists\(alert\))/i)
|
643
|
+
elsif Scoutui::Commands::Utils.instance.isExistsAlert?(_a)
|
644
|
+
_bm=Benchmark.measure {
|
645
|
+
|
646
|
+
_c = Scoutui::Commands::JsAlert::ExistsAlert.new(_a)
|
647
|
+
_rc = _c.execute(my_driver)
|
648
|
+
_assertMessage = _c.getAssertText()
|
649
|
+
#_rc = _c.alertExists?
|
650
|
+
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " existsAlert => #{_rc}"
|
651
|
+
}
|
589
652
|
end
|
590
653
|
|
591
654
|
if !_rc.nil?
|
@@ -596,7 +659,21 @@ module Scoutui::Base
|
|
596
659
|
|
597
660
|
_testcase = Scoutui::Utils::TestUtils.instance.getTC() || "visible_when"
|
598
661
|
|
599
|
-
|
662
|
+
# _assertMessage = "Assert #{_a}."
|
663
|
+
|
664
|
+
if !_tmpResult.nil?
|
665
|
+
_assertMessage+=" #{_tmpResult.report}"
|
666
|
+
end
|
667
|
+
|
668
|
+
Testmgr::TestReport.instance.getReq(_req).get_child(_testcase).add(_rc, _assertMessage, _bm.real)
|
669
|
+
|
670
|
+
if Scoutui::Utils::TestUtils.instance.isFailFast? && !_rc
|
671
|
+
|
672
|
+
_assertText = "Failed assertion: #{_a.to_s}" if _assertText.nil?
|
673
|
+
Scoutui::Utils::TestUtils.instance.setState(:abort, _assertText)
|
674
|
+
|
675
|
+
end
|
676
|
+
|
600
677
|
end
|
601
678
|
|
602
679
|
Scoutui::Commands::Utils.instance.resetFrameSearch()
|
@@ -1230,7 +1307,10 @@ module Scoutui::Base
|
|
1230
1307
|
|
1231
1308
|
elsif Scoutui::Base::Assertions.instance.isValueCmd?(_a)
|
1232
1309
|
|
1233
|
-
|
1310
|
+
_tmpRc=Scoutui::Base::Assertions.instance.isValue?(my_driver, _a)
|
1311
|
+
|
1312
|
+
# if !Scoutui::Base::Assertions.instance.isValue?(my_driver, _a)
|
1313
|
+
if !_tmpRc.passed?
|
1234
1314
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " value doesnt match"
|
1235
1315
|
_executeIt = false
|
1236
1316
|
end
|
@@ -1397,9 +1477,12 @@ module Scoutui::Base
|
|
1397
1477
|
|
1398
1478
|
if !isRun(e).nil?
|
1399
1479
|
|
1400
|
-
|
1480
|
+
|
1401
1481
|
tmpSettings=test_settings.dup
|
1402
|
-
tmpSettings["dut"]=e[STEP_KEY]["run"].to_s
|
1482
|
+
tmpSettings["dut"]=Scoutui::Base::UserVars.instance.normalize(e[STEP_KEY]["run"].to_s)
|
1483
|
+
|
1484
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ========> RUN #{tmpSettings['dut']} <================="
|
1485
|
+
|
1403
1486
|
|
1404
1487
|
Scoutui::Logger::LogMgr.instance.info " RUN Command file : #{tmpSettings["dut"]}"
|
1405
1488
|
processFile(eyeScout, tmpSettings, strategy)
|
@@ -1436,7 +1519,7 @@ module Scoutui::Base
|
|
1436
1519
|
if Scoutui::Utils::TestUtils.instance.isFailFast? && !_command.passed?
|
1437
1520
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "FAIL FAST => #{_command.passed?}"
|
1438
1521
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Failfast.";
|
1439
|
-
Scoutui::Utils::TestUtils.instance.setState(:abort)
|
1522
|
+
Scoutui::Utils::TestUtils.instance.setState(:abort, "Step #{i.to_s} : #{_name.to_s} : #{_action.to_s}")
|
1440
1523
|
takeScreenShot(my_driver, "step_#{i}.failed")
|
1441
1524
|
return
|
1442
1525
|
end
|
@@ -1478,12 +1561,12 @@ module Scoutui::Base
|
|
1478
1561
|
|
1479
1562
|
_shotName="step_#{i}.failed"
|
1480
1563
|
if !_name.nil?
|
1481
|
-
_shotName = "#{_name.to_s}
|
1564
|
+
_shotName = "#{_shotName}.#{_name.to_s}"
|
1482
1565
|
end
|
1483
1566
|
|
1484
1567
|
takeScreenShot(my_driver, _shotName)
|
1485
1568
|
|
1486
|
-
Scoutui::Utils::TestUtils.instance.setState(:abort,
|
1569
|
+
Scoutui::Utils::TestUtils.instance.setState(:abort, "Step #{i.to_s}. #{_name.to_s}")
|
1487
1570
|
return
|
1488
1571
|
end
|
1489
1572
|
|
@@ -1524,7 +1607,7 @@ module Scoutui::Base
|
|
1524
1607
|
if Scoutui::Utils::TestUtils.instance.screenShots? || (Scoutui::Utils::TestUtils.instance.screenShotsOnFailure? && !_assertResult)
|
1525
1608
|
_shotName="step_#{i}"
|
1526
1609
|
if !_name.nil?
|
1527
|
-
_shotName = "#{_name.to_s}
|
1610
|
+
_shotName = "#{_shotName}.#{_name.to_s}"
|
1528
1611
|
end
|
1529
1612
|
|
1530
1613
|
takeScreenShot(my_driver, _shotName)
|