scoutui 2.0.5.4 → 2.0.5.5
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/bin/scoutui_driver.rb +20 -10
- data/lib/scoutui/appmodel/q_model.rb +12 -12
- data/lib/scoutui/base/assertions.rb +58 -5
- data/lib/scoutui/base/q_browser.rb +5 -0
- data/lib/scoutui/base/result_assertion.rb +54 -0
- data/lib/scoutui/base/user_vars.rb +1 -1
- data/lib/scoutui/base/visual_test_framework.rb +100 -17
- data/lib/scoutui/commands/clauses/then_clause.rb +8 -5
- data/lib/scoutui/commands/commands.rb +12 -4
- data/lib/scoutui/commands/define_commands.rb +3 -3
- data/lib/scoutui/commands/jsalert/action_jsalert.rb +64 -9
- data/lib/scoutui/commands/load_js.rb +1 -1
- data/lib/scoutui/commands/load_requirements.rb +2 -2
- data/lib/scoutui/commands/mouse_over.rb +1 -1
- data/lib/scoutui/commands/select_object.rb +1 -1
- data/lib/scoutui/commands/select_window.rb +2 -2
- data/lib/scoutui/commands/strategy.rb +15 -3
- data/lib/scoutui/commands/switch_frame.rb +10 -10
- data/lib/scoutui/commands/type.rb +31 -9
- data/lib/scoutui/commands/update_url.rb +4 -1
- data/lib/scoutui/commands/upload_files.rb +2 -2
- data/lib/scoutui/commands/utils.rb +24 -2
- data/lib/scoutui/commands/verify_element.rb +62 -11
- data/lib/scoutui/eyes/eye_scout.rb +11 -3
- data/lib/scoutui/eyes/utils.rb +2 -2
- data/lib/scoutui/utils/utils.rb +44 -13
- data/lib/scoutui/version.rb +1 -1
- metadata +3 -2
@@ -48,7 +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
|
-
|
51
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Press down"
|
52
52
|
drv.action.send_keys(:arrow_down).perform
|
53
53
|
|
54
54
|
elsif _subcmd.match(/^\s*press\(__UP__\)$/)
|
@@ -70,6 +70,9 @@ module Scoutui::Commands
|
|
70
70
|
_c = Scoutui::Commands::ClickObject.new(_subcmd)
|
71
71
|
_c.run(driver: drv)
|
72
72
|
|
73
|
+
elsif _subcmd.match(/^\s*press\(__SPACE__\)\s*$/)
|
74
|
+
drv.action.send_keys(:space).perform
|
75
|
+
|
73
76
|
elsif Scoutui::Commands::Utils.instance.isMouseOver?(_subcmd)
|
74
77
|
_cmd='MouseOver'
|
75
78
|
_c = Scoutui::Commands::MouseOver.new(_subcmd)
|
@@ -131,10 +134,10 @@ module Scoutui::Commands
|
|
131
134
|
|
132
135
|
_activeElt = @drv.switch_to.active_element
|
133
136
|
|
134
|
-
|
137
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ActiveElt => #{_activeElt.text}"
|
135
138
|
|
136
139
|
if _historyElts.size > 0 && _historyElts.has_key?(_activeElt)
|
137
|
-
|
140
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "****** WRAPPED ******"; #STDIN.gets
|
138
141
|
|
139
142
|
_loop=false
|
140
143
|
else
|
@@ -145,7 +148,7 @@ module Scoutui::Commands
|
|
145
148
|
|
146
149
|
if _loop && !pageElt.nil? && pageElt['page'].has_key?('until')
|
147
150
|
_expected=Scoutui::Base::VisualTestFramework::processAsserts(@drv, pageElt['page']['until'], false)
|
148
|
-
|
151
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ==> until : #{_expected}"
|
149
152
|
|
150
153
|
_loop=!_expected
|
151
154
|
|
@@ -162,7 +165,7 @@ module Scoutui::Commands
|
|
162
165
|
|
163
166
|
if !_bUntil && _i > 75
|
164
167
|
_loop=false
|
165
|
-
|
168
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ** BREAK OUT **"; #STDIN.gets
|
166
169
|
end
|
167
170
|
|
168
171
|
end # while()
|
@@ -28,7 +28,7 @@ module Scoutui::Commands
|
|
28
28
|
|
29
29
|
if _subcmd.is_a?(String)
|
30
30
|
|
31
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " |
|
31
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " | simpleCmd => #{_subcmd}"
|
32
32
|
|
33
33
|
if _subcmd.match(/^\s*press\(__TAB__\)$/)
|
34
34
|
drv.action.send_keys(:tab).perform
|
@@ -65,22 +65,30 @@ module Scoutui::Commands
|
|
65
65
|
drv.action.key_up(:command).perform
|
66
66
|
Scoutui::Base::TestContext.instance.set(:command_down, false)
|
67
67
|
|
68
|
-
elsif _subcmd.match(/^\s*press\(__CONTROL__\)
|
68
|
+
elsif _subcmd.match(/^\s*press\(__CONTROL__\)\s*$/)
|
69
69
|
|
70
70
|
drv.driver.action.key_down(:control).perform
|
71
71
|
drv.action.key_up(:control).perform
|
72
72
|
|
73
73
|
# Check for list of elements to click
|
74
74
|
|
75
|
-
elsif _subcmd.match(/^\s*press\(__DOWN__\)
|
75
|
+
elsif _subcmd.match(/^\s*press\(__DOWN__\)\s*$/)
|
76
76
|
drv.action.send_keys(:arrow_down).perform
|
77
77
|
_activeElt = drv.switch_to.active_element
|
78
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " activeElt.Value: #{_activeElt.attribute('value').to_s}"
|
78
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " activeElt.Value: #{_activeElt.attribute('value').to_s} Text: #{_activeElt.attribute('text').to_s}"
|
79
79
|
|
80
|
+
elsif _subcmd.match(/^\s*press\(__LEFT__\)\s*$/)
|
81
|
+
drv.action.send_keys(:arrow_left).perform
|
82
|
+
|
83
|
+
elsif _subcmd.match(/^\s*press\(__RIGHT__\)\s*$/)
|
84
|
+
drv.action.send_keys(:arrow_right).perform
|
80
85
|
|
81
86
|
elsif _subcmd.match(/^\s*press\(__UP__\)$/)
|
82
87
|
drv.action.send_keys(:arrow_up).perform
|
83
88
|
|
89
|
+
elsif _subcmd.match(/^\s*press\(__SPACE__\)$/)
|
90
|
+
drv.action.send_keys(:space).perform
|
91
|
+
|
84
92
|
elsif _subcmd.match(/^\s*press\(__ENTER__\)\s*$/)
|
85
93
|
drv.action.send_keys(:enter).perform
|
86
94
|
|
@@ -22,7 +22,7 @@ module Scoutui::Commands
|
|
22
22
|
|
23
23
|
id=e['page']['id'].to_s
|
24
24
|
commands = e['page']['commands']
|
25
|
-
|
25
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " id, commands => #{id}, #{commands}"
|
26
26
|
|
27
27
|
|
28
28
|
c=nil
|
@@ -39,12 +39,12 @@ module Scoutui::Commands
|
|
39
39
|
_cmd = _cmd + r.to_s + ";"
|
40
40
|
end
|
41
41
|
|
42
|
-
|
42
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " command(#{e['page']['id'].to_s}, #{_cmd})"
|
43
43
|
c=CmdShellMgr::DSL.instance.cmd(:cmd => "command(#{e['page']['id'].to_s}, #{_cmd})")
|
44
44
|
|
45
45
|
|
46
46
|
else
|
47
|
-
|
47
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Unknown DSL cmd"
|
48
48
|
|
49
49
|
end
|
50
50
|
|
@@ -5,15 +5,31 @@ module Scoutui::Commands::JsAlert
|
|
5
5
|
class ExistsAlert < Scoutui::Commands::Command
|
6
6
|
|
7
7
|
|
8
|
+
def initialize(_cmd, _drv=nil)
|
9
|
+
super(_cmd, _drv)
|
10
|
+
|
11
|
+
@assertText=nil
|
12
|
+
@alert_text=nil
|
13
|
+
@_alertExists=false
|
14
|
+
end
|
15
|
+
|
16
|
+
def alertExists?
|
17
|
+
@_alertExists
|
18
|
+
end
|
19
|
+
|
20
|
+
def getAssertText()
|
21
|
+
@assertText
|
22
|
+
end
|
23
|
+
|
8
24
|
def execute(drv=nil)
|
9
25
|
@drv=drv if !drv.nil?
|
10
26
|
|
11
27
|
_rc=nil
|
12
|
-
_alertExists=false
|
28
|
+
@_alertExists=false
|
13
29
|
|
14
30
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " command => #{@cmd.to_s}"
|
15
31
|
|
16
|
-
_action=@cmd.match(/(exist[s]*_*alert|existAlert|existsAlert|existsJsAlert|existsJsConfirm|existsJsPrompt)\s*\((.*)\)/i)[2].to_s.strip
|
32
|
+
_action=@cmd.match(/[!]*(exist[s]*_*alert|existAlert|existsAlert|existsJsAlert|existsJsConfirm|existsJsPrompt)\s*\((.*)\)/i)[2].to_s.strip
|
17
33
|
|
18
34
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ExistsAlert(#{_action})"
|
19
35
|
|
@@ -23,10 +39,12 @@ module Scoutui::Commands::JsAlert
|
|
23
39
|
alert=@drv.switch_to.alert
|
24
40
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " | alert => #{alert.class.to_s}"
|
25
41
|
|
26
|
-
_alertExists = alert.is_a?(Selenium::WebDriver::Alert)
|
27
|
-
if _alertExists && !(_action.nil? && _action.empty?)
|
42
|
+
@_alertExists = alert.is_a?(Selenium::WebDriver::Alert)
|
43
|
+
if @_alertExists && !(_action.nil? && _action.empty?)
|
28
44
|
_r = Regexp.new _action.to_s
|
29
45
|
|
46
|
+
@alert_text = alert.text.to_s
|
47
|
+
|
30
48
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " _r => #{_r}"
|
31
49
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " _t => #{alert.text.to_s}"
|
32
50
|
_rc=!alert.text.to_s.match(_r).nil?
|
@@ -39,21 +57,58 @@ module Scoutui::Commands::JsAlert
|
|
39
57
|
alert=nil
|
40
58
|
end
|
41
59
|
|
42
|
-
|
60
|
+
@assertText = "Verify JsAlert is present"
|
61
|
+
|
62
|
+
if @cmd.match(/^\s*e/i)
|
43
63
|
|
44
|
-
|
45
|
-
|
64
|
+
if (_action.empty?)
|
65
|
+
_rc = @_alertExists
|
66
|
+
else
|
67
|
+
@assertText = "Verify JsAlert exists with matching regex #{_action} (actual: #{@alert_text})"
|
68
|
+
_r = Regexp.new _action.to_s
|
69
|
+
_rc = @_alertExists && !@alert_text.match(_r).nil?
|
70
|
+
end
|
46
71
|
|
72
|
+
##
|
73
|
+
# Verify if alert is explicitly NOT present (e.g. !existsAlert() )
|
74
|
+
# or,
|
75
|
+
# Verify if the existing Alert DOES NOT have matching text.
|
76
|
+
##
|
77
|
+
elsif @cmd.match(/^\s*!/)
|
78
|
+
|
79
|
+
_rc = false
|
80
|
+
|
81
|
+
if !@_alertExists && _action.empty?
|
82
|
+
##
|
83
|
+
# !existsAlert()
|
84
|
+
##
|
85
|
+
@assertText = "Verify JsAlert is not present"
|
86
|
+
_rc = true
|
87
|
+
elsif !@_alertExists && !_action.empty?
|
88
|
+
@assertText = "Verify JsAlert exists without matching #{_action}"
|
89
|
+
_rc = false
|
90
|
+
elsif @_alertExists
|
91
|
+
@assertText = "Verify existing JsAlert does not match #{_action}"
|
92
|
+
_rc = @alert_text.match(/#{_action}/).nil?
|
93
|
+
end
|
47
94
|
|
48
|
-
setResult(_rc)
|
49
95
|
end
|
50
96
|
|
51
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ExistsAlert() => #{alert.class.to_s} rc:#{_rc.to_s}"
|
52
97
|
|
53
98
|
|
99
|
+
# Testmgr::TestReport.instance.getReq('UI').testcase('expectJsAlert').add(@_alertExists, assertText)
|
100
|
+
|
101
|
+
# if !(_action.nil? && _action.empty?)
|
102
|
+
# Testmgr::TestReport.instance.getReq('UI').get_child('expectJsAlert').add(_rc, assertText)
|
103
|
+
# end
|
104
|
+
|
105
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ExistsAlert() => #{alert.class.to_s} rc:#{_rc.to_s}"
|
106
|
+
setResult(_rc)
|
107
|
+
|
54
108
|
end
|
55
109
|
|
56
110
|
|
111
|
+
|
57
112
|
end
|
58
113
|
|
59
114
|
|
@@ -23,10 +23,10 @@ module Scoutui::Commands
|
|
23
23
|
e['page']['files'].each do |r|
|
24
24
|
y=YAML.load_stream File.read(r)
|
25
25
|
|
26
|
-
|
26
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " *** REQMT => #{y}"
|
27
27
|
|
28
28
|
y.each do |_y|
|
29
|
-
|
29
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ===> #{_y}"
|
30
30
|
Scoutui::Base::Requirements.instance.add(_y['requirement']['name'], _y['requirement']['assertions'])
|
31
31
|
end
|
32
32
|
|
@@ -28,7 +28,7 @@ module Scoutui::Commands
|
|
28
28
|
elsif _pg.is_a?(String)
|
29
29
|
isVisible=Scoutui::Base::Assertions.instance.isVisible(@drv, _pg, _r)
|
30
30
|
else
|
31
|
-
|
31
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " => #{_pg}"
|
32
32
|
end
|
33
33
|
|
34
34
|
# Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " IsVisible #{isVisible} - PAUSE"; gets
|
@@ -29,7 +29,7 @@ module Scoutui::Commands
|
|
29
29
|
|
30
30
|
|
31
31
|
if e.is_a?(Hash) && e.has_key?('page') && e['page'].has_key?('frames')
|
32
|
-
|
32
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " frames => #{e['page']['frames']}";
|
33
33
|
end
|
34
34
|
|
35
35
|
_seekTime[:start]=Time.now
|
@@ -35,7 +35,7 @@ module Scoutui::Commands
|
|
35
35
|
|
36
36
|
|
37
37
|
@drv.window_handles.each do |_w|
|
38
|
-
|
38
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "#{i}. #{_w.class.to_s}"
|
39
39
|
|
40
40
|
if matchWith[:by]==:index && i==matchWith[:value]
|
41
41
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " select_window : #{i}"
|
@@ -62,7 +62,7 @@ module Scoutui::Commands
|
|
62
62
|
|
63
63
|
@drv.switch_to.window(_w) if matchWith[:by]!=:regex
|
64
64
|
|
65
|
-
|
65
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " switched => #{@drv.title}"
|
66
66
|
break
|
67
67
|
end
|
68
68
|
|
@@ -243,6 +243,11 @@ module Scoutui::Commands
|
|
243
243
|
|
244
244
|
sauce_endpoint = "http://#{ENV['SAUCE_USERNAME']}:#{ENV['SAUCE_ACCESS_KEY']}@ondemand.saucelabs.com:80/wd/hub"
|
245
245
|
|
246
|
+
if Scoutui::Utils::TestUtils.instance.getSauceTunnel()
|
247
|
+
caps[:tunnelIdentifier]=Scoutui::Utils::TestUtils.instance.getSauceTunnel()
|
248
|
+
puts __FILE__ + (__LINE__).to_s + " TunnelID: #{caps[:tunnelIdentifier]}"
|
249
|
+
end
|
250
|
+
|
246
251
|
begin
|
247
252
|
if client.nil?
|
248
253
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " caps => #{caps}"
|
@@ -270,7 +275,8 @@ module Scoutui::Commands
|
|
270
275
|
|
271
276
|
|
272
277
|
selenium_server=Scoutui::Utils::TestUtils.instance.getSeleniumServer()
|
273
|
-
|
278
|
+
|
279
|
+
# selenium_server='http://localhost:8001' if selenium_server.nil?
|
274
280
|
|
275
281
|
if isHeadlessCap?(caps) && caps.has_key?(:useragent)
|
276
282
|
_cap=Selenium::WebDriver::Remote::Capabilities.phantomjs('phantomjs.page.settings.userAgent' => caps[:useragent])
|
@@ -281,7 +287,13 @@ module Scoutui::Commands
|
|
281
287
|
_connected=false
|
282
288
|
_tm={:start => Time.now, :end => nil }
|
283
289
|
begin
|
284
|
-
|
290
|
+
if !selenium_server.nil?
|
291
|
+
@drv=Selenium::WebDriver.for :remote, :url => selenium_server, :desired_capabilities => _cap
|
292
|
+
else
|
293
|
+
@drv=Selenium::WebDriver.for :phantomjs
|
294
|
+
#@drv=Selenium::WebDriver.for :remote, :desired_capabilities => _cap
|
295
|
+
end
|
296
|
+
|
285
297
|
_tm[:end]=Time.now
|
286
298
|
_connected=true
|
287
299
|
setViewport()
|
@@ -316,7 +328,7 @@ module Scoutui::Commands
|
|
316
328
|
end
|
317
329
|
|
318
330
|
|
319
|
-
if opts.is_a?(Hash) && opts.has_key?(:loadModel).nil?
|
331
|
+
if opts.is_a?(Hash) && !opts.has_key?(:loadModel).nil?
|
320
332
|
loadModel(opts[:loadModel])
|
321
333
|
end
|
322
334
|
|
@@ -10,7 +10,7 @@ module Scoutui::Commands
|
|
10
10
|
_locator = @cmd.match(/frame\s*\((.*)\)/)[1].to_s.strip
|
11
11
|
|
12
12
|
|
13
|
-
|
13
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " frame : #{_locator}"
|
14
14
|
|
15
15
|
rc = Array.new()
|
16
16
|
|
@@ -27,7 +27,7 @@ module Scoutui::Commands
|
|
27
27
|
|
28
28
|
_obj = @drv.find_elements(:xpath, _locator)
|
29
29
|
|
30
|
-
|
30
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " frames => #{frames} : #{_obj}"
|
31
31
|
|
32
32
|
if _obj.empty?
|
33
33
|
|
@@ -35,14 +35,14 @@ module Scoutui::Commands
|
|
35
35
|
|
36
36
|
|
37
37
|
_name = frames[i].attribute('name')
|
38
|
-
|
38
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Process frame[#{i}] : #{frames[i].attribute('name')}"
|
39
39
|
|
40
40
|
@drv.switch_to.frame _name
|
41
41
|
# @drv.switch_to.frame i
|
42
42
|
|
43
43
|
_hits = execute(drv, _e)
|
44
44
|
|
45
|
-
|
45
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " hits => #{_hits}"
|
46
46
|
|
47
47
|
|
48
48
|
@drv.switch_to.parent_frame
|
@@ -58,7 +58,7 @@ module Scoutui::Commands
|
|
58
58
|
end
|
59
59
|
|
60
60
|
|
61
|
-
|
61
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " _obj => #{_obj}"
|
62
62
|
|
63
63
|
_obj
|
64
64
|
|
@@ -74,7 +74,7 @@ module Scoutui::Commands
|
|
74
74
|
_locator = @cmd.match(/frame\s*\((.*)\)/)[1].to_s.strip
|
75
75
|
|
76
76
|
|
77
|
-
|
77
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " frame : #{_locator}"
|
78
78
|
|
79
79
|
rc = Array.new()
|
80
80
|
|
@@ -91,20 +91,20 @@ module Scoutui::Commands
|
|
91
91
|
|
92
92
|
_obj = @drv.find_elements(:xpath, _locator)
|
93
93
|
|
94
|
-
|
94
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " frames => #{frames} : #{_obj}"
|
95
95
|
|
96
96
|
for i in 0 .. (frames.size - 1)
|
97
97
|
|
98
98
|
|
99
99
|
_name = frames[i].attribute('name')
|
100
|
-
|
100
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Process frame[#{i}] : #{frames[i].attribute('name')}"
|
101
101
|
|
102
102
|
@drv.switch_to.frame _name
|
103
103
|
# @drv.switch_to.frame i
|
104
104
|
|
105
105
|
_hits = execute(drv, _e)
|
106
106
|
|
107
|
-
|
107
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " hits => #{_hits}"
|
108
108
|
|
109
109
|
rc.concat _hits if !_hits.empty?
|
110
110
|
|
@@ -113,7 +113,7 @@ module Scoutui::Commands
|
|
113
113
|
end
|
114
114
|
|
115
115
|
|
116
|
-
|
116
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " rc => #{rc}"
|
117
117
|
|
118
118
|
rc
|
119
119
|
|
@@ -5,6 +5,8 @@ module Scoutui::Commands
|
|
5
5
|
class Type < Command
|
6
6
|
|
7
7
|
KEYBOARD_CMDS={
|
8
|
+
'__CLEAR__' => { :val => :clear },
|
9
|
+
'__CtlA__' => { :val => :ctl_a },
|
8
10
|
'__DELETE__' => { :val => :delete },
|
9
11
|
'__DOWN__' => { :val => :arrow_down },
|
10
12
|
'__ENTER__' => { :val => :enter },
|
@@ -83,7 +85,7 @@ module Scoutui::Commands
|
|
83
85
|
|
84
86
|
begin
|
85
87
|
|
86
|
-
if @cmd.match(/^type\(
|
88
|
+
if @cmd.match(/^type\([fF]ocused\s*,\s*.*\)\s*$/)
|
87
89
|
|
88
90
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Type into active element"
|
89
91
|
obj = @drv.switch_to.active_element
|
@@ -95,7 +97,7 @@ module Scoutui::Commands
|
|
95
97
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " | active.Text : " + obj.text.to_s
|
96
98
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " | active.Value: " + obj.attribute('value').to_s
|
97
99
|
|
98
|
-
_val = @cmd.match(/^type\(
|
100
|
+
_val = @cmd.match(/^type\([fF]ocused\s*,\s*(.*)\)\s*$/)[1].to_s
|
99
101
|
|
100
102
|
if KEYBOARD_CMDS.has_key?(_val)
|
101
103
|
_val = KEYBOARD_CMDS[_val][:val]
|
@@ -116,6 +118,18 @@ module Scoutui::Commands
|
|
116
118
|
|
117
119
|
if KEYBOARD_CMDS[_keyVal][:val]==:custom
|
118
120
|
KEYBOARD_CMDS[_keyVal][:run].call(@drv)
|
121
|
+
elsif KEYBOARD_CMDS[_keyVal][:val]==:clear
|
122
|
+
obj = @drv.switch_to.active_element
|
123
|
+
obj.clear
|
124
|
+
elsif KEYBOARD_CMDS[_keyVal][:val]==:ctl_a
|
125
|
+
# puts __FILE__ + (__LINE__).to_s + " CTL_A"; STDIN.gets;
|
126
|
+
# obj = @drv.switch_to.active_element
|
127
|
+
# obj.send_keys([:control, 'a']).perform
|
128
|
+
# @drv.action.key_down(:control).key_down('a').perform
|
129
|
+
@drv.action.key_down(:command)
|
130
|
+
.send_keys("a")
|
131
|
+
.key_up(:command)
|
132
|
+
.perform
|
119
133
|
else
|
120
134
|
@drv.action.send_keys(KEYBOARD_CMDS[_keyVal][:val]).perform
|
121
135
|
end
|
@@ -123,8 +137,6 @@ module Scoutui::Commands
|
|
123
137
|
thenClause = Scoutui::Commands::ThenClause.new(@drv)
|
124
138
|
doUntil = Scoutui::Commands::DoUntil.new(@drv)
|
125
139
|
|
126
|
-
_tm[:start]=Time.now
|
127
|
-
|
128
140
|
# _bUntil = thenClause.execute_until(pageElt)
|
129
141
|
_bUntil = doUntil.do_until(pageElt)
|
130
142
|
_tm[:end]=Time.now
|
@@ -148,7 +160,9 @@ module Scoutui::Commands
|
|
148
160
|
|
149
161
|
_tm[:start]=Time.now
|
150
162
|
|
151
|
-
obj = Scoutui::Base::QBrowser.getElement(@drv,
|
163
|
+
obj = Scoutui::Base::QBrowser.getElement(@drv,
|
164
|
+
Scoutui::Base::UserVars.instance.normalize(_xpath),
|
165
|
+
Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
|
152
166
|
|
153
167
|
_tm[:end]=Time.now
|
154
168
|
|
@@ -170,7 +184,9 @@ module Scoutui::Commands
|
|
170
184
|
wait = Selenium::WebDriver::Wait.new(:timeout => Scoutui::Commands::Utils.instance.getTimeout)
|
171
185
|
isDisplayed = wait.until {
|
172
186
|
if Scoutui::Base::QBrowser.isStale?(obj)
|
173
|
-
obj = Scoutui::Base::QBrowser.findElement(@drv,
|
187
|
+
obj = Scoutui::Base::QBrowser.findElement(@drv,
|
188
|
+
Scoutui::Base::UserVars.instance.normalize(_xpath),
|
189
|
+
Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
|
174
190
|
end
|
175
191
|
true if obj.displayed?
|
176
192
|
}
|
@@ -188,7 +204,9 @@ module Scoutui::Commands
|
|
188
204
|
|
189
205
|
(0..3).each do |j|
|
190
206
|
if Scoutui::Base::QBrowser.isStale?(obj)
|
191
|
-
obj = Scoutui::Base::QBrowser.getElement(@drv,
|
207
|
+
obj = Scoutui::Base::QBrowser.getElement(@drv,
|
208
|
+
Scoutui::Base::UserVars.instance.normalize(_xpath),
|
209
|
+
Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
|
192
210
|
_tm[:end]=Time.now
|
193
211
|
else
|
194
212
|
break
|
@@ -251,14 +269,18 @@ module Scoutui::Commands
|
|
251
269
|
if _stale
|
252
270
|
_inRow=0
|
253
271
|
sleep 0.5
|
254
|
-
obj = Scoutui::Base::QBrowser.getElement(@drv,
|
272
|
+
obj = Scoutui::Base::QBrowser.getElement(@drv,
|
273
|
+
Scoutui::Base::UserVars.instance.normalize(_xpath),
|
274
|
+
Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
|
255
275
|
_tm[:end]=Time.now
|
256
276
|
else
|
257
277
|
_inRow+=1
|
258
278
|
|
259
279
|
break if _inRow >= 3
|
260
280
|
|
261
|
-
obj = Scoutui::Base::QBrowser.getElement(@drv,
|
281
|
+
obj = Scoutui::Base::QBrowser.getElement(@drv,
|
282
|
+
Scoutui::Base::UserVars.instance.normalize(_xpath),
|
283
|
+
Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
|
262
284
|
_tm[:end]=Time.now
|
263
285
|
end
|
264
286
|
|