scoutui 2.0.5.1.1.pre → 2.0.5.2
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 +4 -4
- data/.gitignore +4 -2
- data/README.md +0 -7
- data/examples/ex1/phantom.chrome.json +4 -0
- data/examples/ex1/run.sh +85 -0
- data/examples/ex1/simple.yml +13 -0
- data/examples/ex1/win10.chromebeta.json +6 -0
- data/lib/scoutui/appmodel/q_model.rb +5 -0
- data/lib/scoutui/base/assertions.rb +49 -11
- data/lib/scoutui/base/q_browser.rb +181 -15
- data/lib/scoutui/base/q_har_mgr.rb +63 -0
- data/lib/scoutui/base/test_data.rb +0 -2
- data/lib/scoutui/base/test_scout.rb +2 -1
- data/lib/scoutui/base/user_vars.rb +1 -1
- data/lib/scoutui/base/visual_test_framework.rb +78 -15
- data/lib/scoutui/commands/clauses/do_until.rb +25 -6
- data/lib/scoutui/commands/clauses/then_clause.rb +12 -0
- data/lib/scoutui/commands/click_object.rb +5 -2
- data/lib/scoutui/commands/commands.rb +85 -10
- data/lib/scoutui/commands/highlight.rb +72 -21
- data/lib/scoutui/commands/mouse_over.rb +4 -2
- data/lib/scoutui/commands/pause.rb +9 -2
- data/lib/scoutui/commands/strategy.rb +21 -2
- data/lib/scoutui/commands/type.rb +40 -5
- data/lib/scoutui/eyes/eye_scout.rb +2 -1
- data/lib/scoutui/utils/utils.rb +9 -0
- data/lib/scoutui/version.rb +1 -1
- data/scoutui.gemspec +2 -3
- metadata +15 -59
- data/bin/scoutui_driver +0 -1
- data/examples/benchmark/ex.rb +0 -16
- data/examples/capabilities/win10.chrome46.json +0 -6
- data/examples/carmax/appmodel/search_results.json +0 -27
- data/examples/carmax/commands/commands.yml +0 -63
- data/examples/cmdshell/commands/hello.yml +0 -22
- data/examples/converters/jsonupdate.rb +0 -31
- data/examples/ex2/appmodel/common.json +0 -51
- data/examples/ex2/appmodel/page_model.json +0 -106
- data/examples/ex2/appmodel/register.model.json +0 -42
- data/examples/ex2/commands/commands.basic.appmodel.yml +0 -8
- data/examples/ex2/commands/commands.yml +0 -115
- data/examples/ex2/commands/ex1.yml +0 -7
- data/examples/ex2/commands/ex1c.yml +0 -8
- data/examples/ex2/commands/ex1d.yml +0 -22
- data/examples/ex2/commands/ex2.hover.yml +0 -43
- data/examples/ex2/commands/ex2.yml +0 -24
- data/examples/ex2/data.json +0 -6
- data/examples/ex2/test-configs/test.config.basic.json +0 -12
- data/examples/ex2/test-configs/test.config.json +0 -31
- data/examples/ex2/tests/run-test.sh +0 -125
- data/examples/ex2/tests/test-basic-appmodel.sh +0 -14
- data/examples/ex2/tests/test-example.sh +0 -39
- data/examples/ex2/tests/test-example1a.sh +0 -16
- data/examples/ex2/tests/test-example1b.sh +0 -13
- data/examples/ex2/tests/test-example1c.sh +0 -15
- data/examples/ex2/tests/test-example1d.sh +0 -15
- data/examples/ex2/tests/test-example2.forms.eyes.sh +0 -40
- data/examples/ex2/tests/test-example2.hover.eyes.sh +0 -40
- data/examples/ex2/tests/test-example2.hover.sh +0 -26
- data/examples/ex2/tests/test-example2.sh +0 -43
- data/examples/ex2/tests/test-example3.sauce.sh +0 -77
- data/examples/ex2/tests/test-example3.sh +0 -41
- data/examples/headless/run.sh +0 -15
- data/examples/http/sendreq.rb +0 -29
@@ -16,17 +16,18 @@ module Scoutui::Base
|
|
16
16
|
_saveScreenAs=Scoutui::Utils::TestUtils.instance.sanitize_filename(_name)
|
17
17
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ScreenSave : #{_saveScreenAs}"
|
18
18
|
|
19
|
+
_dir = Scoutui::Utils::TestUtils.instance.screenShotsDir
|
19
20
|
rc=false
|
20
21
|
begin
|
21
22
|
|
22
|
-
if !File.directory?(
|
23
|
+
if !_dir.nil? && !File.directory?(_dir)
|
23
24
|
FileUtils::mkdir_p Scoutui::Utils::TestUtils.instance.screenShotsDir
|
24
25
|
end
|
25
26
|
|
26
|
-
|
27
|
-
|
27
|
+
_dir='.' if _dir.nil?
|
28
|
+
_fullPath=_dir + '/' + _saveScreenAs + '.png'
|
29
|
+
rc=Scoutui::Base::QBrowser.saveScreenShot(drv, _fullPath)
|
28
30
|
|
29
|
-
rc=true
|
30
31
|
rescue => ex
|
31
32
|
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Error during processing screenshot with name #{_name.to_s}: #{ex}"
|
32
33
|
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
|
@@ -138,7 +139,11 @@ module Scoutui::Base
|
|
138
139
|
|
139
140
|
# _locator = Scoutui::Utils::TestUtils.instance.getPageElement(_v['locator'])
|
140
141
|
|
141
|
-
|
142
|
+
if _v.has_key?('frame')
|
143
|
+
_obj=Scoutui::Base::QBrowser.findElementwithinFrame(my_driver, _locator, _v['frame'], Scoutui::Commands::Utils.instance.getTimeout)
|
144
|
+
else
|
145
|
+
_obj = Scoutui::Base::QBrowser.getFirstObject(my_driver, _locator, Scoutui::Commands::Utils.instance.getTimeout())
|
146
|
+
end
|
142
147
|
|
143
148
|
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " HIT #{_locator} => #{(!_obj.nil?).to_s}"
|
144
149
|
end
|
@@ -434,7 +439,7 @@ module Scoutui::Base
|
|
434
439
|
_bm=Benchmark.measure {
|
435
440
|
_rc=Scoutui::Base::Assertions.instance.isEnabled?(my_driver, _a)
|
436
441
|
}
|
437
|
-
elsif _assertType[:cmd]
|
442
|
+
elsif _assertType[:cmd].match(/(url|isUrl)/)
|
438
443
|
_bm=Benchmark.measure {
|
439
444
|
_rc=Scoutui::Base::Assertions.instance.isUrlMatch(my_driver, _a)
|
440
445
|
}
|
@@ -459,9 +464,55 @@ module Scoutui::Base
|
|
459
464
|
_rc=Scoutui::Base::Assertions.instance.isTitle(my_driver, _a)
|
460
465
|
}
|
461
466
|
|
467
|
+
|
468
|
+
elsif _a.match(/^\s*focused\(.*\)\s*$/)
|
469
|
+
|
470
|
+
_locator = _a.match(/^\s*focused\((.*)\)\s*$/)[1]
|
471
|
+
|
472
|
+
_bm=Benchmark.measure {
|
473
|
+
_activeElt = my_driver.switch_to.active_element
|
474
|
+
obj = Scoutui::Base::QBrowser.getElement(my_driver,
|
475
|
+
_locator,
|
476
|
+
Scoutui::Commands::Utils.instance.getFrameSearch(),
|
477
|
+
Scoutui::Commands::Utils.instance.getTimeout)
|
478
|
+
|
479
|
+
_rc = (obj==_activeElt)
|
480
|
+
}
|
481
|
+
|
482
|
+
if _rc
|
483
|
+
puts __FILE__ + (__LINE__).to_s + " focused() - MATCHED"
|
484
|
+
end
|
485
|
+
|
486
|
+
elsif _a.match(/^\s*(focused\.[Vv]alue\((.*)\))\s*$/)
|
487
|
+
_expectedValue = _a.match(/^\s*(focused.[Vv]alue\((.*)\))\s*$/)[2].to_s
|
488
|
+
_activeElt=nil
|
489
|
+
_value=nil
|
490
|
+
|
491
|
+
_bm=Benchmark.measure {
|
492
|
+
_activeElt = my_driver.switch_to.active_element
|
493
|
+
_value=_activeElt.attribute('value')
|
494
|
+
|
495
|
+
if !_activeElt.nil? && _value
|
496
|
+
|
497
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " activeElt.value : |#{_value.to_s}|"
|
498
|
+
|
499
|
+
_rc=!(_value.to_s.match(/#{_expectedValue}/).nil?)
|
500
|
+
end
|
501
|
+
}
|
502
|
+
|
503
|
+
if _activeElt.is_a?(Selenium::WebDriver::Element)
|
504
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ASSERT: focusValue: #{_expectedValue} vs #{_value} => #{_rc}"
|
505
|
+
end
|
506
|
+
|
507
|
+
|
508
|
+
|
462
509
|
elsif _a.match(/^\s*(focused\.[Tt]ext\((.*)\))\s*$/)
|
463
510
|
|
464
511
|
_targetTxt = _a.match(/^\s*(focused.[Tt]ext\((.*)\))\s*$/)[2].to_s
|
512
|
+
|
513
|
+
|
514
|
+
_targetTxt = Scoutui::Base::UserVars.instance.normalize(_targetTxt)
|
515
|
+
|
465
516
|
_activeElt=nil
|
466
517
|
|
467
518
|
_bm=Benchmark.measure {
|
@@ -475,7 +526,7 @@ module Scoutui::Base
|
|
475
526
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " activeElt.value : |#{_activeElt.attribute('value').to_s}|"
|
476
527
|
end
|
477
528
|
|
478
|
-
_rc=!(_activeElt.text.to_s.match(/#{_targetTxt}/).nil?)
|
529
|
+
_rc=!(_activeElt.text.to_s.match(/#{_targetTxt}/).nil?) # || _activeElt.text.to_s==_targetTxt.to_s
|
479
530
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " FocusedText : #{_activeElt.text} => #{_rc}"
|
480
531
|
end
|
481
532
|
}
|
@@ -731,23 +782,31 @@ module Scoutui::Base
|
|
731
782
|
end
|
732
783
|
|
733
784
|
# Not Visible
|
734
|
-
if !xpath.match(/^\s
|
785
|
+
if !xpath.match(/^\s*[!]*visible\(.*\)$/).nil?
|
735
786
|
_rc = false
|
736
787
|
_e=nil
|
737
788
|
_timeout=12
|
789
|
+
_msg="is visible"
|
790
|
+
|
791
|
+
if xpath.match(/^\s*!visible/)
|
792
|
+
_msg="is not visible"
|
793
|
+
end
|
738
794
|
|
739
|
-
if xpath.match(/^\s
|
740
|
-
_e = xpath.match(/^\s
|
741
|
-
_timeout=xpath.match(/^\s
|
795
|
+
if xpath.match(/^\s*[!]*visible\((.*,\s*\d+\s*)\)$/)
|
796
|
+
_e = xpath.match(/^\s*[!]*visible\((.*),\s*\d+\s*\)$/)[1].to_s.strip
|
797
|
+
_timeout=xpath.match(/^\s*[!]*visible\((.*),\s*(\d+)\s*\)$/)[2].to_i
|
742
798
|
else
|
743
|
-
_e = xpath.match(/^\s
|
799
|
+
_e = xpath.match(/^\s*[!]*visible\((.*)\)$/)[1].to_s.strip
|
744
800
|
end
|
745
801
|
|
746
802
|
_obj = Scoutui::Base::QBrowser.getObject(my_driver, _e, Scoutui::Commands::Utils.instance.getTimeout)
|
747
803
|
|
748
804
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Wait until element #{xpath} => #{_e} is not visible #{_obj}.class.to_s"
|
749
805
|
|
750
|
-
if _obj.nil?
|
806
|
+
if _obj.nil? && xpath.match(/^\s*!visible\((.*)\)$/)
|
807
|
+
_rc = true
|
808
|
+
|
809
|
+
elsif !_obj.nil? && xpath.match(/^\s*visible\((.*)\)$/)
|
751
810
|
_rc = true
|
752
811
|
else
|
753
812
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " _obj => #{_obj} : exists: #{!_obj.nil?}"
|
@@ -767,9 +826,9 @@ module Scoutui::Base
|
|
767
826
|
|
768
827
|
end
|
769
828
|
|
770
|
-
Scoutui::Logger::LogMgr.instance.asserts.info __FILE__ + (__LINE__).to_s + " Verify #{_e} -
|
829
|
+
Scoutui::Logger::LogMgr.instance.asserts.info __FILE__ + (__LINE__).to_s + " Verify #{_e} - #{_msg} - #{_rc}"
|
771
830
|
if Scoutui::Utils::TestUtils.instance.assertExpected?
|
772
|
-
Testmgr::TestReport.instance.getReq(_req).get_child('visible_when').add(_rc, "Verify #{_e} -
|
831
|
+
Testmgr::TestReport.instance.getReq(_req).get_child('visible_when').add(_rc, "Verify #{_e} - #{_msg}")
|
773
832
|
end
|
774
833
|
|
775
834
|
next
|
@@ -1518,6 +1577,10 @@ module Scoutui::Base
|
|
1518
1577
|
eyeScout.getStrategy().processCommand('navigate(' + url + ')', e)
|
1519
1578
|
end
|
1520
1579
|
|
1580
|
+
## 5150 Do-Until
|
1581
|
+
doUntil = Scoutui::Commands::DoUntil.new(my_driver)
|
1582
|
+
_bUntil = doUntil.do_until(e[STEP_KEY])
|
1583
|
+
|
1521
1584
|
Scoutui::Logger::LogMgr.instance.info "\to Expected: #{e[STEP_KEY]['expected'].class.to_s}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
1522
1585
|
|
1523
1586
|
processExpected(my_driver, e)
|
@@ -19,6 +19,8 @@ module Scoutui::Commands
|
|
19
19
|
if !pageElt.nil? && pageElt.is_a?(Hash) && pageElt.has_key?('page') && pageElt['page'].has_key?('do')
|
20
20
|
@pageElt=pageElt
|
21
21
|
cmdList=pageElt['page']['do']
|
22
|
+
elsif !pageElt.nil? && pageElt.is_a?(Hash) && pageElt.has_key?('do')
|
23
|
+
cmdList=pageElt['do']
|
22
24
|
elsif pageElt.is_a?(Array)
|
23
25
|
cmdList=pageElt
|
24
26
|
end
|
@@ -32,20 +34,36 @@ module Scoutui::Commands
|
|
32
34
|
|
33
35
|
def do_until(pageElt)
|
34
36
|
|
37
|
+
puts __FILE__ + (__LINE__).to_s + " do_until : #{pageElt}"
|
38
|
+
|
35
39
|
thenList=nil
|
36
40
|
untilList=nil
|
41
|
+
whenPassed=nil
|
37
42
|
_alwaystrue=false
|
38
43
|
|
39
44
|
if pageElt.is_a?(Hash) && pageElt.has_key?('page')
|
40
45
|
|
46
|
+
|
41
47
|
if pageElt['page'].has_key?('do') && pageElt['page'].has_key?('until')
|
42
48
|
thenList=pageElt['page']['do']
|
43
49
|
untilList=pageElt['page']['until']
|
50
|
+
elsif pageElt['page'].has_key?('do')
|
51
|
+
thenList=pageElt['page']['do']
|
52
|
+
end
|
53
|
+
|
54
|
+
if pageElt['page'].has_key?('whenPassed') && pageElt['page']['whenPassed'].is_a?(Array)
|
55
|
+
whenPassed=pageElt['page']['whenPassed']
|
44
56
|
end
|
45
57
|
|
46
58
|
elsif pageElt.is_a?(Hash) && pageElt.has_key?('do') && pageElt.has_key?('until')
|
47
59
|
thenList = pageElt['do']
|
48
60
|
untilList = pageElt['until']
|
61
|
+
|
62
|
+
|
63
|
+
if pageElt.has_key?('whenPassed') && pageElt['whenPassed'].is_a?(Array)
|
64
|
+
whenPassed=pageElt['whenPassed']
|
65
|
+
end
|
66
|
+
|
49
67
|
end
|
50
68
|
|
51
69
|
if thenList # !pageElt.nil? && pageElt['page'].has_key?('do') && pageElt['page'].has_key?('until')
|
@@ -78,7 +96,7 @@ module Scoutui::Commands
|
|
78
96
|
|
79
97
|
|
80
98
|
if _historyElts.size > 0 && _historyElts.has_key?(_activeElt)
|
81
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "****** WRAPPED ******"
|
99
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "****** WRAPPED (#{_historyElts.size}) #{_historyElts.has_key?(_activeElt)} ******"
|
82
100
|
|
83
101
|
_loop=false
|
84
102
|
else
|
@@ -127,15 +145,15 @@ module Scoutui::Commands
|
|
127
145
|
_rc=_bUntil
|
128
146
|
|
129
147
|
|
130
|
-
if _bUntil && pageElt['page'].has_key?('whenPassed') && pageElt['page']['whenPassed'].is_a?(Array)
|
148
|
+
if _bUntil && whenPassed.is_a?(Array) #pageElt['page'].has_key?('whenPassed') && pageElt['page']['whenPassed'].is_a?(Array)
|
131
149
|
|
132
150
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ==== whenPassed #{_rc} ======="
|
133
|
-
_whenPassed = execute(
|
151
|
+
_whenPassed = execute(whenPassed)
|
134
152
|
|
135
153
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ===== end.whenPassed : #{_whenPassed} ====="
|
136
154
|
|
137
155
|
|
138
|
-
elsif !_bUntil && pageElt['page'].has_key?('whenFailed') && pageElt['page']['whenFailed'].is_a?(Array)
|
156
|
+
elsif !_bUntil && pageElt.has_key?('page') && pageElt['page'].has_key?('whenFailed') && pageElt['page']['whenFailed'].is_a?(Array)
|
139
157
|
|
140
158
|
_whenFailed = execute(pageElt['page']['whenFailed'])
|
141
159
|
|
@@ -144,8 +162,9 @@ module Scoutui::Commands
|
|
144
162
|
end
|
145
163
|
|
146
164
|
|
147
|
-
elsif !pageElt.nil? && pageElt['page'].has_key?('do')
|
148
|
-
_rc=execute(pageElt)
|
165
|
+
elsif thenList # !pageElt.nil? && pageElt.has_key?('page') && pageElt['page'].has_key?('do')
|
166
|
+
#_rc=execute(pageElt)
|
167
|
+
_rc=execute(thenList)
|
149
168
|
else
|
150
169
|
_rc=true
|
151
170
|
end
|
@@ -48,6 +48,7 @@ module Scoutui::Commands
|
|
48
48
|
# Check for list of elements to click
|
49
49
|
|
50
50
|
elsif _subcmd.match(/^\s*press\(__DOWN__\)$/)
|
51
|
+
puts __FILE__ + (__LINE__).to_s + " Press down"
|
51
52
|
drv.action.send_keys(:arrow_down).perform
|
52
53
|
|
53
54
|
elsif _subcmd.match(/^\s*press\(__UP__\)$/)
|
@@ -69,6 +70,17 @@ module Scoutui::Commands
|
|
69
70
|
_c = Scoutui::Commands::ClickObject.new(_subcmd)
|
70
71
|
_c.run(driver: drv)
|
71
72
|
|
73
|
+
elsif Scoutui::Commands::Utils.instance.isMouseOver?(_subcmd)
|
74
|
+
_cmd='MouseOver'
|
75
|
+
_c = Scoutui::Commands::MouseOver.new(_subcmd)
|
76
|
+
_c.execute(drv)
|
77
|
+
|
78
|
+
elsif Scoutui::Commands::Utils.instance.isPause?(_subcmd)
|
79
|
+
_cmd='pause'
|
80
|
+
_c = Scoutui::Commands::Pause.new(nil)
|
81
|
+
_c.execute();
|
82
|
+
|
83
|
+
|
72
84
|
elsif _subcmd.match(/^\s*press\((.*)\)\s*$/)
|
73
85
|
_locator = _subcmd.match(/^\s*press\((.*)\)\s*$/)[1].to_s
|
74
86
|
_locator = Scoutui::Base::UserVars.instance.normalize(_locator)
|
@@ -61,7 +61,6 @@ module Scoutui::Commands
|
|
61
61
|
_locator = @cmd.match(/^\s*click\s*\((.*)\)\s*$/i)[1].to_s.strip
|
62
62
|
Scoutui::Logger::LogMgr.instance.command.info __FILE__ + (__LINE__).to_s + " clickObject => #{_locator}"
|
63
63
|
|
64
|
-
|
65
64
|
# _locator = Scoutui::Base::UserVars.instance.get(_locator)
|
66
65
|
_locator = Scoutui::Base::UserVars.instance.normalize(_locator)
|
67
66
|
|
@@ -118,7 +117,11 @@ module Scoutui::Commands
|
|
118
117
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " highlight then click : #{obj}"
|
119
118
|
end
|
120
119
|
|
121
|
-
|
120
|
+
if e.is_a?(Hash) && e['page'].has_key?('then')
|
121
|
+
thenClause = Scoutui::Commands::ThenClause.new(@drv)
|
122
|
+
thenClause.execute(e);
|
123
|
+
end
|
124
|
+
|
122
125
|
doUntil = Scoutui::Commands::DoUntil.new(@drv)
|
123
126
|
|
124
127
|
_tm= {:start => Time.now, :end => 0 }
|
@@ -33,6 +33,15 @@ module Scoutui::Commands
|
|
33
33
|
if _subcmd.match(/^\s*press\(__TAB__\)$/)
|
34
34
|
drv.action.send_keys(:tab).perform
|
35
35
|
|
36
|
+
elsif _subcmd.match(/^\s*press\(__SHIFT_TAB__\)\s*$/)
|
37
|
+
drv.action.key_down(:shift).send_keys(:tab).perform;
|
38
|
+
drv.action.key_up(:shift).perform;
|
39
|
+
|
40
|
+
elsif _subcmd.match(/^\s*press\(__DELETE__\)\s*$/)
|
41
|
+
|
42
|
+
drv.action.send_keys(:delete).perform
|
43
|
+
_activeElt = drv.switch_to.active_element
|
44
|
+
|
36
45
|
elsif _subcmd.match(/^\s*press\((__ESC__|__ESCAPE__)\)$/)
|
37
46
|
drv.action.send_keys(:escape).perform
|
38
47
|
|
@@ -61,6 +70,9 @@ module Scoutui::Commands
|
|
61
70
|
|
62
71
|
elsif _subcmd.match(/^\s*press\(__DOWN__\)$/)
|
63
72
|
drv.action.send_keys(:arrow_down).perform
|
73
|
+
_activeElt = drv.switch_to.active_element
|
74
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " activeElt.Value: #{_activeElt.attribute('value').to_s}"
|
75
|
+
|
64
76
|
|
65
77
|
elsif _subcmd.match(/^\s*press\(__UP__\)$/)
|
66
78
|
drv.action.send_keys(:arrow_up).perform
|
@@ -68,7 +80,24 @@ module Scoutui::Commands
|
|
68
80
|
elsif _subcmd.match(/^\s*press\(__ENTER__\)\s*$/)
|
69
81
|
drv.action.send_keys(:enter).perform
|
70
82
|
|
71
|
-
|
83
|
+
|
84
|
+
elsif _subcmd.match(/^\s*[fF]ocused\.[Cc]lick\s*$/i)
|
85
|
+
_rc=true
|
86
|
+
_text=""
|
87
|
+
_tagName=""
|
88
|
+
begin
|
89
|
+
_activeElt = drv.switch_to.active_element
|
90
|
+
_tagName=_activeElt.tag_name.to_s
|
91
|
+
_text=_activeElt.text
|
92
|
+
|
93
|
+
_activeElt.click
|
94
|
+
rescue => ex
|
95
|
+
_rc=false
|
96
|
+
end
|
97
|
+
|
98
|
+
Testmgr::TestReport.instance.getReq('Simple').get_child('focused.Click').add(_rc, "#{_subcmd.to_s} #{_tagName} #{_text}")
|
99
|
+
|
100
|
+
elsif _subcmd.match(/^\s*[fF]ocused\.[Hh]ighlight(\(.*\))*/i)
|
72
101
|
|
73
102
|
_activeElt = drv.switch_to.active_element
|
74
103
|
|
@@ -77,21 +106,62 @@ module Scoutui::Commands
|
|
77
106
|
_onclick=_activeElt.attribute('onclick')
|
78
107
|
|
79
108
|
if !_id.nil?
|
80
|
-
|
109
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " => highlight id : #{_id}"
|
81
110
|
end
|
82
111
|
|
83
|
-
|
84
|
-
|
112
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " => type : #{_type}" if !_type.nil?
|
113
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " => onclick : #{_onclick}" if !_onclick.nil?
|
85
114
|
|
86
115
|
if !_activeElt.nil?
|
87
|
-
|
116
|
+
|
117
|
+
_color='red'
|
118
|
+
if _subcmd.match(/^\s*[fF]ocused\.[Hh]ighlight\s*\((.*)\)/)
|
119
|
+
_color=_subcmd.match(/^\s*[fF]ocused\.[Hh]ighlight\s*\((.*)\)/)[1].to_s
|
120
|
+
end
|
121
|
+
|
122
|
+
# Scoutui::Base::QBrowser.highlight(drv, _activeElt, style={"color" => 'rgb(255,16,16)', "border" => 2}, false)
|
123
|
+
Scoutui::Base::QBrowser.highlight(drv, _activeElt, style={"color" => _color, "border" => 2}, false)
|
124
|
+
end
|
125
|
+
|
126
|
+
elsif _subcmd.match(/^\s*[fF]ocused\.[Hh]over\s*$/i)
|
127
|
+
|
128
|
+
_activeElt = drv.switch_to.active_element
|
129
|
+
drv.action.move_to(_activeElt).perform
|
130
|
+
|
131
|
+
elsif _subcmd.match(/^\s*[fF]ocused.[Tt]ype[!]*\(.*\)$/)
|
132
|
+
|
133
|
+
_activeElt = drv.switch_to.active_element
|
134
|
+
|
135
|
+
if _subcmd.match(/^\s*[fF]ocused.[Tt]ype!\(.*\)$/)
|
136
|
+
_activeElt.clear
|
88
137
|
end
|
89
138
|
|
90
|
-
|
139
|
+
_text=_subcmd.match(/^\s*[fF]ocused.[Tt]ype[!]*\((.*)\)$/)[1].to_s
|
140
|
+
|
141
|
+
puts __FILE__ + (__LINE__).to_s + " => #{_text} is empty : #{_text.empty?}"
|
142
|
+
|
143
|
+
|
144
|
+
_activeElt.send_keys(_text)
|
145
|
+
|
146
|
+
elsif _subcmd.match(/^\s*[cC]lick\((.*)\)\s*$/)
|
91
147
|
# Click on the locator
|
92
148
|
|
93
|
-
_c
|
94
|
-
|
149
|
+
_c=Scoutui::Commands.processCommand(_subcmd, nil, drv)
|
150
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " click : #{_c.passed?}"
|
151
|
+
Testmgr::TestReport.instance.getReq('Simple').get_child('click').add(_c.passed?, "#{_subcmd.to_s}")
|
152
|
+
|
153
|
+
|
154
|
+
#_c = Scoutui::Commands::ClickObject.new(_subcmd)
|
155
|
+
#_c.run(driver: drv)
|
156
|
+
|
157
|
+
elsif _subcmd.match(/^\s*select\((.*)\)\s*$/)
|
158
|
+
|
159
|
+
_c=Scoutui::Commands.processCommand(_subcmd, nil, drv)
|
160
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " passsed? : #{_c.passed?}"
|
161
|
+
Testmgr::TestReport.instance.getReq('Simple').get_child('select').add(_c.passed?, "#{_subcmd.to_s}")
|
162
|
+
|
163
|
+
# _c = Scoutui::Commands::SelectObject.new(_subcmd)
|
164
|
+
# _c.run(driver: drv)
|
95
165
|
|
96
166
|
elsif _subcmd.match(/^\s*press\((.*)\)\s*$/)
|
97
167
|
_locator = _subcmd.match(/^\s*press\((.*)\)\s*$/)[1].to_s
|
@@ -104,6 +174,11 @@ module Scoutui::Commands
|
|
104
174
|
_c = Scoutui::Commands::AssignVar.new(_subcmd)
|
105
175
|
_c.run(driver: drv)
|
106
176
|
|
177
|
+
elsif Scoutui::Commands::Utils.instance.isType?(_subcmd)
|
178
|
+
_cmd='Type'
|
179
|
+
_c = Scoutui::Commands::Type.new(_subcmd)
|
180
|
+
_c.run(driver: drv)
|
181
|
+
|
107
182
|
end
|
108
183
|
|
109
184
|
|
@@ -212,7 +287,7 @@ module Scoutui::Commands
|
|
212
287
|
if e['page'].has_key?('vars')
|
213
288
|
e['page']['vars'].each do |_a|
|
214
289
|
|
215
|
-
|
290
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Process Assignment.var : #{_a}"
|
216
291
|
|
217
292
|
begin
|
218
293
|
_caborted=false
|
@@ -349,7 +424,7 @@ module Scoutui::Commands
|
|
349
424
|
rescue => e
|
350
425
|
Scoutui::Logger::LogMgr.instance.debug "#{e.class.to_s} Error during processing: #{$!}"
|
351
426
|
Scoutui::Logger::LogMgr.instance.debug "Backtrace:\n\t#{e.backtrace.join("\n\t")}"
|
352
|
-
|
427
|
+
Scoutui::Logger::LogMgr.instance.debug "Backtrace:\n\t#{e.backtrace.join("\n\t")}"
|
353
428
|
_aborted=true
|
354
429
|
rc=false
|
355
430
|
end
|
@@ -10,14 +10,40 @@ module Scoutui::Commands
|
|
10
10
|
Scoutui::Logger::LogMgr.instance.command.info __FILE__ + (__LINE__).to_s + " highlight => #{obj}"
|
11
11
|
if !obj.nil?
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
begin
|
14
|
+
|
15
|
+
if e.is_a?(Hash) && e.has_key?('page') && e['page'].has_key?('style')
|
16
|
+
style=e['page']['style']
|
17
|
+
obj=Scoutui::Base::QBrowser.highlight(@drv, obj, style)
|
18
|
+
|
19
|
+
elsif e.is_a?(Hash) && e.has_key?(:color)
|
20
|
+
|
21
|
+
# TODO: refactor with q_browser.highlight
|
22
|
+
if e[:color].match(/blue/i)
|
23
|
+
_style={"color" => 'rgb(0, 0, 255)', "border" => 2}
|
24
|
+
elsif e[:color].match(/red/i)
|
25
|
+
_style={"color" => 'rgb(255, 0, 0)', "border" => 2}
|
26
|
+
elsif e[:color].match(/yellow/i)
|
27
|
+
_style={"color" => 'rgb(255, 255, 0)', "border" => 2}
|
28
|
+
elsif e[:color].match(/green/i)
|
29
|
+
_style={"color" => 'rgb(0, 255, 0)', "border" => 2}
|
30
|
+
elsif e[:color].match(/gray/i)
|
31
|
+
_style={"color" => 'rgb(128, 128, 128)', "border" => 2}
|
32
|
+
end
|
33
|
+
|
34
|
+
obj=Scoutui::Base::QBrowser.highlight(@drv, obj, _style)
|
35
|
+
else
|
36
|
+
obj=Scoutui::Base::QBrowser.highlight(@drv, obj)
|
37
|
+
end
|
38
|
+
|
39
|
+
_rc=true
|
40
|
+
|
41
|
+
|
42
|
+
rescue => ex
|
43
|
+
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Error during processing: #{$!}"
|
44
|
+
Scoutui::Logger::LogMgr.instance.warn "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
|
18
45
|
end
|
19
46
|
|
20
|
-
_rc=true
|
21
47
|
end
|
22
48
|
|
23
49
|
_rc
|
@@ -25,6 +51,7 @@ module Scoutui::Commands
|
|
25
51
|
|
26
52
|
def execute(drv, e=nil)
|
27
53
|
rc=true
|
54
|
+
_color=nil
|
28
55
|
_req = Scoutui::Utils::TestUtils.instance.getReq()
|
29
56
|
|
30
57
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Highlight.execute(#{@cmd}), req:#{_req}"
|
@@ -35,9 +62,17 @@ module Scoutui::Commands
|
|
35
62
|
|
36
63
|
locators=[]
|
37
64
|
|
38
|
-
if @cmd.match(/highlight\s*\((.*)\)/)
|
39
|
-
|
40
|
-
|
65
|
+
if @cmd.match(/highlight\s*\((.*)\)([(\.blue|\.gray|\.green|\.red|\.yellow)]*)/)
|
66
|
+
# if @cmd.match(/highlight\s*\((.*)\)/)
|
67
|
+
_m = @cmd.match(/highlight\s*\((.*)\)/)
|
68
|
+
_m = @cmd.match(/highlight\s*\((.*)\)([(\.blue|\.gray|\.green|\.red|\.yellow)]*)/)
|
69
|
+
locators << _m[1].to_s
|
70
|
+
|
71
|
+
|
72
|
+
if !(_m[2].nil? || _m[2].empty?)
|
73
|
+
_color=_m[2].to_s
|
74
|
+
end
|
75
|
+
|
41
76
|
elsif e.is_a?(Hash) && e.has_key?('page') && e['page'].has_key?('locators')
|
42
77
|
locators = e['page']['locators']
|
43
78
|
end
|
@@ -45,32 +80,48 @@ module Scoutui::Commands
|
|
45
80
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " highlight.locators => #{locators}"
|
46
81
|
|
47
82
|
locators.each do |elt|
|
83
|
+
q=nil
|
48
84
|
|
85
|
+
# TODO: _parsed = Scoutui::Base::QBrowser.parseLocator(elt)
|
49
86
|
|
50
|
-
|
87
|
+
if elt.is_a?(String) && elt=='focused'
|
88
|
+
obj=@drv.switch_to.active_element
|
51
89
|
|
52
|
-
|
53
|
-
Scoutui::Commands::Utils.instance.
|
54
|
-
|
55
|
-
|
90
|
+
elsif elt.is_a?(String) && elt.match((/^\s*([(frame\([^\(]*?\)\.)]*)\.(locator\((.*)\))\s*$/))
|
91
|
+
obj=Scoutui::Base::QBrowser.getElement(@drv, elt, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
|
92
|
+
else
|
93
|
+
|
94
|
+
q=Scoutui::Base::Assertions.instance._parseFrameLocator(elt)
|
56
95
|
|
96
|
+
if q.has_key?('frame')
|
97
|
+
Scoutui::Commands::Utils.instance.setEnableFrameSearch(q['frame'])
|
98
|
+
elt = q['locator']
|
99
|
+
end
|
57
100
|
|
58
|
-
_loc = Scoutui::Base::UserVars.instance.normalize(elt)
|
59
101
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
102
|
+
_loc = Scoutui::Base::UserVars.instance.normalize(elt)
|
103
|
+
|
104
|
+
obj = Scoutui::Base::QBrowser.findElement(@drv,
|
105
|
+
_loc,
|
106
|
+
Scoutui::Commands::Utils.instance.getFrameSearch(),
|
107
|
+
Scoutui::Commands::Utils.instance.getTimeout)
|
108
|
+
end
|
109
|
+
|
64
110
|
|
65
111
|
if !obj.is_a?(Selenium::WebDriver::Element)
|
66
112
|
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " highlight : unable to find #{_loc}"
|
67
113
|
end
|
68
114
|
|
69
|
-
|
115
|
+
if _color.nil?
|
116
|
+
_rc = _highlight(obj, e)
|
117
|
+
else
|
118
|
+
_rc = _highlight(obj, { :color => _color })
|
119
|
+
end
|
120
|
+
|
70
121
|
|
71
122
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " highlight(#{e}) : #{_rc}"
|
72
123
|
|
73
|
-
if q.has_key?('frame')
|
124
|
+
if q && q.has_key?('frame')
|
74
125
|
@drv.switch_to.default_content
|
75
126
|
Scoutui::Commands::Utils.instance.resetFrameSearch
|
76
127
|
end
|
@@ -50,6 +50,8 @@ module Scoutui::Commands
|
|
50
50
|
|
51
51
|
begin
|
52
52
|
_locator = @cmd.match(/^\s*mouseover\s*\((.*)\)/)[1].to_s.strip
|
53
|
+
_locator = Scoutui::Base::UserVars.instance.normalize(_locator)
|
54
|
+
|
53
55
|
obj = Scoutui::Base::QBrowser.getObject(@drv, _locator, Scoutui::Commands::Utils.instance.getTimeout)
|
54
56
|
|
55
57
|
if !obj.nil?
|
@@ -78,10 +80,10 @@ module Scoutui::Commands
|
|
78
80
|
# _tObj = Scoutui::Base::VisualTestFramework.processPageElement(@drv, 'peter', _pageObj)
|
79
81
|
|
80
82
|
_tLocator = Scoutui::Utils::TestUtils.instance.getPageElement(_pageObj)
|
81
|
-
_tObj = Scoutui::Base::QBrowser.getFirstObject(@drv, _tLocator['locator'])
|
83
|
+
_tObj = Scoutui::Base::QBrowser.getFirstObject(@drv, _tLocator['locator']) # TODO: Avoid using getFirstObject
|
82
84
|
|
83
85
|
else
|
84
|
-
_tObj = Scoutui::Base::QBrowser.getFirstObject(@drv, _pageObj, Scoutui::Commands::Utils.instance.getTimeout())
|
86
|
+
_tObj = Scoutui::Base::QBrowser.getFirstObject(@drv, _pageObj, Scoutui::Commands::Utils.instance.getTimeout()) # TODO: Avoid using getFirstObject
|
85
87
|
end
|
86
88
|
|
87
89
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " HIT #{_pageObj} => #{!_tObj.nil?}"
|
@@ -8,9 +8,16 @@ module Scoutui::Commands
|
|
8
8
|
rc=true
|
9
9
|
h=""
|
10
10
|
begin
|
11
|
-
if e.is_a?(Hash)
|
12
|
-
|
11
|
+
if e.is_a?(Hash)
|
12
|
+
if e.has_key?('page')
|
13
|
+
h=e['page']['name'].to_s
|
14
|
+
elsif e.has_key?('name')
|
15
|
+
h=e['name']
|
16
|
+
end
|
17
|
+
elsif e.is_a?(String)
|
18
|
+
h=e
|
13
19
|
end
|
20
|
+
|
14
21
|
puts "====== PAUSE - HIT ENTER #{h} ========="
|
15
22
|
STDIN.gets()
|
16
23
|
rescue => ex
|