scoutui 2.0.5.3 → 2.0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/scoutui/base/assertions.rb +19 -7
- data/lib/scoutui/base/q_browser.rb +24 -24
- data/lib/scoutui/base/user_vars.rb +42 -13
- data/lib/scoutui/base/visual_test_framework.rb +29 -9
- data/lib/scoutui/commands/clauses/do_until.rb +27 -5
- data/lib/scoutui/commands/clauses/while_do.rb +116 -0
- data/lib/scoutui/commands/click_object.rb +8 -2
- data/lib/scoutui/commands/command.rb +1 -0
- data/lib/scoutui/commands/commands.rb +35 -4
- data/lib/scoutui/commands/type.rb +3 -1
- data/lib/scoutui/commands/update_url.rb +2 -0
- data/lib/scoutui/commands/utils.rb +43 -29
- 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: bbf796808a18143060a52ebcb6221e3d4a0bb388
|
4
|
+
data.tar.gz: 841d44e21a34f8f5d2db8fd55c0e27e1d9c0b710
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 851555770f4079642021e5e9579d802e27031f4af7a8a0b88641b10ae1200ce5d4b110f315974b376aec837a9171626246eb639566c62ae0805c5f95fa5276c3
|
7
|
+
data.tar.gz: 75361076e0fa9eb6b02fceb7c3abe2f057edee95499d59e42aa89c2e48215f7ab1ffaa8728e197307c5dd1694963111c568892c709e53304cfdce9eec2069ec7
|
@@ -20,7 +20,7 @@ module Scoutui::Base
|
|
20
20
|
{ :cmd => 'visible', :pattern => '^\s*[!]*visible\((.*)\)\s*$', :parse => nil },
|
21
21
|
{ :cmd => 'isUrl', :pattern => '^\s*isUrl\((.*)\)\s*$', :parse => lambda { |_a| _parseWith('isUrl', _a) } },
|
22
22
|
{ :cmd => 'url', :pattern => '^\s*url\((.*)\)\s*$', :parse => lambda { |_a| _parseWith('url', _a) } },
|
23
|
-
{ :cmd => 'compare', :pattern => '
|
23
|
+
{ :cmd => 'compare', :pattern => '^\s*(\$\{.*\})\s*(==|!=)(.*)$', :parse => nil }
|
24
24
|
]
|
25
25
|
|
26
26
|
end
|
@@ -430,7 +430,7 @@ module Scoutui::Base
|
|
430
430
|
if _obj.is_a?(Selenium::WebDriver::Element)
|
431
431
|
_v = _obj.text.to_s
|
432
432
|
|
433
|
-
|
433
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isText(#{_locator.to_s}) : #{_v} (tagname: #{_obj.tag_name}, displayed: #{_obj.displayed?.to_s}"
|
434
434
|
rc=!_v.match(/#{_t['expected_value']}/).nil?
|
435
435
|
|
436
436
|
if _t['cmd'].match(/^!\s*is[tT]ext/i)
|
@@ -498,11 +498,17 @@ module Scoutui::Base
|
|
498
498
|
|
499
499
|
if !_t.nil?
|
500
500
|
_locator = _t['locator']
|
501
|
+
|
502
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Locator : #{_locator}"
|
501
503
|
_locator = Scoutui::Base::UserVars.instance.normalize(_locator)
|
502
504
|
|
505
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Normalize() => #{_locator}"
|
506
|
+
|
503
507
|
|
504
508
|
_locator = Scoutui::Base::UserVars.instance.get(_locator)
|
505
509
|
|
510
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Get(#{_locator}) : #{_locator}"
|
511
|
+
|
506
512
|
if _t.has_key?('frame') && !_t['frame'].nil?
|
507
513
|
Scoutui::Commands::Utils.instance.setEnableFrameSearch(_t['frame'])
|
508
514
|
end
|
@@ -516,16 +522,22 @@ module Scoutui::Base
|
|
516
522
|
_locator = _execute_when.match(/^\s*[!]*visible\((.*)\)\s*$/i)[1].to_s
|
517
523
|
end
|
518
524
|
|
519
|
-
|
525
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Locator : #{_locator}"
|
520
526
|
_locator = Scoutui::Base::UserVars.instance.normalize(_locator)
|
527
|
+
|
528
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Normalize() => #{_locator}"
|
529
|
+
|
521
530
|
_locator = Scoutui::Base::UserVars.instance.get(_locator)
|
531
|
+
|
532
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Get(#{_locator}) : #{_locator}"
|
533
|
+
|
522
534
|
else
|
523
535
|
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " invalid visible cmd: #{_execute_when}"
|
524
536
|
end
|
525
537
|
|
526
538
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " visible => #{_locator}"
|
527
539
|
|
528
|
-
(0..
|
540
|
+
(0..1).each do |_retry|
|
529
541
|
begin
|
530
542
|
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
531
543
|
|
@@ -544,17 +556,17 @@ module Scoutui::Base
|
|
544
556
|
break if _state
|
545
557
|
|
546
558
|
rescue Selenium::WebDriver::Error::TimeOutError
|
547
|
-
|
559
|
+
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Timed out => #{_locator}"
|
548
560
|
|
549
561
|
rescue Selenium::WebDriver::Error::StaleElementReferenceError
|
550
|
-
|
562
|
+
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " StaleElementReferenceError: retry #{_retry} : #{_locator}";
|
551
563
|
sleep(0.5)
|
552
564
|
end
|
553
565
|
end
|
554
566
|
|
555
567
|
|
556
568
|
if !_state
|
557
|
-
|
569
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Paused due to fail to find #{_locator}"; #STDIN.gets();
|
558
570
|
end
|
559
571
|
|
560
572
|
if !_enableAsserts
|
@@ -310,7 +310,7 @@ module Scoutui::Base
|
|
310
310
|
|
311
311
|
rescue => ex
|
312
312
|
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " #{ex}"
|
313
|
-
|
313
|
+
Scoutui::Logger::LogMgr.instance.warn ex.backtrace
|
314
314
|
end
|
315
315
|
|
316
316
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " | isStale?(#{_obj}) : nosuch=#{_noSuch}, stale=#{_isStale}"
|
@@ -444,7 +444,7 @@ module Scoutui::Base
|
|
444
444
|
|
445
445
|
# 5150
|
446
446
|
def self.findElements(opts)
|
447
|
-
|
447
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " findElements(#{opts})"
|
448
448
|
driver=opts[:driver]
|
449
449
|
locator=opts[:locator]
|
450
450
|
locateBy=:xpath
|
@@ -458,16 +458,16 @@ module Scoutui::Base
|
|
458
458
|
locateBy = :css
|
459
459
|
end
|
460
460
|
|
461
|
-
|
462
|
-
|
461
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " driver : #{driver.class}"
|
462
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " locator : #{locator}"
|
463
463
|
|
464
464
|
begin
|
465
465
|
_timeout=Scoutui::Commands::Utils.instance.getTimeout
|
466
466
|
Selenium::WebDriver::Wait.new(timeout: _timeout).until { hits=driver.find_elements( locateBy => locator) }
|
467
467
|
|
468
468
|
rescue => ex
|
469
|
-
|
470
|
-
|
469
|
+
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " #{ex.class}"
|
470
|
+
Scoutui::Logger::LogMgr.instance.warn ex.backtrace
|
471
471
|
|
472
472
|
end
|
473
473
|
hits
|
@@ -492,17 +492,17 @@ module Scoutui::Base
|
|
492
492
|
# http://stackoverflow.com/questions/14288917/selenium-webdriver-get-attributes-after-finding-an-element
|
493
493
|
def self.isAccessible(opts)
|
494
494
|
|
495
|
-
|
495
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " == isAccessible(#{opts}) =="
|
496
496
|
hits = Scoutui::Base::QBrowser.findElements(opts)
|
497
497
|
|
498
|
-
|
498
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " HITS => #{hits.length}"
|
499
499
|
|
500
500
|
|
501
501
|
i=0
|
502
502
|
begin
|
503
503
|
hits.each do | obj |
|
504
504
|
if obj.displayed?
|
505
|
-
|
505
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{i}. #{obj.tag_name}"
|
506
506
|
|
507
507
|
tagName=obj.tag_name.to_s.strip
|
508
508
|
|
@@ -517,12 +517,12 @@ module Scoutui::Base
|
|
517
517
|
|
518
518
|
if parent_li
|
519
519
|
forId = parent_li['for']
|
520
|
-
|
521
|
-
|
520
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " parent: #{parent_li.tag_name}"
|
521
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " assert <id, for>: #{id}, #{forId}"
|
522
522
|
|
523
523
|
Testmgr::TestReport.instance.getReq('WCAG').testcase(tagName).add(id==forId, "Verify matching label for #{tagName} has same id (#{id}) and for (#{forId}) values")
|
524
524
|
else
|
525
|
-
|
525
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " => Missing associated label for #{tagName}"
|
526
526
|
end
|
527
527
|
|
528
528
|
|
@@ -534,13 +534,13 @@ module Scoutui::Base
|
|
534
534
|
alt=obj.attribute('alt')
|
535
535
|
longdesc=obj.attribute('longdesc')
|
536
536
|
|
537
|
-
|
537
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ** #{i}. process #{tagName} <alt, longdesc>::<#{alt.nil?}, #{longdesc.nil?}, #{src}> **"
|
538
538
|
|
539
539
|
Testmgr::TestReport.instance.getReq('WCAG').testcase(tagName).add(!(alt.nil? && longdesc.nil?), "Verify alt/longdesc (#{alt.to_s} exists for img[#{i}] (#{src})")
|
540
540
|
|
541
541
|
|
542
542
|
else
|
543
|
-
|
543
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " == #{tagName} out of scope for Acccessibility"
|
544
544
|
|
545
545
|
end
|
546
546
|
|
@@ -551,8 +551,8 @@ module Scoutui::Base
|
|
551
551
|
end
|
552
552
|
|
553
553
|
rescue => ex
|
554
|
-
|
555
|
-
|
554
|
+
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " #{ex.class}"
|
555
|
+
Scoutui::Logger::LogMgr.instance.warn ex.backtrace
|
556
556
|
end
|
557
557
|
|
558
558
|
|
@@ -560,7 +560,7 @@ module Scoutui::Base
|
|
560
560
|
|
561
561
|
def self.findElementwithinFrame(drv, _locator, _frames, _timeout=nil)
|
562
562
|
|
563
|
-
|
563
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " frameElementWithinFrame(#{_locator}, #{_frames}"
|
564
564
|
|
565
565
|
# 5150
|
566
566
|
|
@@ -583,7 +583,7 @@ module Scoutui::Base
|
|
583
583
|
|
584
584
|
end
|
585
585
|
|
586
|
-
|
586
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " [return]:frameElementsWithinFrame(#{_locator}, #{_frames}) => #{obj.class}"
|
587
587
|
obj
|
588
588
|
end
|
589
589
|
|
@@ -609,7 +609,7 @@ module Scoutui::Base
|
|
609
609
|
|
610
610
|
if Scoutui::ApplicationModel::QModel.isPageObject?(_locator) # _locator.match(/^page\([\w\d]+\)/)
|
611
611
|
pg = Scoutui::Utils::TestUtils.instance.getPageElement(_locator)
|
612
|
-
|
612
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " [parseLocator]: pageObject(#{_locator}) => #{pg}"
|
613
613
|
|
614
614
|
if pg.is_a?(Hash)
|
615
615
|
|
@@ -647,8 +647,8 @@ module Scoutui::Base
|
|
647
647
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " parseIt2: #{locator} => #{rc}"
|
648
648
|
|
649
649
|
if rc
|
650
|
-
|
651
|
-
|
650
|
+
Scoutui::Logger::LogMgr.instance.debug "o rc[1] : #{rc[1]}"
|
651
|
+
Scoutui::Logger::LogMgr.instance.debug "o rc[2] : #{rc[2]}"
|
652
652
|
return { 'locator' => rc[2] }
|
653
653
|
end
|
654
654
|
|
@@ -680,11 +680,11 @@ module Scoutui::Base
|
|
680
680
|
|
681
681
|
else
|
682
682
|
|
683
|
-
|
683
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Analyze locator : #{_locator}"
|
684
684
|
|
685
685
|
_parsed = Scoutui::Base::QBrowser.parseLocator(_locator)
|
686
686
|
|
687
|
-
|
687
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " _parsed(#{_locator}) => #{_parsed}"
|
688
688
|
|
689
689
|
if _parsed.has_key?('frame') && _parsed.has_key?('locator')
|
690
690
|
obj = Scoutui::Base::QBrowser.findElementwithinFrame(drv, _parsed['locator'], _parsed['frame'], _timeout)
|
@@ -990,7 +990,7 @@ module Scoutui::Base
|
|
990
990
|
drv.execute_script("hlt = function(c) { c#{parents}.style.border='solid 1px rgb(#{color}, 0, 0)'; }; return hlt(arguments[0]);", element)
|
991
991
|
end
|
992
992
|
else
|
993
|
-
|
993
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " SKIP ANCES"
|
994
994
|
end
|
995
995
|
|
996
996
|
# Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " PAUSE on highlight"; gets
|
@@ -76,13 +76,34 @@ module Scoutui::Base
|
|
76
76
|
_val.match(/^\s*TestData\(.*\)\.getData\(.*\)\s*$/)
|
77
77
|
end
|
78
78
|
|
79
|
+
def _reduce(t)
|
80
|
+
s = t.clone
|
81
|
+
_vars = s.scan(/(\$\{.*?\})/)
|
82
|
+
_vars.each do | _v|
|
83
|
+
if _v.length==1
|
79
84
|
|
80
|
-
|
85
|
+
_u = Scoutui::Base::UserVars.instance.get(_v[0].to_s)
|
86
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Normalize(#{_v}) => #{_u}"
|
81
87
|
|
82
|
-
|
83
|
-
|
88
|
+
s.gsub!(_v[0].to_s, _u)
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " _reduce(#{t}) => #{s}";
|
94
|
+
s
|
95
|
+
end
|
96
|
+
|
97
|
+
def normalize(src)
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
if src.is_a?(TrueClass) || src.nil? || src.empty?
|
102
|
+
return src
|
84
103
|
end
|
85
104
|
|
105
|
+
s = src.clone
|
106
|
+
|
86
107
|
begin
|
87
108
|
if Scoutui::Base::UserVars.instance.isTestData?(s)
|
88
109
|
|
@@ -92,25 +113,28 @@ module Scoutui::Base
|
|
92
113
|
return Scoutui::Base::TestData.instance.get(_dataID, _getter)
|
93
114
|
end
|
94
115
|
|
95
|
-
|
96
|
-
|
97
|
-
|
116
|
+
hydrate = _reduce(s)
|
117
|
+
|
118
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " hydrate(#{s}) => #{hydrate}"
|
98
119
|
|
99
|
-
|
100
|
-
|
120
|
+
while hydrate.match(/\$\{.*\}/)
|
121
|
+
_t = _reduce(hydrate)
|
101
122
|
|
102
|
-
|
123
|
+
if _t==hydrate
|
124
|
+
break
|
103
125
|
end
|
104
126
|
|
127
|
+
hydrate=_t
|
128
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " hydrate2() => #{hydrate}";
|
105
129
|
end
|
106
130
|
|
107
131
|
rescue => ex
|
108
|
-
|
109
|
-
|
132
|
+
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " #{ex.class}"
|
133
|
+
Scoutui::Logger::LogMgr.instance.warn ex.backtrace
|
110
134
|
end
|
111
135
|
|
112
136
|
|
113
|
-
|
137
|
+
hydrate
|
114
138
|
end
|
115
139
|
|
116
140
|
def get(_k)
|
@@ -149,7 +173,12 @@ module Scoutui::Base
|
|
149
173
|
elsif !_rc.nil?
|
150
174
|
k=_rc[1].to_s
|
151
175
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " User Var found => #{k}"
|
152
|
-
|
176
|
+
|
177
|
+
if Scoutui::Utils::TestUtils.instance.getTestConfig().nil?
|
178
|
+
|
179
|
+
;
|
180
|
+
|
181
|
+
elsif Scoutui::Utils::TestUtils.instance.getTestConfig().has_key?("user_vars")
|
153
182
|
|
154
183
|
if Scoutui::Utils::TestUtils.instance.getTestConfig()["user_vars"].has_key?(k)
|
155
184
|
v=Scoutui::Utils::TestUtils.instance.getTestConfig()["user_vars"][k].to_s
|
@@ -345,7 +345,7 @@ module Scoutui::Base
|
|
345
345
|
|
346
346
|
|
347
347
|
def self.verifyCondition(my_driver, xpath)
|
348
|
-
|
348
|
+
wasProcessed=false
|
349
349
|
|
350
350
|
if !xpath.match(/^page\([\w\d]+\)/).nil?
|
351
351
|
|
@@ -374,6 +374,8 @@ module Scoutui::Base
|
|
374
374
|
|
375
375
|
_obj = Scoutui::Base::QBrowser.getFirstObject(my_driver, _locator)
|
376
376
|
|
377
|
+
wasProcessed=true
|
378
|
+
|
377
379
|
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " HIT #{_locator} => #{!_obj.nil?}"
|
378
380
|
end
|
379
381
|
|
@@ -382,6 +384,7 @@ module Scoutui::Base
|
|
382
384
|
|
383
385
|
end
|
384
386
|
|
387
|
+
wasProcessed
|
385
388
|
end
|
386
389
|
|
387
390
|
end
|
@@ -443,6 +446,11 @@ module Scoutui::Base
|
|
443
446
|
_bm=Benchmark.measure {
|
444
447
|
_rc=Scoutui::Base::Assertions.instance.isUrlMatch(my_driver, _a)
|
445
448
|
}
|
449
|
+
|
450
|
+
elsif _assertType[:cmd]=='compare'
|
451
|
+
_bm=Benchmark.measure {
|
452
|
+
_rc=Scoutui::Base::Assertions.instance.compareValue(_a)
|
453
|
+
}
|
446
454
|
end
|
447
455
|
|
448
456
|
elsif Scoutui::Base::Assertions.instance.isRoleCmd?(_a)
|
@@ -465,9 +473,9 @@ module Scoutui::Base
|
|
465
473
|
}
|
466
474
|
|
467
475
|
|
468
|
-
elsif _a.match(/^\s*
|
476
|
+
elsif _a.match(/^\s*[fF]ocused\(.*\)\s*$/)
|
469
477
|
|
470
|
-
_locator = _a.match(/^\s*
|
478
|
+
_locator = _a.match(/^\s*[fF]ocused\((.*)\)\s*$/)[1]
|
471
479
|
|
472
480
|
_bm=Benchmark.measure {
|
473
481
|
_activeElt = my_driver.switch_to.active_element
|
@@ -483,8 +491,8 @@ module Scoutui::Base
|
|
483
491
|
puts __FILE__ + (__LINE__).to_s + " focused() - MATCHED"
|
484
492
|
end
|
485
493
|
|
486
|
-
elsif _a.match(/^\s*(
|
487
|
-
_expectedValue = _a.match(/^\s*(
|
494
|
+
elsif _a.match(/^\s*([fF]ocused\.[Vv]alue\((.*)\))\s*$/)
|
495
|
+
_expectedValue = _a.match(/^\s*([fF]ocused.[Vv]alue\((.*)\))\s*$/)[2].to_s
|
488
496
|
_activeElt=nil
|
489
497
|
_value=nil
|
490
498
|
|
@@ -506,9 +514,9 @@ module Scoutui::Base
|
|
506
514
|
|
507
515
|
|
508
516
|
|
509
|
-
elsif _a.match(/^\s*(
|
517
|
+
elsif _a.match(/^\s*([!]*[fF]ocused\.[Tt]ext\((.*)\))\s*$/)
|
510
518
|
|
511
|
-
_targetTxt = _a.match(/^\s*(
|
519
|
+
_targetTxt = _a.match(/^\s*([!]*[fF]ocused.[Tt]ext\((.*)\))\s*$/)[2].to_s
|
512
520
|
|
513
521
|
|
514
522
|
_targetTxt = Scoutui::Base::UserVars.instance.normalize(_targetTxt)
|
@@ -527,6 +535,12 @@ module Scoutui::Base
|
|
527
535
|
end
|
528
536
|
|
529
537
|
_rc=!(_activeElt.text.to_s.match(/#{_targetTxt}/).nil?) # || _activeElt.text.to_s==_targetTxt.to_s
|
538
|
+
|
539
|
+
if _a.match(/^\s*!focused/)
|
540
|
+
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " verify #{_targetTxt} != #{_activeElt.text} => #{_rc}"
|
541
|
+
_rc=!_rc
|
542
|
+
end
|
543
|
+
|
530
544
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " FocusedText : #{_activeElt.text} => #{_rc}"
|
531
545
|
end
|
532
546
|
}
|
@@ -746,11 +760,16 @@ module Scoutui::Base
|
|
746
760
|
expected_list=e[STEP_KEY]['expected']
|
747
761
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " => #{expected_list}"
|
748
762
|
|
763
|
+
_expectedResults=processAsserts(my_driver, expected_list, false)
|
764
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " expectedResults => #{_expectedResults}"
|
749
765
|
|
750
766
|
if expected_list.is_a?(Array)
|
751
767
|
|
752
768
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Process Arr of Expected"
|
769
|
+
|
753
770
|
expected_list.each do |_condition|
|
771
|
+
|
772
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " processExpected.Condition : #{_condition}"
|
754
773
|
verifyCondition(my_driver, _condition)
|
755
774
|
end
|
756
775
|
end
|
@@ -1309,7 +1328,7 @@ module Scoutui::Base
|
|
1309
1328
|
_args=[]
|
1310
1329
|
|
1311
1330
|
e[STEP_KEY]['executejs'][fcnToCall].each do |arg|
|
1312
|
-
|
1331
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ||| arg: #{arg}"
|
1313
1332
|
|
1314
1333
|
if arg.match(/^\s*\//)
|
1315
1334
|
_args << Scoutui::Base::QBrowser.getObject(my_driver, arg, Scoutui::Commands::Utils.instance.getTimeout)
|
@@ -1331,7 +1350,7 @@ module Scoutui::Base
|
|
1331
1350
|
end
|
1332
1351
|
|
1333
1352
|
|
1334
|
-
|
1353
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Execute => #{fcnToCall}(#{argString})"
|
1335
1354
|
|
1336
1355
|
# _obj = Scoutui::Base::QBrowser.getObject(my_driver, '//body', Scoutui::Commands::Utils.instance.getTimeout)
|
1337
1356
|
|
@@ -1415,6 +1434,7 @@ module Scoutui::Base
|
|
1415
1434
|
processCommand(_action, e, my_driver)
|
1416
1435
|
else
|
1417
1436
|
if Scoutui::Utils::TestUtils.instance.isFailFast? && !_command.passed?
|
1437
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "FAIL FAST => #{_command.passed?}"
|
1418
1438
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Failfast.";
|
1419
1439
|
Scoutui::Utils::TestUtils.instance.setState(:abort)
|
1420
1440
|
takeScreenShot(my_driver, "step_#{i}.failed")
|
@@ -4,15 +4,26 @@ module Scoutui::Commands
|
|
4
4
|
class DoUntil
|
5
5
|
|
6
6
|
attr_accessor :drv
|
7
|
+
attr_accessor :passed
|
7
8
|
|
8
9
|
def initialize(driver)
|
9
10
|
@drv=driver
|
10
11
|
@pageElt=nil
|
12
|
+
@passed=true
|
13
|
+
@executed=false
|
11
14
|
end
|
12
15
|
|
16
|
+
def passed?
|
17
|
+
@passed
|
18
|
+
end
|
19
|
+
|
20
|
+
def wasExecuted?
|
21
|
+
@executed
|
22
|
+
end
|
13
23
|
|
14
24
|
def execute(pageElt)
|
15
25
|
|
26
|
+
@executed=true
|
16
27
|
rc=true
|
17
28
|
cmdList=nil
|
18
29
|
|
@@ -34,11 +45,12 @@ module Scoutui::Commands
|
|
34
45
|
|
35
46
|
def do_until(pageElt)
|
36
47
|
|
37
|
-
|
48
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " do_until : #{pageElt}"
|
38
49
|
|
39
50
|
thenList=nil
|
40
51
|
untilList=nil
|
41
52
|
whenPassed=nil
|
53
|
+
whenFailed=nil
|
42
54
|
_alwaystrue=false
|
43
55
|
|
44
56
|
if pageElt.is_a?(Hash) && pageElt.has_key?('page')
|
@@ -55,6 +67,10 @@ module Scoutui::Commands
|
|
55
67
|
whenPassed=pageElt['page']['whenPassed']
|
56
68
|
end
|
57
69
|
|
70
|
+
if pageElt['page'].has_key?('whenFailed') && pageElt['page']['whenFailed'].is_a?(Array)
|
71
|
+
whenFailed=pageElt['page']['whenFailed']
|
72
|
+
end
|
73
|
+
|
58
74
|
elsif pageElt.is_a?(Hash) && pageElt.has_key?('do') && pageElt.has_key?('until')
|
59
75
|
thenList = pageElt['do']
|
60
76
|
untilList = pageElt['until']
|
@@ -64,6 +80,10 @@ module Scoutui::Commands
|
|
64
80
|
whenPassed=pageElt['whenPassed']
|
65
81
|
end
|
66
82
|
|
83
|
+
if pageElt.has_key?('whenFailed') && pageElt['whenFailed'].is_a?(Array)
|
84
|
+
whenFailed=pageElt['whenFailed']
|
85
|
+
end
|
86
|
+
|
67
87
|
end
|
68
88
|
|
69
89
|
if thenList # !pageElt.nil? && pageElt['page'].has_key?('do') && pageElt['page'].has_key?('until')
|
@@ -107,7 +127,7 @@ module Scoutui::Commands
|
|
107
127
|
|
108
128
|
if _loop && untilList # !pageElt.nil? && pageElt['page'].has_key?('until')
|
109
129
|
|
110
|
-
|
130
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " untilList => #{untilList.class}, #{untilList.size}, #{untilList[0]}"
|
111
131
|
|
112
132
|
if untilList.is_a?(Array) && untilList.size==1 && untilList[0]==true
|
113
133
|
_expected=false
|
@@ -153,9 +173,9 @@ module Scoutui::Commands
|
|
153
173
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ===== end.whenPassed : #{_whenPassed} ====="
|
154
174
|
|
155
175
|
|
156
|
-
elsif !_bUntil && pageElt.has_key?('page') && pageElt['page'].has_key?('whenFailed') && pageElt['page']['whenFailed'].is_a?(Array)
|
176
|
+
elsif !_bUntil && !whenFailed.nil? #pageElt.has_key?('page') && pageElt['page'].has_key?('whenFailed') && pageElt['page']['whenFailed'].is_a?(Array)
|
157
177
|
|
158
|
-
_whenFailed = execute(pageElt['page']['whenFailed'])
|
178
|
+
_whenFailed = execute(whenFailed) # execute(pageElt['page']['whenFailed'])
|
159
179
|
|
160
180
|
elsif _alwaystrue
|
161
181
|
_rc=true
|
@@ -169,10 +189,12 @@ module Scoutui::Commands
|
|
169
189
|
_rc=true
|
170
190
|
end
|
171
191
|
|
172
|
-
_rc
|
192
|
+
@passed=_rc
|
173
193
|
end
|
174
194
|
|
175
195
|
|
196
|
+
|
197
|
+
|
176
198
|
end
|
177
199
|
|
178
200
|
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
|
2
|
+
module Scoutui::Commands
|
3
|
+
|
4
|
+
class WhileDo < Command
|
5
|
+
|
6
|
+
|
7
|
+
def initialize(driver)
|
8
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " WhileDo.init()"
|
9
|
+
@drv=driver
|
10
|
+
@pageElt=nil
|
11
|
+
@passed=true
|
12
|
+
|
13
|
+
@executed_result=nil
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
def execute(pageElt)
|
18
|
+
setResult(while_do(pageElt))
|
19
|
+
end
|
20
|
+
|
21
|
+
def _process(untilList)
|
22
|
+
|
23
|
+
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " _process(#{untilList})"
|
24
|
+
|
25
|
+
|
26
|
+
if untilList.is_a?(Array) && untilList.size==1 && (untilList[0]==true || untilList[0]==false)
|
27
|
+
return untilList[0]
|
28
|
+
end
|
29
|
+
|
30
|
+
rc=Scoutui::Base::VisualTestFramework::processAsserts(@drv, untilList, false)
|
31
|
+
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " _process(#{untilList}) => #{rc}"
|
32
|
+
|
33
|
+
rc
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
def while_do(pageElt)
|
40
|
+
|
41
|
+
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " do_until : #{pageElt}"
|
42
|
+
|
43
|
+
thenList=nil
|
44
|
+
untilList=nil
|
45
|
+
whenPassed=nil
|
46
|
+
whenFailed=nil
|
47
|
+
_alwaystrue=false
|
48
|
+
|
49
|
+
if pageElt.is_a?(Hash) && pageElt.has_key?('page')
|
50
|
+
|
51
|
+
|
52
|
+
if pageElt['page'].has_key?('while') && pageElt['page'].has_key?('do')
|
53
|
+
thenList=pageElt['page']['do']
|
54
|
+
whileList=pageElt['page']['while']
|
55
|
+
elsif pageElt['page'].has_key?('do')
|
56
|
+
thenList=pageElt['page']['do']
|
57
|
+
end
|
58
|
+
|
59
|
+
if pageElt['page'].has_key?('whenPassed') && pageElt['page']['whenPassed'].is_a?(Array)
|
60
|
+
whenPassed=pageElt['page']['whenPassed']
|
61
|
+
end
|
62
|
+
|
63
|
+
if pageElt['page'].has_key?('whenFailed') && pageElt['page']['whenFailed'].is_a?(Array)
|
64
|
+
whenFailed=pageElt['page']['whenFailed']
|
65
|
+
end
|
66
|
+
|
67
|
+
elsif pageElt.is_a?(Hash) && pageElt.has_key?('while') && pageElt.has_key?('do')
|
68
|
+
thenList = pageElt['do']
|
69
|
+
whileList = pageElt['while']
|
70
|
+
|
71
|
+
|
72
|
+
if pageElt.has_key?('whenPassed') && pageElt['whenPassed'].is_a?(Array)
|
73
|
+
whenPassed=pageElt['whenPassed']
|
74
|
+
end
|
75
|
+
|
76
|
+
if pageElt.has_key?('whenFailed') && pageElt['whenFailed'].is_a?(Array)
|
77
|
+
whenFailed=pageElt['whenFailed']
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
if thenList # !pageElt.nil? && pageElt['page'].has_key?('do') && pageElt['page'].has_key?('until')
|
83
|
+
|
84
|
+
_max = 25
|
85
|
+
_i=0
|
86
|
+
_historyElts={}
|
87
|
+
|
88
|
+
begin
|
89
|
+
while (_i < _max) && _process(whileList) do
|
90
|
+
|
91
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " == process #{_i}. #{thenList}"
|
92
|
+
|
93
|
+
rc=Scoutui::Commands.simpleCommands(@drv, thenList)
|
94
|
+
|
95
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " == returned process #{_i} => #{rc}"
|
96
|
+
_i+=1
|
97
|
+
|
98
|
+
|
99
|
+
end # while()
|
100
|
+
|
101
|
+
rescue => ex
|
102
|
+
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Error during processing: #{ex.message}"
|
103
|
+
Scoutui::Logger::LogMgr.instance.warn "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
107
|
+
|
108
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ==== While Do Pause"; #STDIN.gets
|
109
|
+
|
110
|
+
setResult(@passed)
|
111
|
+
end
|
112
|
+
|
113
|
+
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
@@ -64,7 +64,7 @@ module Scoutui::Commands
|
|
64
64
|
# _locator = Scoutui::Base::UserVars.instance.get(_locator)
|
65
65
|
_locator = Scoutui::Base::UserVars.instance.normalize(_locator)
|
66
66
|
|
67
|
-
Scoutui::Logger::LogMgr.instance.command.
|
67
|
+
Scoutui::Logger::LogMgr.instance.command.debug __FILE__ + (__LINE__).to_s + " | translate : #{_locator}"
|
68
68
|
|
69
69
|
_clicked=false
|
70
70
|
|
@@ -96,7 +96,13 @@ module Scoutui::Commands
|
|
96
96
|
|
97
97
|
if isEnabled # && obj.is_a?(Selenium::WebDriver::Element)
|
98
98
|
|
99
|
-
|
99
|
+
begin
|
100
|
+
@drv.action.move_to(obj).perform
|
101
|
+
rescue => ex
|
102
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{ex.class.to_s}"
|
103
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + ex.backtrace.join("\n\t")
|
104
|
+
end
|
105
|
+
|
100
106
|
bm=Benchmark.measure {
|
101
107
|
obj.click
|
102
108
|
}
|
@@ -52,6 +52,7 @@ module Scoutui::Commands
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def setResult(r)
|
55
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " setResult(#{r}) - #{@cmd.to_s}"
|
55
56
|
Scoutui::Logger::LogMgr.instance.commands.debug " #{@cmd.to_s} : setResult(#{r.to_s})"
|
56
57
|
@executed=true
|
57
58
|
@executed_result=r
|
@@ -33,6 +33,10 @@ module Scoutui::Commands
|
|
33
33
|
if _subcmd.match(/^\s*press\(__TAB__\)$/)
|
34
34
|
drv.action.send_keys(:tab).perform
|
35
35
|
|
36
|
+
elsif Scoutui::Commands::Utils.instance.isHighlight?(_subcmd)
|
37
|
+
|
38
|
+
processCommand(_subcmd, nil, drv)
|
39
|
+
|
36
40
|
elsif _subcmd.match(/^\s*press\(__SHIFT_TAB__\)\s*$/)
|
37
41
|
drv.action.key_down(:shift).send_keys(:tab).perform;
|
38
42
|
drv.action.key_up(:shift).perform;
|
@@ -138,7 +142,7 @@ module Scoutui::Commands
|
|
138
142
|
|
139
143
|
_text=_subcmd.match(/^\s*[fF]ocused.[Tt]ype[!]*\((.*)\)$/)[1].to_s
|
140
144
|
|
141
|
-
|
145
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " => #{_text} is empty : #{_text.empty?}"
|
142
146
|
|
143
147
|
|
144
148
|
_activeElt.send_keys(_text)
|
@@ -154,6 +158,9 @@ module Scoutui::Commands
|
|
154
158
|
#_c = Scoutui::Commands::ClickObject.new(_subcmd)
|
155
159
|
#_c.run(driver: drv)
|
156
160
|
|
161
|
+
elsif Scoutui::Commands::Utils.instance.isPause?(_subcmd)
|
162
|
+
processCommand(_subcmd, nil, drv)
|
163
|
+
|
157
164
|
elsif _subcmd.match(/^\s*select\((.*)\)\s*$/)
|
158
165
|
|
159
166
|
_c=Scoutui::Commands.processCommand(_subcmd, nil, drv)
|
@@ -243,7 +250,25 @@ module Scoutui::Commands
|
|
243
250
|
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " WebDriverError.switch_to.alert"
|
244
251
|
end
|
245
252
|
|
246
|
-
if Scoutui::Commands::Utils.instance.
|
253
|
+
if Scoutui::Commands::Utils.instance.isWhileDo?(_action)
|
254
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " === WhileDo ==="
|
255
|
+
_cmd='whileDo'
|
256
|
+
_c = Scoutui::Commands::WhileDo.new(my_driver)
|
257
|
+
_c.execute(e['page']['action'])
|
258
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " WHileDo Pause post-execute"; #STDIN.gets
|
259
|
+
|
260
|
+
elsif Scoutui::Commands::Utils.instance.isDoUntil?(_action)
|
261
|
+
|
262
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " == process DoUntil : #{e}"
|
263
|
+
_cmd='doUntil'
|
264
|
+
_c = Scoutui::Commands::DoUntil.new(my_driver)
|
265
|
+
_c.do_until(e['page']['action'])
|
266
|
+
|
267
|
+
|
268
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Pause on DO_UNTIL => #{_c} passed? : #{_c.passed?}"; # STDIN.gets
|
269
|
+
|
270
|
+
|
271
|
+
elsif Scoutui::Commands::Utils.instance.isPause?(_action)
|
247
272
|
_cmd='pause'
|
248
273
|
_c = Scoutui::Commands::Pause.new(nil)
|
249
274
|
_c.execute(e);
|
@@ -287,7 +312,8 @@ module Scoutui::Commands
|
|
287
312
|
if e['page'].has_key?('vars')
|
288
313
|
e['page']['vars'].each do |_a|
|
289
314
|
|
290
|
-
Scoutui::Logger::LogMgr.instance.debug
|
315
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " process assign var: #{_a}"
|
316
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Process Assignment.var : #{_a}"
|
291
317
|
|
292
318
|
begin
|
293
319
|
_caborted=false
|
@@ -299,9 +325,13 @@ module Scoutui::Commands
|
|
299
325
|
|
300
326
|
_c = Scoutui::Commands::AssignVar.new(_a)
|
301
327
|
_rc=_c.run(driver: my_driver, dut: e)
|
302
|
-
|
328
|
+
# _c.setResult(_rc)
|
329
|
+
|
330
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{_a} => #{_rc}"
|
303
331
|
rescue => ex
|
304
332
|
_caborted=true
|
333
|
+
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " #{ex.class.to_s} : Error during processing: #{ex.message}"
|
334
|
+
Scoutui::Logger::LogMgr.instance.warn " Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
|
305
335
|
end
|
306
336
|
|
307
337
|
_testcase = Scoutui::Utils::TestUtils.instance.getTC() || _cmd.downcase
|
@@ -312,6 +342,7 @@ module Scoutui::Commands
|
|
312
342
|
|
313
343
|
|
314
344
|
elsif Scoutui::Commands::Utils.instance.isAssignVar?(_action)
|
345
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " == AssignVar : #{_action}"
|
315
346
|
_cmd='assignvar'
|
316
347
|
_c = Scoutui::Commands::AssignVar.new(_action)
|
317
348
|
_c.run(driver: my_driver, dut: e)
|
@@ -16,7 +16,7 @@ module Scoutui::Commands
|
|
16
16
|
'__TAB__' => { :val => :tab },
|
17
17
|
'__SHIFT_TAB__' => {:val => :custom,
|
18
18
|
:run => lambda { |drv|
|
19
|
-
|
19
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " *** SHIFT_TAB ***"
|
20
20
|
drv.action.key_down(:shift).send_keys(:tab).perform;
|
21
21
|
drv.action.key_up(:shift).perform;
|
22
22
|
}}
|
@@ -99,6 +99,8 @@ module Scoutui::Commands
|
|
99
99
|
|
100
100
|
if KEYBOARD_CMDS.has_key?(_val)
|
101
101
|
_val = KEYBOARD_CMDS[_val][:val]
|
102
|
+
else
|
103
|
+
_val=Scoutui::Base::UserVars.instance.normalize(_val)
|
102
104
|
end
|
103
105
|
|
104
106
|
_xpath="[focused]"
|
@@ -55,6 +55,8 @@ module Scoutui::Commands
|
|
55
55
|
Testmgr::TestReport.instance.getReq(_req).testcase(_testcase).add(_rc, Scoutui::Base::UserVars.instance.normalize("Verify navigate to url #{normUrl}"), _duration)
|
56
56
|
|
57
57
|
|
58
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " update_url => #{_rc}"
|
59
|
+
|
58
60
|
setResult(_rc)
|
59
61
|
|
60
62
|
end
|
@@ -16,6 +16,7 @@ module Scoutui::Commands
|
|
16
16
|
@command_list=['pause',
|
17
17
|
'assignvar',
|
18
18
|
'assignments',
|
19
|
+
'doUntil',
|
19
20
|
'existsAlert',
|
20
21
|
'clickJsAlert',
|
21
22
|
'dumpvars',
|
@@ -40,7 +41,8 @@ module Scoutui::Commands
|
|
40
41
|
'uploadfiles',
|
41
42
|
'verifyelt',
|
42
43
|
'verifyelement',
|
43
|
-
'verifyform'
|
44
|
+
'verifyform',
|
45
|
+
'whileDo']
|
44
46
|
@totalCommands={}
|
45
47
|
@timeout=30
|
46
48
|
@command_list.each do |c|
|
@@ -228,120 +230,132 @@ module Scoutui::Commands
|
|
228
230
|
@timeout.to_i
|
229
231
|
end
|
230
232
|
|
233
|
+
def isDoUntil?(_action)
|
234
|
+
_action.is_a?(Hash) && _action.has_key?('do') && !_action.has_key?('while')
|
235
|
+
end
|
236
|
+
|
237
|
+
def isWhileDo?(_action)
|
238
|
+
_action.is_a?(Hash) && _action.has_key?('while') && _action.has_key?('do')
|
239
|
+
end
|
240
|
+
|
231
241
|
def isAssignments?(_action)
|
232
|
-
!_action.match(/^\s*(assignments)\s*$/).nil?
|
242
|
+
_action.is_a?(String) && !_action.match(/^\s*(assignments)\s*$/).nil?
|
233
243
|
end
|
234
244
|
|
235
245
|
def isAssignVar?(_action)
|
236
|
-
!_action.match(/assign\(([\w]+)\s*\,(.*)\)\s*$/i).nil?
|
246
|
+
_action.is_a?(String) && !_action.match(/assign\(([\w]+)\s*\,(.*)\)\s*$/i).nil?
|
237
247
|
end
|
238
248
|
|
239
249
|
def isSelectWindow?(_action)
|
240
|
-
!_action.match(/^\s*select_window/i).nil?
|
250
|
+
_action.is_a?(String) && !_action.match(/^\s*select_window/i).nil?
|
241
251
|
end
|
242
252
|
|
243
253
|
def isExistsAlert?(_action)
|
244
|
-
!_action.match(/(exist[s]*_*alert|existAlert|existsAlert|existsJsAlert|existsJsConfirm|existsJsPrompt)\(/i).nil?
|
254
|
+
_action.is_a?(String) && !_action.match(/(exist[s]*_*alert|existAlert|existsAlert|existsJsAlert|existsJsConfirm|existsJsPrompt)\(/i).nil?
|
245
255
|
end
|
246
256
|
|
247
257
|
def isFrame?(_action)
|
248
|
-
_action.match(/^\s*(frame|switchframe|switch_frame)\s*\(/i)
|
258
|
+
_action.is_a?(String) && _action.match(/^\s*(frame|switchframe|switch_frame)\s*\(/i)
|
249
259
|
end
|
250
260
|
|
251
261
|
def isHighlight?(_action)
|
252
|
-
_action.match(/^\s*(highlight)/i)
|
262
|
+
_action.is_a?(String) && _action.match(/^\s*(highlight)/i)
|
253
263
|
end
|
254
264
|
|
255
265
|
def isVerifyElt?(_action)
|
256
|
-
!_action.match(/(verifyelt|verifyelement)\(/i).nil?
|
266
|
+
_action.is_a?(String) && !_action.match(/(verifyelt|verifyelement)\(/i).nil?
|
257
267
|
end
|
258
268
|
|
259
269
|
def isClick?(_action)
|
260
|
-
!_action.match(/click\(/i).nil?
|
270
|
+
_action.is_a?(String) && !_action.match(/click\(/i).nil?
|
261
271
|
end
|
262
272
|
|
263
273
|
def isGetAlert?(_action)
|
264
|
-
!_action.match(/(get_*alert|clickjsconfirm|clickjsprompt|clickjsalert)/i).nil?
|
274
|
+
_action.is_a?(String) && !_action.match(/(get_*alert|clickjsconfirm|clickjsprompt|clickjsalert)/i).nil?
|
265
275
|
end
|
266
276
|
|
267
277
|
def isFillForm?(_action)
|
268
|
-
!_action.match(/fillform\(/i).nil?
|
278
|
+
_action.is_a?(String) && !_action.match(/fillform\(/i).nil?
|
269
279
|
end
|
270
280
|
|
271
281
|
def isConnect?(_action)
|
272
|
-
!_action.match(/^\s*connect\s*$/i).nil?
|
282
|
+
_action.is_a?(String) && !_action.match(/^\s*connect\s*$/i).nil?
|
273
283
|
end
|
274
284
|
|
275
285
|
def isDumpVars?(_action)
|
276
|
-
!_action.match(/^\s*dumpvars\s*$/i).nil?
|
286
|
+
_action.is_a?(String) && !_action.match(/^\s*dumpvars\s*$/i).nil?
|
277
287
|
end
|
278
288
|
|
279
289
|
def isLoadDB?(_action)
|
280
|
-
!_action.match(/^\s*loaddb\s*$/i).nil?
|
290
|
+
_action.is_a?(String) && !_action.match(/^\s*loaddb\s*$/i).nil?
|
281
291
|
end
|
282
292
|
|
283
293
|
def isExecuteCommands?(_action)
|
284
|
-
!_action.match(/^\s*executecommand[s]*\s*$/i).nil?
|
294
|
+
_action.is_a?(String) && !_action.match(/^\s*executecommand[s]*\s*$/i).nil?
|
285
295
|
end
|
286
296
|
|
287
297
|
def isDefineCommands?(_action)
|
288
|
-
!_action.match(/^\s*definecommand[s]*\s*$/i).nil?
|
298
|
+
_action.is_a?(String) && !_action.match(/^\s*definecommand[s]*\s*$/i).nil?
|
289
299
|
end
|
290
300
|
|
291
301
|
def isLoadData?(_action)
|
292
|
-
!_action.match(/^\s*loaddata\s*$/i).nil?
|
302
|
+
_action.is_a?(String) && !_action.match(/^\s*loaddata\s*$/i).nil?
|
293
303
|
end
|
294
304
|
|
295
305
|
def isLoadJs?(_action)
|
296
|
-
!_action.match(/^\s*loadjs\s*$/i).nil?
|
306
|
+
_action.is_a?(String) && !_action.match(/^\s*loadjs\s*$/i).nil?
|
297
307
|
end
|
298
308
|
|
299
309
|
|
300
310
|
def isLoadRequirements?(_action)
|
301
|
-
!_action.match(/^\s*loadrequirements\s*$/i).nil?
|
311
|
+
_action.is_a?(String) && !_action.match(/^\s*loadrequirements\s*$/i).nil?
|
302
312
|
end
|
303
313
|
|
304
314
|
def isMouseOver?(_action)
|
305
|
-
!_action.match(/mouseover\(/).nil?
|
315
|
+
_action.is_a?(String) && !_action.match(/mouseover\(/).nil?
|
306
316
|
end
|
307
317
|
|
308
318
|
def isType?(_action)
|
309
|
-
!_action.match(/type[\!]*\(/).nil?
|
319
|
+
_action.is_a?(String) && !_action.match(/type[\!]*\(/).nil?
|
310
320
|
end
|
311
321
|
|
312
322
|
def isSubmitForm?(_action)
|
313
|
-
!_action.match(/submitform\(/).nil?
|
323
|
+
_action.is_a?(String) && !_action.match(/submitform\(/).nil?
|
314
324
|
end
|
315
325
|
|
316
326
|
def isVerifyForm?(_action)
|
317
|
-
!_action.match(/verifyform\(/).nil?
|
327
|
+
_action.is_a?(String) && !_action.match(/verifyform\(/).nil?
|
318
328
|
end
|
319
329
|
|
320
330
|
def isPause?(_action)
|
321
|
-
!_action.match(/pause/).nil?
|
331
|
+
_action.is_a?(String) && !_action.match(/pause/).nil?
|
322
332
|
end
|
323
333
|
|
324
334
|
def isSelect?(_action)
|
325
|
-
!_action.nil? && _action.match(/^\s*select\s*\(/i)
|
335
|
+
!_action.nil? && _action.is_a?(String) && _action.match(/^\s*select\s*\(/i)
|
326
336
|
end
|
327
337
|
|
328
338
|
def isSleep?(_action)
|
329
|
-
!_action.nil? && _action.match(/^\s*sleep\s*\(\s*\d+\s*\)\s*$/i)
|
339
|
+
!_action.nil? && _action.is_a?(String) && _action.match(/^\s*sleep\s*\(\s*\d+\s*\)\s*$/i)
|
330
340
|
end
|
331
341
|
|
332
342
|
def isUploadFiles?(_action)
|
333
|
-
!_action.nil? && _action.match(/^\s*uploadfiles\s*$/i)
|
343
|
+
!_action.nil? && _action.is_a?(String) && _action.match(/^\s*uploadfiles\s*$/i)
|
334
344
|
end
|
335
345
|
|
336
346
|
def isNavigate?(_action)
|
337
|
-
!_action.nil? && _action.match(/(navigate|url)\(/i)
|
347
|
+
!_action.nil? && _action.is_a?(String) && _action.match(/(navigate|url)\(/i)
|
338
348
|
end
|
339
349
|
|
340
350
|
def isValid?(cmd)
|
341
351
|
|
342
352
|
rc=true
|
343
353
|
|
344
|
-
if
|
354
|
+
if isDoUntil?(cmd)
|
355
|
+
@totalCommands['doUntil']+=1
|
356
|
+
elsif isWhileDo?(cmd)
|
357
|
+
@totalCommands['whileDo']+=1
|
358
|
+
elsif isPause?(cmd)
|
345
359
|
@totalCommands['pause']+=1
|
346
360
|
elsif isAssignVar?(cmd)
|
347
361
|
@totalCommands['assignvar']+=1
|
data/lib/scoutui/version.rb
CHANGED
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.5.
|
4
|
+
version: 2.0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Kim
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -251,6 +251,7 @@ files:
|
|
251
251
|
- lib/scoutui/commands/assign_var.rb
|
252
252
|
- lib/scoutui/commands/clauses/do_until.rb
|
253
253
|
- lib/scoutui/commands/clauses/then_clause.rb
|
254
|
+
- lib/scoutui/commands/clauses/while_do.rb
|
254
255
|
- lib/scoutui/commands/click_object.rb
|
255
256
|
- lib/scoutui/commands/command.rb
|
256
257
|
- lib/scoutui/commands/commands.rb
|