scoutui 2.0.3.55.pre → 2.0.3.56.pre
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/q_browser.rb +11 -7
- data/lib/scoutui/base/user_vars.rb +5 -0
- data/lib/scoutui/base/visual_test_framework.rb +17 -14
- data/lib/scoutui/commands/clauses/do_until.rb +37 -10
- data/lib/scoutui/commands/clauses/then_clause.rb +2 -2
- data/lib/scoutui/commands/click_object.rb +34 -166
- data/lib/scoutui/commands/commands.rb +26 -1
- data/lib/scoutui/commands/dumpvars.rb +23 -0
- data/lib/scoutui/commands/type.rb +1 -1
- data/lib/scoutui/commands/utils.rb +7 -1
- data/lib/scoutui/eyes/eye_factory.rb +5 -1
- data/lib/scoutui/utils/utils.rb +18 -7
- 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: fa1e9da4168ffb5edf8cccd10c20832fd90f3ae3
|
4
|
+
data.tar.gz: 428e25bade5b679e32b2c36d5a4bfcf62278e6d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84e1d7e9188db85a547bb649be2c35a90431ffee43f9af6e2b1be505494f4c0c35ee11c5b07a8c699c205dc0485732405d57bf1ae31527d1603eb0ab3b8d5150
|
7
|
+
data.tar.gz: eb36b018fe40f0cae6920dc14b78b17465783f94d11f8e5128146b4a9027b30d1fe299f858dea6691f2ce61dd0f0da17f622b9599d55215bc5e6b3b95bf0024f
|
@@ -783,7 +783,7 @@ module Scoutui::Base
|
|
783
783
|
rc
|
784
784
|
end
|
785
785
|
|
786
|
-
def self.highlight(drv, locator, style={"color" => 255, "border" => 2},
|
786
|
+
def self.highlight(drv, locator, style={"color" => 255, "border" => 2}, fAncestors=true)
|
787
787
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " highLight(#{locator})"
|
788
788
|
|
789
789
|
rc=false
|
@@ -803,15 +803,19 @@ module Scoutui::Base
|
|
803
803
|
color=style.has_key?("color")? style["color"] : 255
|
804
804
|
border=style.has_key?("border")? style["border"] : 1
|
805
805
|
|
806
|
-
ancestors=style.has_key?("ancestors")? style["ancestors"] : 0
|
807
|
-
|
808
806
|
drv.execute_script("hlt = function(c) { c.style.border='solid #{border}px rgb(#{color}, 16, 16)'; }; return hlt(arguments[0]);", element)
|
809
807
|
parents = ""
|
810
808
|
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
809
|
+
if fAncestors
|
810
|
+
ancestors=style.has_key?("ancestors")? style["ancestors"] : 0
|
811
|
+
|
812
|
+
ancestors.times do
|
813
|
+
parents << ".parentNode"
|
814
|
+
color -= (12*8 / ancestors)
|
815
|
+
drv.execute_script("hlt = function(c) { c#{parents}.style.border='solid 1px rgb(#{color}, 0, 0)'; }; return hlt(arguments[0]);", element)
|
816
|
+
end
|
817
|
+
else
|
818
|
+
puts __FILE__ + (__LINE__).to_s + " SKIP ANCES"
|
815
819
|
end
|
816
820
|
|
817
821
|
# Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " PAUSE on highlight"; gets
|
@@ -25,6 +25,11 @@ module Scoutui::Base
|
|
25
25
|
@globals.each_pair do |k, v|
|
26
26
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{k} => #{v}"
|
27
27
|
end
|
28
|
+
|
29
|
+
|
30
|
+
@userVars.each_pair do |k, v|
|
31
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{k} => #{v}"
|
32
|
+
end
|
28
33
|
end
|
29
34
|
|
30
35
|
def getViewPort()
|
@@ -46,9 +46,6 @@ module Scoutui::Base
|
|
46
46
|
|
47
47
|
_obj = Scoutui::Base::QBrowser.getFirstObject(my_driver, xpath, Scoutui::Commands::Utils.instance.getTimeout)
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
49
|
_req = nil
|
53
50
|
|
54
51
|
if page_elt.has_key?('reqid')
|
@@ -59,15 +56,13 @@ module Scoutui::Base
|
|
59
56
|
|
60
57
|
if page_elt.has_key?('asserts')
|
61
58
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ** process Asserts #{page_elt['asserts']} **"
|
62
|
-
STDIN.gets
|
59
|
+
#STDIN.gets
|
63
60
|
end
|
64
61
|
|
65
62
|
|
66
63
|
elsif sub_elts > 0
|
67
64
|
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " Validate form"
|
68
65
|
|
69
|
-
|
70
|
-
|
71
66
|
page_elt.each_pair do |_k, _v|
|
72
67
|
|
73
68
|
begin
|
@@ -220,7 +215,7 @@ module Scoutui::Base
|
|
220
215
|
elsif page_elt.is_a?(Hash) && page_elt.has_key?('asserts')
|
221
216
|
# 5150
|
222
217
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ** asserts from PageElement verification **"
|
223
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " =============="; STDIN.gets
|
218
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " =============="; #STDIN.gets
|
224
219
|
end
|
225
220
|
|
226
221
|
|
@@ -435,8 +430,12 @@ module Scoutui::Base
|
|
435
430
|
_activeElt = my_driver.switch_to.active_element
|
436
431
|
|
437
432
|
if !_activeElt.nil?
|
438
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " target.text
|
439
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " activeElt.text
|
433
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " target.text : |#{_targetTxt}|"
|
434
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " activeElt.text : |#{_activeElt.text.to_s}|"
|
435
|
+
|
436
|
+
if _activeElt.attribute('value')
|
437
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " activeElt.value : |#{_activeElt.attribute('value').to_s}|"
|
438
|
+
end
|
440
439
|
|
441
440
|
_rc=!(_activeElt.text.to_s.match(/#{_targetTxt}/).nil?)
|
442
441
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " FocusedText : #{_activeElt.text} => #{_rc}"
|
@@ -910,6 +909,7 @@ module Scoutui::Base
|
|
910
909
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " [end]: processExpected()"
|
911
910
|
end
|
912
911
|
|
912
|
+
|
913
913
|
# Scoutui::Base::VisualTestFramework.processFile(@drv, @eyes, @test_settings['host'], @test_settings['dut'])
|
914
914
|
def self.processFile(eyeScout, test_settings, strategy=nil)
|
915
915
|
|
@@ -1448,7 +1448,7 @@ module Scoutui::Base
|
|
1448
1448
|
|
1449
1449
|
if e[STEP_KEY].has_key?('accessible') && e[STEP_KEY]['accessible'].to_s.match(/true/)
|
1450
1450
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ** Accessibility **"
|
1451
|
-
STDIN.gets
|
1451
|
+
#STDIN.gets
|
1452
1452
|
end
|
1453
1453
|
|
1454
1454
|
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " ====== assertResults : #{_assertResult}"
|
@@ -1459,10 +1459,13 @@ module Scoutui::Base
|
|
1459
1459
|
_c.run(driver: my_driver, dut: e[STEP_KEY])
|
1460
1460
|
end
|
1461
1461
|
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1462
|
+
|
1463
|
+
if isSnapIt(e)
|
1464
|
+
if !_region.nil?
|
1465
|
+
eyeScout.check_window(_name, Scoutui::Base::UserVars.instance.normalize(_region))
|
1466
|
+
else
|
1467
|
+
eyeScout.check_window(_name)
|
1468
|
+
end
|
1466
1469
|
end
|
1467
1470
|
|
1468
1471
|
Scoutui::Logger::LogMgr.instance.info "\to links : #{e[STEP_KEY]['links'].class.to_s}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
@@ -32,9 +32,25 @@ module Scoutui::Commands
|
|
32
32
|
|
33
33
|
def do_until(pageElt)
|
34
34
|
|
35
|
-
|
35
|
+
thenList=nil
|
36
|
+
untilList=nil
|
37
|
+
_alwaystrue=false
|
36
38
|
|
37
|
-
|
39
|
+
if pageElt.is_a?(Hash) && pageElt.has_key?('page')
|
40
|
+
|
41
|
+
if pageElt['page'].has_key?('do') && pageElt['page'].has_key?('until')
|
42
|
+
thenList=pageElt['page']['do']
|
43
|
+
untilList=pageElt['page']['until']
|
44
|
+
end
|
45
|
+
|
46
|
+
elsif pageElt.is_a?(Hash) && pageElt.has_key?('do') && pageElt.has_key?('until')
|
47
|
+
thenList = pageElt['do']
|
48
|
+
untilList = pageElt['until']
|
49
|
+
end
|
50
|
+
|
51
|
+
if thenList # !pageElt.nil? && pageElt['page'].has_key?('do') && pageElt['page'].has_key?('until')
|
52
|
+
|
53
|
+
# thenList=pageElt['page']['do']
|
38
54
|
_loop=true
|
39
55
|
_i=0
|
40
56
|
_historyElts={}
|
@@ -51,18 +67,18 @@ module Scoutui::Commands
|
|
51
67
|
_activeElt = @drv.switch_to.active_element
|
52
68
|
|
53
69
|
if _activeElt.is_a?(Selenium::WebDriver::Element)
|
54
|
-
|
70
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ActiveElt => #{_activeElt.tag_name} : #{_activeElt.text}"
|
55
71
|
|
56
72
|
# Check if Tabbed element is displayed.
|
57
73
|
|
58
74
|
if !_activeElt.displayed?
|
59
|
-
|
75
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ** Tabbled-on element is NOT displayed"
|
60
76
|
end
|
61
77
|
end
|
62
78
|
|
63
79
|
|
64
80
|
if _historyElts.size > 0 && _historyElts.has_key?(_activeElt)
|
65
|
-
|
81
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "****** WRAPPED ******"
|
66
82
|
|
67
83
|
_loop=false
|
68
84
|
else
|
@@ -71,9 +87,18 @@ module Scoutui::Commands
|
|
71
87
|
|
72
88
|
end
|
73
89
|
|
74
|
-
if _loop && !pageElt.nil? && pageElt['page'].has_key?('until')
|
75
|
-
|
76
|
-
puts __FILE__ + (__LINE__).to_s + "
|
90
|
+
if _loop && untilList # !pageElt.nil? && pageElt['page'].has_key?('until')
|
91
|
+
|
92
|
+
puts __FILE__ + (__LINE__).to_s + " untilList => #{untilList.class}, #{untilList.size}, #{untilList[0]}"
|
93
|
+
|
94
|
+
if untilList.is_a?(Array) && untilList.size==1 && untilList[0]==true
|
95
|
+
_expected=false
|
96
|
+
_alwaystrue=true
|
97
|
+
else
|
98
|
+
_expected=Scoutui::Base::VisualTestFramework::processAsserts(@drv, untilList, false)
|
99
|
+
end
|
100
|
+
|
101
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ==> until : #{_expected}"; #STDIN.gets
|
77
102
|
|
78
103
|
_loop=!_expected
|
79
104
|
|
@@ -81,7 +106,7 @@ module Scoutui::Commands
|
|
81
106
|
_bUntil=true
|
82
107
|
end
|
83
108
|
|
84
|
-
elsif !pageElt['page'].has_key?('until')
|
109
|
+
elsif untilList.nil? # !pageElt['page'].has_key?('until')
|
85
110
|
_loop=false
|
86
111
|
_bUntil=true
|
87
112
|
end
|
@@ -90,7 +115,7 @@ module Scoutui::Commands
|
|
90
115
|
|
91
116
|
if !_bUntil && _i > 75
|
92
117
|
_loop=false
|
93
|
-
|
118
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ** BREAK OUT **"; #STDIN.gets
|
94
119
|
end
|
95
120
|
|
96
121
|
end # while()
|
@@ -110,6 +135,8 @@ module Scoutui::Commands
|
|
110
135
|
|
111
136
|
_whenFailed = execute(pageElt['page']['whenFailed'])
|
112
137
|
|
138
|
+
elsif _alwaystrue
|
139
|
+
_rc=true
|
113
140
|
end
|
114
141
|
|
115
142
|
|
@@ -122,7 +122,7 @@ module Scoutui::Commands
|
|
122
122
|
puts __FILE__ + (__LINE__).to_s + " ActiveElt => #{_activeElt.text}"
|
123
123
|
|
124
124
|
if _historyElts.size > 0 && _historyElts.has_key?(_activeElt)
|
125
|
-
puts __FILE__ + (__LINE__).to_s + "****** WRAPPED ******";
|
125
|
+
puts __FILE__ + (__LINE__).to_s + "****** WRAPPED ******"; #STDIN.gets
|
126
126
|
|
127
127
|
_loop=false
|
128
128
|
else
|
@@ -150,7 +150,7 @@ module Scoutui::Commands
|
|
150
150
|
|
151
151
|
if !_bUntil && _i > 75
|
152
152
|
_loop=false
|
153
|
-
puts __FILE__ + (__LINE__).to_s + " ** BREAK OUT **"; STDIN.gets
|
153
|
+
puts __FILE__ + (__LINE__).to_s + " ** BREAK OUT **"; #STDIN.gets
|
154
154
|
end
|
155
155
|
|
156
156
|
end # while()
|
@@ -39,9 +39,14 @@ module Scoutui::Commands
|
|
39
39
|
|
40
40
|
end
|
41
41
|
|
42
|
+
|
43
|
+
|
42
44
|
def execute(drv, e=nil)
|
43
45
|
|
44
|
-
retries
|
46
|
+
retries = Scoutui::Utils::TestUtils.instance.retries()
|
47
|
+
retries = 1 if retries < 1
|
48
|
+
|
49
|
+
waitTime = Scoutui::Utils::TestUtils.instance.getDefaultWait
|
45
50
|
|
46
51
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " click_object.execute: #{@cmd} with #{retries} retries"
|
47
52
|
obj=nil
|
@@ -53,7 +58,7 @@ module Scoutui::Commands
|
|
53
58
|
|
54
59
|
_req = Scoutui::Utils::TestUtils.instance.getReq()
|
55
60
|
|
56
|
-
_locator = @cmd.match(/^\s*click\s*\((.*)\)\s*$/)[1].to_s.strip
|
61
|
+
_locator = @cmd.match(/^\s*click\s*\((.*)\)\s*$/i)[1].to_s.strip
|
57
62
|
Scoutui::Logger::LogMgr.instance.command.info __FILE__ + (__LINE__).to_s + " clickObject => #{_locator}"
|
58
63
|
|
59
64
|
|
@@ -67,6 +72,7 @@ module Scoutui::Commands
|
|
67
72
|
_startTime=Time.now
|
68
73
|
_endTime=nil
|
69
74
|
_clickTime=0
|
75
|
+
isEnabled=nil
|
70
76
|
|
71
77
|
begin
|
72
78
|
|
@@ -75,18 +81,20 @@ module Scoutui::Commands
|
|
75
81
|
(0..retries).each do |_i|
|
76
82
|
|
77
83
|
_retry = true
|
78
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{_i} ======> click(#{_locator})"
|
84
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Retry #{_i} ======> click(#{_locator})"
|
79
85
|
|
80
86
|
begin
|
81
87
|
|
82
88
|
_startTime=Time.now
|
83
89
|
|
84
|
-
wait = Selenium::WebDriver::Wait.new(:timeout =>
|
90
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => waitTime)
|
85
91
|
isEnabled = wait.until {
|
86
92
|
obj=Scoutui::Base::QBrowser.getElement(@drv, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
|
87
93
|
obj.is_a?(Selenium::WebDriver::Element) && obj.enabled? && obj.displayed?
|
88
94
|
}
|
89
95
|
|
96
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isEnabled : #{isEnabled}"
|
97
|
+
|
90
98
|
if isEnabled # && obj.is_a?(Selenium::WebDriver::Element)
|
91
99
|
|
92
100
|
@drv.action.move_to(obj).perform
|
@@ -110,14 +118,22 @@ module Scoutui::Commands
|
|
110
118
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " highlight then click : #{obj}"
|
111
119
|
end
|
112
120
|
|
121
|
+
thenClause = Scoutui::Commands::ThenClause.new(@drv)
|
122
|
+
doUntil = Scoutui::Commands::DoUntil.new(@drv)
|
123
|
+
|
124
|
+
_tm= {:start => Time.now, :end => 0 }
|
125
|
+
_bUntil = doUntil.do_until(e)
|
126
|
+
_tm[:end]=Time.now
|
127
|
+
Testmgr::TestReport.instance.getReq(_req).testcase('until').add(_bUntil, Scoutui::Base::UserVars.instance.normalize("Verify after click, do-until met #{_bUntil}"), (_tm[:end] - _tm[:start]))
|
128
|
+
|
129
|
+
|
113
130
|
elsif obj.is_a?(Selenium::WebDriver::Element) && obj.displayed?
|
114
131
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " object is displayed, but not enabled"
|
115
132
|
end
|
116
133
|
|
117
|
-
|
118
134
|
rescue Selenium::WebDriver::Error::StaleElementReferenceError => ex
|
119
135
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Retry #{_i} - Selenium::WebDriver::Error::UnknownError"
|
120
|
-
|
136
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + ex.backtrace.join("\n\t")
|
121
137
|
_retry=true
|
122
138
|
|
123
139
|
|
@@ -126,175 +142,27 @@ module Scoutui::Commands
|
|
126
142
|
|
127
143
|
rescue Selenium::WebDriver::Error::UnknownError => ex
|
128
144
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Retry #{_i} - Selenium::WebDriver::Error::UnknownError"
|
129
|
-
|
145
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + ex.backtrace.join("\n\t")
|
130
146
|
_retry=true
|
131
147
|
end
|
132
148
|
|
133
149
|
break if !_retry
|
134
150
|
|
135
|
-
sleep(0.
|
151
|
+
sleep(0.25)
|
136
152
|
end
|
137
153
|
|
138
154
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " clicked(#{_locator}): #{_clicked}"
|
155
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " o isWebDriverElement : #{obj.is_a?(Selenium::WebDriver::Element)}"
|
139
156
|
|
140
|
-
|
141
|
-
|
142
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " PageElement(#{_locator}) => #{page_elt}"
|
143
|
-
|
144
|
-
if all_windows > @drv.window_handles.size
|
145
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " WINDOW was CLOSED. Activate first window as our default";
|
146
|
-
@drv.switch_to.window @drv.window_handles.first
|
147
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Switched to first window"
|
148
|
-
end
|
149
|
-
|
150
|
-
_whenClicked(page_elt)
|
151
|
-
|
152
|
-
if e.is_a?(Hash) && e.has_key?('page') && e['page'].has_key?('then')
|
153
|
-
thenClause = Scoutui::Commands::ThenClause.new(@drv)
|
154
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " thenClause => #{thenClause.class}"
|
155
|
-
thenClause.execute(e)
|
156
|
-
end
|
157
|
-
|
158
|
-
|
159
|
-
# _then(e)
|
160
|
-
|
161
|
-
else
|
162
|
-
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Unable to click object that is not displayed."
|
163
|
-
end
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
rescue => ex
|
168
|
-
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " #{ex.class.to_s} : Error during processing: #{ex.message}"
|
169
|
-
Scoutui::Logger::LogMgr.instance.warn " Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
|
170
|
-
end
|
171
|
-
|
172
|
-
|
173
|
-
Scoutui::Logger::LogMgr.instance.asserts.info "Verify object to click exists #{_locator} : #{obj.class.to_s} - #{!obj.nil?.to_s}"
|
174
|
-
Scoutui::Logger::LogMgr.instance.asserts.info __FILE__ + (__LINE__).to_s + " Verify clicked #{_locator} - #{_clicked.to_s}"
|
175
|
-
|
176
|
-
Testmgr::TestReport.instance.getReq(_req).testcase('click').add(!obj.nil?, "Verify object to click exists #{_locator} : #{obj.class.to_s}")
|
177
|
-
Testmgr::TestReport.instance.getReq(_req).testcase('click').add(_clicked, "Verify clicked #{_locator}", _clickTime)
|
178
|
-
|
179
|
-
|
180
|
-
if !_clicked
|
181
|
-
Scoutui::Logger::LogMgr.instance.asserts.info __FILE__ + (__LINE__).to_s + " FAILED CLICK"
|
182
|
-
end
|
183
|
-
|
184
|
-
setResult(_clicked)
|
185
|
-
end
|
186
|
-
|
187
|
-
|
188
|
-
def execute_bak(drv, e=nil)
|
189
|
-
|
190
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " click_object.execute: #{@cmd}"
|
191
|
-
@drv=drv if !drv.nil?
|
192
|
-
|
193
|
-
bm=nil
|
194
|
-
all_windows = @drv.window_handles.size
|
195
|
-
|
196
|
-
_req = Scoutui::Utils::TestUtils.instance.getReq()
|
197
|
-
|
198
|
-
_locator = @cmd.match(/^\s*click\s*\((.*)\)\s*$/)[1].to_s.strip
|
199
|
-
Scoutui::Logger::LogMgr.instance.command.info __FILE__ + (__LINE__).to_s + " clickObject => #{_locator}"
|
200
|
-
|
201
|
-
|
202
|
-
# _locator = Scoutui::Base::UserVars.instance.get(_locator)
|
203
|
-
_locator = Scoutui::Base::UserVars.instance.normalize(_locator)
|
204
|
-
|
205
|
-
Scoutui::Logger::LogMgr.instance.command.info __FILE__ + (__LINE__).to_s + " | translate : #{_locator}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
206
|
-
|
207
|
-
_clicked=false
|
208
|
-
|
209
|
-
_startTime=Time.now
|
210
|
-
_endTime=nil
|
211
|
-
_clickTime=0
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
begin
|
216
|
-
|
217
|
-
obj = Scoutui::Base::QBrowser.getElement(@drv, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
|
218
|
-
|
219
|
-
if obj
|
220
|
-
|
221
|
-
# Refactor in qbrowser
|
222
|
-
|
223
|
-
isDisplayed=false
|
224
|
-
|
225
|
-
begin
|
226
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => Scoutui::Commands::Utils.instance.getTimeout)
|
227
|
-
isDisplayed = wait.until {
|
228
|
-
true if obj.displayed?
|
229
|
-
}
|
230
|
-
rescue Selenium::WebDriver::Error::StaleElementReferenceError => ex
|
231
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{ex.class}"
|
232
|
-
rescue Selenium::WebDriver::Error::TimeOutError => ex
|
233
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Timeout waiting for display?: #{_locator}"
|
234
|
-
end
|
235
|
-
|
236
|
-
|
237
|
-
if isDisplayed
|
238
|
-
|
239
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 30)
|
240
|
-
isEnabled = wait.until { obj.displayed? && obj.enabled? }
|
241
|
-
|
242
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " obj is enabled : #{isEnabled}"
|
243
|
-
|
244
|
-
|
245
|
-
if e.is_a?(Hash) && e.has_key?('page') && e['page'].has_key?('highlight') && e['page']['highlight']
|
246
|
-
#
|
247
|
-
# page:
|
248
|
-
# highlight: true
|
249
|
-
#
|
250
|
-
obj=Scoutui::Base::QBrowser.highlight(@drv, obj)
|
251
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " highlight then click : #{obj}"
|
252
|
-
end
|
253
|
-
|
254
|
-
(0..10).each do |_i|
|
255
|
-
_retry = true
|
256
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{_i} => click(#{obj})"
|
257
|
-
begin
|
258
|
-
|
259
|
-
_startTime=Time.now
|
260
|
-
|
261
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 30)
|
262
|
-
isEnabled = wait.until {
|
263
|
-
obj=Scoutui::Base::QBrowser.getElement(@drv, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
|
264
|
-
obj.enabled? && obj.displayed?
|
265
|
-
}
|
266
|
-
|
267
|
-
@drv.action.move_to(obj).perform
|
268
|
-
bm=Benchmark.measure {
|
269
|
-
obj.click
|
270
|
-
}
|
271
|
-
|
272
|
-
_endTime=Time.now
|
273
|
-
_clickTime = (_endTime - _startTime)
|
157
|
+
isEnabled = obj.enabled? if obj.is_a?(Selenium::WebDriver::Element)
|
274
158
|
|
275
|
-
|
276
|
-
_retry = false
|
277
|
-
_clicked=true
|
159
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " o enabled : #{isEnabled}"
|
278
160
|
|
279
|
-
|
280
|
-
|
281
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Retry #{_i} - Selenium::WebDriver::Error::UnknownError"
|
282
|
-
puts __FILE__ + (__LINE__).to_s + ex.backtrace.join("\n\t")
|
283
|
-
_retry=true
|
284
|
-
|
285
|
-
|
286
|
-
rescue Selenium::WebDriver::Error::UnknownError => ex
|
287
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Retry #{_i} - Selenium::WebDriver::Error::UnknownError"
|
288
|
-
puts __FILE__ + (__LINE__).to_s + ex.backtrace.join("\n\t")
|
289
|
-
_retry=true
|
290
|
-
end
|
291
|
-
|
292
|
-
break if !_retry
|
293
|
-
|
294
|
-
sleep(0.5)
|
161
|
+
if obj.is_a?(Selenium::WebDriver::Element) && !obj.enabled?
|
162
|
+
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + "o Attemping to click a disabled element : #{_locator}"
|
295
163
|
end
|
296
164
|
|
297
|
-
|
165
|
+
# puts __FILE__ + (__LINE__).to_s + " Pause for debug"; STDIN.gets
|
298
166
|
|
299
167
|
page_elt = Scoutui::Utils::TestUtils.instance.getPageElement(_locator)
|
300
168
|
|
@@ -314,14 +182,12 @@ module Scoutui::Commands
|
|
314
182
|
thenClause.execute(e)
|
315
183
|
end
|
316
184
|
|
317
|
-
|
318
|
-
# _then(e)
|
185
|
+
# _then(e)
|
319
186
|
|
320
187
|
else
|
321
188
|
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Unable to click object that is not displayed."
|
322
189
|
end
|
323
190
|
|
324
|
-
end
|
325
191
|
|
326
192
|
rescue => ex
|
327
193
|
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " #{ex.class.to_s} : Error during processing: #{ex.message}"
|
@@ -337,11 +203,13 @@ module Scoutui::Commands
|
|
337
203
|
|
338
204
|
|
339
205
|
if !_clicked
|
340
|
-
Scoutui::Logger::LogMgr.instance.info
|
206
|
+
Scoutui::Logger::LogMgr.instance.asserts.info __FILE__ + (__LINE__).to_s + " FAILED CLICK: #{_locator}"
|
341
207
|
end
|
342
208
|
|
343
209
|
setResult(_clicked)
|
344
210
|
end
|
211
|
+
|
212
|
+
|
345
213
|
end
|
346
214
|
|
347
215
|
|
@@ -71,8 +71,20 @@ module Scoutui::Commands
|
|
71
71
|
elsif _subcmd.match(/^\s*focused\.[Hh]ighlight\s*$/i)
|
72
72
|
|
73
73
|
_activeElt = drv.switch_to.active_element
|
74
|
+
|
75
|
+
_id = _activeElt.attribute('id')
|
76
|
+
_type = _activeElt.attribute('type')
|
77
|
+
_onclick=_activeElt.attribute('onclick')
|
78
|
+
|
79
|
+
if !_id.nil?
|
80
|
+
puts __FILE__ + (__LINE__).to_s + " => highlight id : #{_id}"
|
81
|
+
end
|
82
|
+
|
83
|
+
puts __FILE__ + (__LINE__).to_s + " => type : #{_type}" if !_type.nil?
|
84
|
+
puts __FILE__ + (__LINE__).to_s + " => onclick : #{_onclick}" if !_onclick.nil?
|
85
|
+
|
74
86
|
if !_activeElt.nil?
|
75
|
-
Scoutui::Base::QBrowser.highlight(drv, _activeElt)
|
87
|
+
Scoutui::Base::QBrowser.highlight(drv, _activeElt, tyle={"color" => 255, "border" => 2}, false)
|
76
88
|
end
|
77
89
|
|
78
90
|
elsif _subcmd.match(/^\s*click\((.*)\)\s*$/)
|
@@ -86,9 +98,17 @@ module Scoutui::Commands
|
|
86
98
|
_locator = Scoutui::Base::UserVars.instance.normalize(_locator)
|
87
99
|
obj = Scoutui::Base::QBrowser.getElement(drv, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
|
88
100
|
obj.click
|
101
|
+
|
102
|
+
elsif Scoutui::Commands::Utils.instance.isAssignVar?(_subcmd)
|
103
|
+
_cmd='assignvar'
|
104
|
+
_c = Scoutui::Commands::AssignVar.new(_subcmd)
|
105
|
+
_c.run(driver: drv)
|
106
|
+
|
89
107
|
end
|
90
108
|
|
109
|
+
|
91
110
|
end
|
111
|
+
|
92
112
|
end
|
93
113
|
|
94
114
|
rescue => ex
|
@@ -218,6 +238,11 @@ module Scoutui::Commands
|
|
218
238
|
_c = Scoutui::Commands::AssignVar.new(_action)
|
219
239
|
_c.run(driver: my_driver, dut: e)
|
220
240
|
|
241
|
+
elsif Scoutui::Commands::Utils.instance.isDumpVars?(_action)
|
242
|
+
_cmd='dumpvars'
|
243
|
+
_c = Scoutui::Commands::DumpVars.new(_action)
|
244
|
+
_c.run(driver: my_driver, dut: e)
|
245
|
+
|
221
246
|
elsif Scoutui::Commands::Utils.instance.isSelectWindow?(_action)
|
222
247
|
_cmd='SelectWindow'
|
223
248
|
_c = Scoutui::Commands::SelectWindow.new(_action)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
module Scoutui::Commands
|
3
|
+
|
4
|
+
class DumpVars < Command
|
5
|
+
|
6
|
+
def execute(drv, e=nil)
|
7
|
+
rc=false
|
8
|
+
@drv=drv if !drv.nil?
|
9
|
+
|
10
|
+
begin
|
11
|
+
Scoutui::Logger::LogMgr.instance.debug " *** DUMP VARS ****"
|
12
|
+
Scoutui::Base::UserVars.instance.dump
|
13
|
+
rc=true
|
14
|
+
rescue => ex
|
15
|
+
;
|
16
|
+
end
|
17
|
+
|
18
|
+
setResult(rc)
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -92,7 +92,7 @@ module Scoutui::Commands
|
|
92
92
|
_bUntil = doUntil.do_until(pageElt)
|
93
93
|
_tm[:end]=Time.now
|
94
94
|
|
95
|
-
Testmgr::TestReport.instance.getReq(_req).testcase('until').add(_bUntil, Scoutui::Base::UserVars.instance.normalize("Verify then-until met #{_bUntil}"), (_tm[:end] - _tm[:
|
95
|
+
Testmgr::TestReport.instance.getReq(_req).testcase('until').add(_bUntil, Scoutui::Base::UserVars.instance.normalize("Verify then-until met #{_bUntil}"), (_tm[:end] - _tm[:start]))
|
96
96
|
|
97
97
|
_rc=_bUntil
|
98
98
|
_isKb=true
|
@@ -18,6 +18,7 @@ module Scoutui::Commands
|
|
18
18
|
'assignments',
|
19
19
|
'existsAlert',
|
20
20
|
'clickJsAlert',
|
21
|
+
'dumpvars',
|
21
22
|
'fillform',
|
22
23
|
'frame',
|
23
24
|
'highlight',
|
@@ -236,7 +237,6 @@ module Scoutui::Commands
|
|
236
237
|
end
|
237
238
|
|
238
239
|
def isSelectWindow?(_action)
|
239
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isSelectWindow?(#{_action})"
|
240
240
|
!_action.match(/^\s*select_window/i).nil?
|
241
241
|
end
|
242
242
|
|
@@ -272,6 +272,10 @@ module Scoutui::Commands
|
|
272
272
|
!_action.match(/^\s*connect\s*$/i).nil?
|
273
273
|
end
|
274
274
|
|
275
|
+
def isDumpVars?(_action)
|
276
|
+
!_action.match(/^\s*dumpvars\s*$/i).nil?
|
277
|
+
end
|
278
|
+
|
275
279
|
def isLoadDB?(_action)
|
276
280
|
!_action.match(/^\s*loaddb\s*$/i).nil?
|
277
281
|
end
|
@@ -363,6 +367,8 @@ module Scoutui::Commands
|
|
363
367
|
@totalCommands['type']+=1
|
364
368
|
elsif isClick?(cmd)
|
365
369
|
@totalCommands['click']+=1
|
370
|
+
elsif isDumpVars?(cmd)
|
371
|
+
@totalCommands['dumpvars']+=1
|
366
372
|
elsif isMouseOver?(cmd)
|
367
373
|
@totalCommands['mouseover']+=1
|
368
374
|
elsif isConnect?(cmd)
|
@@ -17,7 +17,7 @@ module Scoutui::Eyes
|
|
17
17
|
def createScout()
|
18
18
|
browserType = Scoutui::Base::UserVars.instance.getBrowserType()
|
19
19
|
|
20
|
-
|
20
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "BrowserType : #{browserType}"
|
21
21
|
eyeScout = EyeScout.new(browserType)
|
22
22
|
end
|
23
23
|
|
@@ -62,6 +62,10 @@ module Scoutui::Eyes
|
|
62
62
|
|
63
63
|
eyes.match_level = Applitools::Eyes::MATCH_LEVEL[match_level.to_sym]
|
64
64
|
|
65
|
+
if !Scoutui::Utils::TestUtils.instance.eyesMatchTimeout().nil?
|
66
|
+
eyes.match_timeout = Scoutui::Utils::TestUtils.instance.eyesMatchTimeout()
|
67
|
+
end
|
68
|
+
|
65
69
|
if !Scoutui::Utils::TestUtils.instance.eyesBatchname().nil?
|
66
70
|
batch = Applitools::Base::BatchInfo.new(Scoutui::Utils::TestUtils.instance.eyesBatchname())
|
67
71
|
|
data/lib/scoutui/utils/utils.rb
CHANGED
@@ -33,7 +33,7 @@ module Scoutui::Utils
|
|
33
33
|
@options={}
|
34
34
|
@currentTest={:reqid => 'UI', :testcase => '00' }
|
35
35
|
|
36
|
-
[:accounts, :browser, :capabilities, :diffs_dir, :test_file, :host, :loc, :title, :viewport,
|
36
|
+
[:accounts, :browser, :capabilities, :diffs_dir, :dut,:test_file, :host, :loc, :title, :viewport,
|
37
37
|
:userid, :password, :role, :json_config_file, :page_model, :report, :test_config,
|
38
38
|
:debug].each do |o|
|
39
39
|
@options[o]=nil
|
@@ -48,12 +48,13 @@ module Scoutui::Utils
|
|
48
48
|
@options[:batchid]=nil
|
49
49
|
@options[:batchname]=nil
|
50
50
|
@options[:log_level]=:info # :debug, :info, :warn, :error, :fatal
|
51
|
-
@options[:match_level]='
|
51
|
+
@options[:match_level]='layout2'
|
52
|
+
@options[:match_timeout]=nil # Is 2 by Default per Applitools
|
52
53
|
@options[:default_wait]=30 # seconds
|
53
54
|
@options[:debug]=false
|
54
55
|
@options[:fail_fast]=false
|
55
56
|
@options[:screenshots]=false
|
56
|
-
@options[:retries]=
|
57
|
+
@options[:retries]=1
|
57
58
|
|
58
59
|
|
59
60
|
@app_model=nil
|
@@ -250,7 +251,6 @@ module Scoutui::Utils
|
|
250
251
|
end
|
251
252
|
}
|
252
253
|
|
253
|
-
|
254
254
|
opt.on('-w', '--wait WaitOnElement') { |o|
|
255
255
|
if o.match(/\d+/)
|
256
256
|
@options[:default_wait] = o.to_i
|
@@ -273,6 +273,11 @@ module Scoutui::Utils
|
|
273
273
|
opt.on('--eyes:app AppName') { |o| @options[:app] = o }
|
274
274
|
opt.on('--eyes:title Title') { |o| @options[:title] = o }
|
275
275
|
opt.on('--eyes:viewport [resolution]') { |o| @options[:viewport] = o }
|
276
|
+
opt.on('--eyes:matchtimeout MatchTimeWait') { |o|
|
277
|
+
if o.match(/\d+/)
|
278
|
+
@options[:match_timeout] = o.to_i
|
279
|
+
end
|
280
|
+
}
|
276
281
|
|
277
282
|
opt.on('--report:junit File') { |o| @options[:report] = o }
|
278
283
|
|
@@ -311,6 +316,7 @@ module Scoutui::Utils
|
|
311
316
|
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " " + @options.to_s
|
312
317
|
Scoutui::Logger::LogMgr.instance.info "Test file => #{@options[:test_file]}"
|
313
318
|
Scoutui::Logger::LogMgr.instance.info "Host => #{@options[:host]}"
|
319
|
+
Scoutui::Logger::LogMgr.instance.info "Command => #{@options[:dut].to_s}"
|
314
320
|
Scoutui::Logger::LogMgr.instance.info "Loc => #{@options[:loc]}"
|
315
321
|
Scoutui::Logger::LogMgr.instance.info "Title => #{@options[:title]}"
|
316
322
|
Scoutui::Logger::LogMgr.instance.info "Browser => #{@options[:browser]}"
|
@@ -429,6 +435,10 @@ module Scoutui::Utils
|
|
429
435
|
@options[:enable_eyes]
|
430
436
|
end
|
431
437
|
|
438
|
+
def eyesMatchTimeout()
|
439
|
+
@options[:match_timeout]
|
440
|
+
end
|
441
|
+
|
432
442
|
def eyesFullscreen?
|
433
443
|
@options[:enable_fullscreen]
|
434
444
|
end
|
@@ -496,7 +506,7 @@ module Scoutui::Utils
|
|
496
506
|
|
497
507
|
[:accounts, :browser, :dut, :host, :role, :userid, :password].each do |k|
|
498
508
|
|
499
|
-
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " opt[test_config].has_key(#{k.to_s}) => #{@options[:test_config].has_key?(k.to_s)}"
|
509
|
+
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " opt[test_config].has_key(#{k.to_s}) => #{@options[:test_config].has_key?(k.to_s)}"
|
500
510
|
|
501
511
|
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " options[#{k}] : #{@options[k].to_s}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
502
512
|
if @options.has_key?(k) && !@options[k].nil?
|
@@ -519,9 +529,10 @@ module Scoutui::Utils
|
|
519
529
|
end
|
520
530
|
end
|
521
531
|
|
522
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " test_config => #{@options[:test_config]}"
|
532
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " test_config => #{@options[:test_config]}"
|
523
533
|
|
524
|
-
|
534
|
+
# If the user explicitly provided command file from args.
|
535
|
+
if @options.has_key?(:dut) && !@options[:dut].nil?
|
525
536
|
@options[:test_config]['dut']=@options[:dut]
|
526
537
|
end
|
527
538
|
|
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.3.
|
4
|
+
version: 2.0.3.56.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Kim
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -305,6 +305,7 @@ files:
|
|
305
305
|
- lib/scoutui/commands/commands.rb
|
306
306
|
- lib/scoutui/commands/connect.rb
|
307
307
|
- lib/scoutui/commands/define_commands.rb
|
308
|
+
- lib/scoutui/commands/dumpvars.rb
|
308
309
|
- lib/scoutui/commands/execute_commands.rb
|
309
310
|
- lib/scoutui/commands/exists_alert.rb
|
310
311
|
- lib/scoutui/commands/fill_form.rb
|