scoutui 2.0.2 → 2.0.3.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 +119 -0
- data/lib/scoutui/base/visual_test_framework.rb +5 -1
- data/lib/scoutui/commands/click_object.rb +35 -15
- data/lib/scoutui/commands/command.rb +9 -0
- data/lib/scoutui/commands/commands.rb +13 -3
- data/lib/scoutui/commands/select_object.rb +54 -4
- data/lib/scoutui/commands/switch_frame.rb +127 -0
- data/lib/scoutui/commands/type.rb +3 -3
- data/lib/scoutui/commands/utils.rb +44 -0
- data/lib/scoutui/version.rb +1 -1
- data/scoutui.gemspec +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a056f11ea1fd2e80f741a9994e95e21cd95d7d6
|
4
|
+
data.tar.gz: 2a0f010411e81363f9b766b77758473fe546639e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1cc1fb08afc2003af11489e8ffae2453049769603e1d540492f063572aeccf7058a575db2e9183678b764efc961a254dab64d49af7495e9ce767e12d2fc3810
|
7
|
+
data.tar.gz: edd5aada155f93a764849aad2d7e25e6be61a4a0416018277745d7e5a6b1b9f6eca7f18c0b7a6dc3730b93082efb8dab9234e2be22eac04f2cc57ffc9a89d380
|
@@ -91,6 +91,125 @@ module Scoutui::Base
|
|
91
91
|
rc
|
92
92
|
end
|
93
93
|
|
94
|
+
|
95
|
+
# e : Hash : Command stanza from YML
|
96
|
+
def self.swtich_frame(drv, e)
|
97
|
+
if e.is_a?(Hash) && e.has_key?('page') && e['page'].has_key?('frames')
|
98
|
+
puts __FILE__ + (__LINE__).to_s + " frames => #{e['page']['frames']}";
|
99
|
+
|
100
|
+
frames=e['page']['frames']
|
101
|
+
frame_list=frames.split(/(frame\(.*\))\.(?=[\w])/)
|
102
|
+
frame_list.each do |_f|
|
103
|
+
|
104
|
+
|
105
|
+
if !_f.empty?
|
106
|
+
_id = _f.match(/frame\((.*)\)/)[1]
|
107
|
+
|
108
|
+
puts __FILE__ + (__LINE__).to_s + " switch_to.frame #{_id}"
|
109
|
+
|
110
|
+
drv.switch_to.frame(_id.to_s.strip)
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.findElement(drv, _locator, _frames, _timeout=nil)
|
119
|
+
|
120
|
+
if Scoutui::Commands::Utils.instance.isFrameSearch?
|
121
|
+
hits = Scoutui::Base::QBrowser.frame_getObject(drv, _locator, _timeout)
|
122
|
+
|
123
|
+
puts __FILE__ + (__LINE__).to_s + " hits => #{hits.class} : #{hits}"
|
124
|
+
if hits.is_a?(Array) && !hits.empty?
|
125
|
+
obj=hits[0]
|
126
|
+
elsif hits.is_a?(Selenium::WebDriver::Element)
|
127
|
+
obj=hits
|
128
|
+
end
|
129
|
+
|
130
|
+
else
|
131
|
+
obj = Scoutui::Base::QBrowser.getObject(@drv, _locator, _timeout)
|
132
|
+
end
|
133
|
+
|
134
|
+
|
135
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " findElement(#{_frames}, #{_locator}) => #{obj}"
|
136
|
+
obj
|
137
|
+
|
138
|
+
end
|
139
|
+
|
140
|
+
def self.frame_getObject(drv, _locator, _timeout=nil)
|
141
|
+
|
142
|
+
puts __FILE__ + (__LINE__).to_s + " frame_getObject : #{_locator}"
|
143
|
+
|
144
|
+
rc = Array.new()
|
145
|
+
|
146
|
+
frames = drv.find_elements(:xpath, '//iframe')
|
147
|
+
|
148
|
+
if frames.size == 0
|
149
|
+
frames = drv.find_elements(:xpath, '//frame')
|
150
|
+
end
|
151
|
+
|
152
|
+
if frames.size > 0
|
153
|
+
rc.concat frames
|
154
|
+
end
|
155
|
+
|
156
|
+
|
157
|
+
# _obj = drv.find_elements(:xpath, _locator)
|
158
|
+
_obj = getObject(drv, _locator, _timeout)
|
159
|
+
|
160
|
+
puts __FILE__ + (__LINE__).to_s + " frames => #{frames} : #{_obj}"
|
161
|
+
|
162
|
+
if _obj.nil? || (_obj.is_a?(Array) && _obj.empty?)
|
163
|
+
|
164
|
+
for i in 0 .. (frames.size - 1)
|
165
|
+
|
166
|
+
begin
|
167
|
+
|
168
|
+
_tag = frames[i].attribute('name')
|
169
|
+
|
170
|
+
if _tag.empty?
|
171
|
+
_tag = frames[i].attribute('id')
|
172
|
+
end
|
173
|
+
|
174
|
+
if _tag.empty?
|
175
|
+
_tag = i
|
176
|
+
end
|
177
|
+
|
178
|
+
|
179
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Process frame[#{i}] : #{_tag}"
|
180
|
+
|
181
|
+
drv.switch_to.frame _tag
|
182
|
+
|
183
|
+
_hits = frame_getObject(drv, _locator, 3)
|
184
|
+
rescue => ex
|
185
|
+
Scoutui::Logger::LogMgr.instance.debug "Error during processing: #{$!}"
|
186
|
+
Scoutui::Logger::LogMgr.instance.debug "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
|
187
|
+
end
|
188
|
+
|
189
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " hits => #{_hits}"
|
190
|
+
|
191
|
+
if _hits.is_a?(Array) && _hits.size > 0
|
192
|
+
_obj=_hits[0]
|
193
|
+
|
194
|
+
break
|
195
|
+
elsif _hits.is_a?(Selenium::WebDriver::Element)
|
196
|
+
_obj = _hits
|
197
|
+
break
|
198
|
+
end
|
199
|
+
|
200
|
+
drv.switch_to.parent_frame
|
201
|
+
|
202
|
+
end
|
203
|
+
|
204
|
+
end
|
205
|
+
|
206
|
+
|
207
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " _obj => #{_obj}"
|
208
|
+
|
209
|
+
_obj
|
210
|
+
|
211
|
+
end
|
212
|
+
|
94
213
|
# http://stackoverflow.com/questions/15164742/combining-implicit-wait-and-explicit-wait-together-results-in-unexpected-wait-ti#answer-15174978
|
95
214
|
def self.getObject(drv, obj, _timeout=nil)
|
96
215
|
|
@@ -446,7 +446,7 @@ module Scoutui::Base
|
|
446
446
|
|
447
447
|
# Check if the verification is a "windows.*" verification
|
448
448
|
|
449
|
-
if !xpath.match(
|
449
|
+
if !xpath.match(/^\*window[s]\.length\s*\(\d+\)/).nil?
|
450
450
|
_expected_length=xpath.match(/window[s]\.length\s*\((.*)\)/i)[1].to_s
|
451
451
|
|
452
452
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "\tExpect window.length is #{_expected_length}"
|
@@ -682,6 +682,10 @@ module Scoutui::Base
|
|
682
682
|
_region = e[STEP_KEY]["region"]
|
683
683
|
_reqid = e[STEP_KEY]["reqid"]
|
684
684
|
_execute_when = e[STEP_KEY]["execute_when"]
|
685
|
+
_use_frames = e[STEP_KEY]["frames"]
|
686
|
+
|
687
|
+
|
688
|
+
Scoutui::Commands::Utils.instance.reset(e)
|
685
689
|
|
686
690
|
if e[STEP_KEY].has_key?("timeout")
|
687
691
|
Scoutui::Commands::Utils.instance.setTimeout(e[STEP_KEY]["timeout"])
|
@@ -39,25 +39,14 @@ module Scoutui::Commands
|
|
39
39
|
|
40
40
|
end
|
41
41
|
|
42
|
-
def execute(drv)
|
42
|
+
def execute(drv, e=nil)
|
43
43
|
@drv=drv if !drv.nil?
|
44
44
|
|
45
45
|
_req = Scoutui::Utils::TestUtils.instance.getReq()
|
46
|
+
|
46
47
|
_locator = @cmd.match(/click\s*\((.*)\)/)[1].to_s.strip
|
47
48
|
Scoutui::Logger::LogMgr.instance.command.info __FILE__ + (__LINE__).to_s + " clickObject => #{_locator}"
|
48
49
|
|
49
|
-
# _vars = _locator.scan(/(\$\{.*?\})/)
|
50
|
-
# _vars.each do | _v|
|
51
|
-
# if _v.length==1
|
52
|
-
#
|
53
|
-
# _u = Scoutui::Base::UserVars.instance.get(_v[0].to_s)
|
54
|
-
# puts __FILE__ + (__LINE__).to_s + " Normalize(#{_v}) => #{_u}"
|
55
|
-
#
|
56
|
-
# _locator.gsub!(_v[0].to_s, _u)
|
57
|
-
# end
|
58
|
-
#
|
59
|
-
# end
|
60
|
-
|
61
50
|
|
62
51
|
# _locator = Scoutui::Base::UserVars.instance.get(_locator)
|
63
52
|
_locator = Scoutui::Base::UserVars.instance.normalize(_locator)
|
@@ -67,9 +56,36 @@ module Scoutui::Commands
|
|
67
56
|
_clicked=false
|
68
57
|
|
69
58
|
begin
|
70
|
-
|
59
|
+
|
60
|
+
# _frames = Scoutui::Base::QBrowser.getObjectx(@drv, _locator, Scoutui::Commands::Utils.instance.getTimeout)
|
61
|
+
|
62
|
+
if false
|
63
|
+
|
64
|
+
if e.is_a?(Hash) && e.has_key?('page') && e['page'].has_key?('frames')
|
65
|
+
puts __FILE__ + (__LINE__).to_s + " frames => #{e['page']['frames']}";
|
66
|
+
frames=e['page']['frames']
|
67
|
+
frame_list=frames.split(/(frame\(.*\))\.(?=[\w])/)
|
68
|
+
frame_list.each do |_f|
|
71
69
|
|
72
70
|
|
71
|
+
if !_f.empty?
|
72
|
+
_id = _f.match(/frame\((.*)\)/)[1]
|
73
|
+
|
74
|
+
puts __FILE__ + (__LINE__).to_s + " switch_to.frame #{_id}"
|
75
|
+
|
76
|
+
@drv.switch_to.frame(_id.to_s.strip)
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
obj = Scoutui::Base::QBrowser.getObject(@drv, _locator, Scoutui::Commands::Utils.instance.getTimeout)
|
83
|
+
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
obj = Scoutui::Base::QBrowser.findElement(@drv, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
|
88
|
+
|
73
89
|
|
74
90
|
if obj
|
75
91
|
|
@@ -83,6 +99,10 @@ module Scoutui::Commands
|
|
83
99
|
}
|
84
100
|
|
85
101
|
if isDisplayed
|
102
|
+
|
103
|
+
isEnabled = wait.until { obj.enabled? }
|
104
|
+
|
105
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " obj is enabled : #{isEnabled}"
|
86
106
|
obj.click
|
87
107
|
_clicked=true
|
88
108
|
|
@@ -98,7 +118,7 @@ module Scoutui::Commands
|
|
98
118
|
end
|
99
119
|
|
100
120
|
rescue => ex
|
101
|
-
Scoutui::Logger::LogMgr.instance.warn "Error during processing: #{
|
121
|
+
Scoutui::Logger::LogMgr.instance.warn "Error during processing: #{ex}"
|
102
122
|
Scoutui::Logger::LogMgr.instance.warn "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
|
103
123
|
end
|
104
124
|
|
@@ -9,10 +9,19 @@ module Scoutui::Commands
|
|
9
9
|
attr_accessor :locator
|
10
10
|
attr_accessor :executed
|
11
11
|
attr_accessor :executed_result
|
12
|
+
attr_accessor :stanza
|
12
13
|
|
13
14
|
def initialize(_cmd, _drv=nil)
|
14
15
|
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " Command.init: #{_cmd.to_s}"
|
16
|
+
|
17
|
+
|
15
18
|
@cmd=_cmd
|
19
|
+
|
20
|
+
if _cmd.is_a?(Hash) && _cmd.has_key?('page') && _cmd['page'].has_key?('action')
|
21
|
+
@stanza = _cmd
|
22
|
+
@cmd=_cmd['page']['action']
|
23
|
+
end
|
24
|
+
|
16
25
|
@rc=nil
|
17
26
|
@drv=_drv
|
18
27
|
@locator=nil
|
@@ -21,7 +21,7 @@ module Scoutui::Commands
|
|
21
21
|
|
22
22
|
|
23
23
|
def self.processCommand(_action, e, my_driver)
|
24
|
-
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " enter [processCommand(#{_action})"
|
24
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " enter [processCommand(#{_action}, #{e})"
|
25
25
|
|
26
26
|
_aborted=false
|
27
27
|
_cmd=nil
|
@@ -36,6 +36,11 @@ module Scoutui::Commands
|
|
36
36
|
|
37
37
|
_c=nil
|
38
38
|
|
39
|
+
my_driver.switch_to.default_content
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
|
39
44
|
if Scoutui::Commands::Utils.instance.isPause?(_action)
|
40
45
|
_cmd='pause'
|
41
46
|
_c = Scoutui::Commands::Pause.new(nil)
|
@@ -47,7 +52,7 @@ module Scoutui::Commands
|
|
47
52
|
elsif Scoutui::Commands::Utils.instance.isClick?(_action)
|
48
53
|
_cmd='Click'
|
49
54
|
_c = Scoutui::Commands::ClickObject.new(_action)
|
50
|
-
_c.execute(my_driver)
|
55
|
+
_c.execute(my_driver, e)
|
51
56
|
|
52
57
|
if e["page"].has_key?('then')
|
53
58
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " then => #{e['page']['then]']}"
|
@@ -58,6 +63,11 @@ module Scoutui::Commands
|
|
58
63
|
_c = Scoutui::Commands::JsAlert::ExistsAlert.new(_action)
|
59
64
|
rc=_c.execute(my_driver)
|
60
65
|
|
66
|
+
elsif Scoutui::Commands::Utils.instance.isFrame?(_action)
|
67
|
+
_cmd='IsFrame'
|
68
|
+
_c = Scoutui::Commands::SwitchFrame.new(_action)
|
69
|
+
rc=_c.execute(my_driver, e)
|
70
|
+
|
61
71
|
elsif Scoutui::Commands::Utils.instance.isGetAlert?(_action)
|
62
72
|
_cmd='GetAlert'
|
63
73
|
_c = Scoutui::Commands::ExistsAlert.new(_action)
|
@@ -71,7 +81,7 @@ module Scoutui::Commands
|
|
71
81
|
elsif Scoutui::Commands::Utils.instance.isSelect?(_action)
|
72
82
|
_cmd='Select'
|
73
83
|
_c = Scoutui::Commands::SelectObject.new(_action)
|
74
|
-
_c.execute(my_driver)
|
84
|
+
_c.execute(my_driver, e)
|
75
85
|
|
76
86
|
elsif Scoutui::Commands::Utils.instance.isFillForm?(_action)
|
77
87
|
|
@@ -6,7 +6,9 @@ module Scoutui::Commands
|
|
6
6
|
|
7
7
|
class SelectObject < Command
|
8
8
|
|
9
|
-
def execute(drv)
|
9
|
+
def execute(drv, e=nil)
|
10
|
+
|
11
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " SelectObject.execute(#{e})"
|
10
12
|
@drv=drv if !drv.nil?
|
11
13
|
|
12
14
|
_req = Scoutui::Utils::TestUtils.instance.getReq()
|
@@ -23,7 +25,54 @@ module Scoutui::Commands
|
|
23
25
|
|
24
26
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "Process SELECT #{_val} into #{_xpath}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
25
27
|
|
26
|
-
|
28
|
+
|
29
|
+
if e.is_a?(Hash) && e.has_key?('page') && e['page'].has_key?('frames')
|
30
|
+
puts __FILE__ + (__LINE__).to_s + " frames => #{e['page']['frames']}";
|
31
|
+
|
32
|
+
|
33
|
+
if false
|
34
|
+
|
35
|
+
frames=e['page']['frames']
|
36
|
+
frame_list=frames.split(/(frame\(.*\))\.(?=[\w])/)
|
37
|
+
frame_list.each do |_f|
|
38
|
+
|
39
|
+
|
40
|
+
if !_f.empty?
|
41
|
+
_id = _f.match(/frame\((.*)\)/)[1]
|
42
|
+
|
43
|
+
puts __FILE__ + (__LINE__).to_s + " switch_to.frame #{_id}"
|
44
|
+
|
45
|
+
@drv.switch_to.frame(_id.to_s.strip)
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
# obj = Scoutui::Base::QBrowser.getObject(@drv, _xpath, Scoutui::Commands::Utils.instance.getTimeout)
|
57
|
+
|
58
|
+
if false
|
59
|
+
if Scoutui::Commands::Utils.instance.isFrameSearch?
|
60
|
+
hits = Scoutui::Base::QBrowser.frame_getObject(@drv, _xpath, Scoutui::Commands::Utils.instance.getTimeout)
|
61
|
+
|
62
|
+
puts __FILE__ + (__LINE__).to_s + " hits => #{hits.class} : #{hits}"
|
63
|
+
if hits.is_a?(Array) && !hits.empty?
|
64
|
+
obj=hits[0]
|
65
|
+
elsif hits.is_a?(Selenium::WebDriver::Element)
|
66
|
+
obj=hits
|
67
|
+
end
|
68
|
+
|
69
|
+
else
|
70
|
+
obj = Scoutui::Base::QBrowser.getObject(@drv, _xpath, Scoutui::Commands::Utils.instance.getTimeout)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
obj = Scoutui::Base::QBrowser.findElement(@drv, _xpath, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
|
75
|
+
|
27
76
|
|
28
77
|
if !obj.nil? && obj.tag_name.downcase.match(/(select)/)
|
29
78
|
|
@@ -38,8 +87,9 @@ module Scoutui::Commands
|
|
38
87
|
end
|
39
88
|
end
|
40
89
|
|
41
|
-
rescue
|
42
|
-
|
90
|
+
rescue => ex
|
91
|
+
Scoutui::Logger::LogMgr.instance.debug "Error during processing: #{$!}"
|
92
|
+
Scoutui::Logger::LogMgr.instance.debug "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
|
43
93
|
end
|
44
94
|
|
45
95
|
Testmgr::TestReport.instance.getReq(_req).testcase('select').add(!obj.nil?, "Verify object to select exists #{_xpath} : #{obj.class.to_s}")
|
@@ -0,0 +1,127 @@
|
|
1
|
+
|
2
|
+
module Scoutui::Commands
|
3
|
+
|
4
|
+
class SwitchFrame < Command
|
5
|
+
|
6
|
+
def execute(drv, _e=nil)
|
7
|
+
|
8
|
+
@drv=drv if !drv.nil?
|
9
|
+
|
10
|
+
_locator = @cmd.match(/frame\s*\((.*)\)/)[1].to_s.strip
|
11
|
+
|
12
|
+
|
13
|
+
puts __FILE__ + (__LINE__).to_s + " frame : #{_locator}"
|
14
|
+
|
15
|
+
rc = Array.new()
|
16
|
+
|
17
|
+
frames = @drv.find_elements(:xpath, '//iframe')
|
18
|
+
|
19
|
+
if frames.size == 0
|
20
|
+
frames = @drv.find_elements(:xpath, '//frame')
|
21
|
+
end
|
22
|
+
|
23
|
+
if frames.size > 0
|
24
|
+
rc.concat frames
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
_obj = @drv.find_elements(:xpath, _locator)
|
29
|
+
|
30
|
+
puts __FILE__ + (__LINE__).to_s + " frames => #{frames} : #{_obj}"
|
31
|
+
|
32
|
+
if _obj.empty?
|
33
|
+
|
34
|
+
for i in 0 .. (frames.size - 1)
|
35
|
+
|
36
|
+
|
37
|
+
_name = frames[i].attribute('name')
|
38
|
+
puts __FILE__ + (__LINE__).to_s + " Process frame[#{i}] : #{frames[i].attribute('name')}"
|
39
|
+
|
40
|
+
@drv.switch_to.frame _name
|
41
|
+
# @drv.switch_to.frame i
|
42
|
+
|
43
|
+
_hits = execute(drv, _e)
|
44
|
+
|
45
|
+
puts __FILE__ + (__LINE__).to_s + " hits => #{_hits}"
|
46
|
+
|
47
|
+
|
48
|
+
@drv.switch_to.parent_frame
|
49
|
+
|
50
|
+
if _hits.size > 0
|
51
|
+
_obj=_hits
|
52
|
+
|
53
|
+
break
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
puts __FILE__ + (__LINE__).to_s + " _obj => #{_obj}"
|
62
|
+
|
63
|
+
_obj
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
# Recurses into all iframe and/or frame tags
|
70
|
+
def xxexecute(drv, _e=nil)
|
71
|
+
|
72
|
+
@drv=drv if !drv.nil?
|
73
|
+
|
74
|
+
_locator = @cmd.match(/frame\s*\((.*)\)/)[1].to_s.strip
|
75
|
+
|
76
|
+
|
77
|
+
puts __FILE__ + (__LINE__).to_s + " frame : #{_locator}"
|
78
|
+
|
79
|
+
rc = Array.new()
|
80
|
+
|
81
|
+
frames = @drv.find_elements(:xpath, '//iframe')
|
82
|
+
|
83
|
+
if frames.size == 0
|
84
|
+
frames = @drv.find_elements(:xpath, '//frame')
|
85
|
+
end
|
86
|
+
|
87
|
+
if frames.size > 0
|
88
|
+
rc.concat frames
|
89
|
+
end
|
90
|
+
|
91
|
+
|
92
|
+
_obj = @drv.find_elements(:xpath, _locator)
|
93
|
+
|
94
|
+
puts __FILE__ + (__LINE__).to_s + " frames => #{frames} : #{_obj}"
|
95
|
+
|
96
|
+
for i in 0 .. (frames.size - 1)
|
97
|
+
|
98
|
+
|
99
|
+
_name = frames[i].attribute('name')
|
100
|
+
puts __FILE__ + (__LINE__).to_s + " Process frame[#{i}] : #{frames[i].attribute('name')}"
|
101
|
+
|
102
|
+
@drv.switch_to.frame _name
|
103
|
+
# @drv.switch_to.frame i
|
104
|
+
|
105
|
+
_hits = execute(drv, _e)
|
106
|
+
|
107
|
+
puts __FILE__ + (__LINE__).to_s + " hits => #{_hits}"
|
108
|
+
|
109
|
+
rc.concat _hits if !_hits.empty?
|
110
|
+
|
111
|
+
@drv.switch_to.parent_frame
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
|
116
|
+
puts __FILE__ + (__LINE__).to_s + " rc => #{rc}"
|
117
|
+
|
118
|
+
rc
|
119
|
+
|
120
|
+
end
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
end
|
125
|
+
|
126
|
+
|
127
|
+
end
|
@@ -66,12 +66,12 @@ module Scoutui::Commands
|
|
66
66
|
|
67
67
|
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + "Process TYPE #{_val} into #{_xpath}"
|
68
68
|
|
69
|
-
obj = Scoutui::Base::QBrowser.getObject(@drv, _xpath, Scoutui::Commands::Utils.instance.getTimeout)
|
70
|
-
|
69
|
+
# 5150 obj = Scoutui::Base::QBrowser.getObject(@drv, _xpath, Scoutui::Commands::Utils.instance.getTimeout)
|
70
|
+
obj = Scoutui::Base::QBrowser.findElement(@drv, _xpath, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
|
71
71
|
|
72
72
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " type(#{_val})"
|
73
73
|
|
74
|
-
if !obj.nil? && !obj.attribute('type').downcase.match(/(text|password|email)/).nil?
|
74
|
+
if !obj.nil? && !obj.attribute('type').downcase.match(/(text|textarea|password|email)/).nil?
|
75
75
|
|
76
76
|
# Refactor in qbrowser
|
77
77
|
|
@@ -10,12 +10,14 @@ module Scoutui::Commands
|
|
10
10
|
attr_accessor :totalCommands
|
11
11
|
attr_accessor :timeout
|
12
12
|
attr_accessor :hwnds
|
13
|
+
attr_accessor :useFrameSearch
|
13
14
|
|
14
15
|
def initialize
|
15
16
|
@command_list=['pause',
|
16
17
|
'existsAlert',
|
17
18
|
'clickJsAlert',
|
18
19
|
'fillform',
|
20
|
+
'frame',
|
19
21
|
'submitform',
|
20
22
|
'type',
|
21
23
|
'click',
|
@@ -32,10 +34,45 @@ module Scoutui::Commands
|
|
32
34
|
@totalCommands[c]=0
|
33
35
|
end
|
34
36
|
|
37
|
+
@useFrameSearch = false
|
38
|
+
|
35
39
|
@hwnds = { :current => nil, :previous => nil, :handles => [] }
|
36
40
|
end
|
37
41
|
|
38
42
|
|
43
|
+
def reset(stanza=nil)
|
44
|
+
|
45
|
+
setEnableFrameSearch(false)
|
46
|
+
|
47
|
+
if stanza.is_a?(Hash) && stanza.has_key?('page') && stanza['page'].has_key?('frames')
|
48
|
+
puts __FILE__ + (__LINE__).to_s + " frames => #{stanza['page']['frames']}";
|
49
|
+
|
50
|
+
setEnableFrameSearch(!stanza['page']['frames'].to_s.match(/true/i).nil?)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def resetFrameSearch()
|
55
|
+
setEnableFrameSearch(false)
|
56
|
+
end
|
57
|
+
|
58
|
+
def setEnableFrameSearch(b)
|
59
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " setEnabledFrameSearch(#{b})"
|
60
|
+
@userFrameSearch=b
|
61
|
+
end
|
62
|
+
|
63
|
+
def getFrameSearch()
|
64
|
+
@userFrameSearch
|
65
|
+
end
|
66
|
+
|
67
|
+
def enableFrameSearch()
|
68
|
+
Scoutui::Logger::LogMgr.instance.debug "EnableFrameSearch(true)"
|
69
|
+
setEnableFrameSearch(true)
|
70
|
+
end
|
71
|
+
|
72
|
+
def isFrameSearch?()
|
73
|
+
@userFrameSearch
|
74
|
+
end
|
75
|
+
|
39
76
|
def isCSS(_locator)
|
40
77
|
rc=nil
|
41
78
|
|
@@ -66,6 +103,7 @@ module Scoutui::Commands
|
|
66
103
|
def setTimeout(_t)
|
67
104
|
@timeout=_t.to_i
|
68
105
|
end
|
106
|
+
|
69
107
|
def getTimeout()
|
70
108
|
@timeout.to_i
|
71
109
|
end
|
@@ -79,6 +117,10 @@ module Scoutui::Commands
|
|
79
117
|
!_action.match(/(exist[s]*_*alert|existAlert|existsAlert|existsJsAlert|existsJsConfirm|existsJsPrompt)\(/i).nil?
|
80
118
|
end
|
81
119
|
|
120
|
+
def isFrame?(_action)
|
121
|
+
_action.match(/^\s*(frame|switchframe|switch_frame)\s*\(/i)
|
122
|
+
end
|
123
|
+
|
82
124
|
def isVerifyElt?(_action)
|
83
125
|
!_action.match(/(verifyelt|verifyelement)\(/i).nil?
|
84
126
|
end
|
@@ -131,6 +173,8 @@ module Scoutui::Commands
|
|
131
173
|
@totalCommands['pause']+=1
|
132
174
|
elsif isExistsAlert?(cmd)
|
133
175
|
@totalCommands['existsAlert']+=1
|
176
|
+
elsif isFrame?(cmd)
|
177
|
+
@totalCommands['frame']+=1
|
134
178
|
elsif isGetAlert?(cmd)
|
135
179
|
@totalCommands['clickJsAlert']+=1
|
136
180
|
elsif isVerifyElt?(cmd)
|
data/lib/scoutui/version.rb
CHANGED
data/scoutui.gemspec
CHANGED
@@ -32,5 +32,5 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_development_dependency "faker"
|
33
33
|
spec.add_development_dependency "logging"
|
34
34
|
spec.add_development_dependency "sauce_whisk"
|
35
|
-
spec.add_development_dependency "testmgr", "0.3.
|
35
|
+
spec.add_development_dependency "testmgr", "0.3.2.pre"
|
36
36
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scoutui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Kim
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-05-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -157,14 +157,14 @@ dependencies:
|
|
157
157
|
requirements:
|
158
158
|
- - '='
|
159
159
|
- !ruby/object:Gem::Version
|
160
|
-
version: 0.3.
|
160
|
+
version: 0.3.2.pre
|
161
161
|
type: :development
|
162
162
|
prerelease: false
|
163
163
|
version_requirements: !ruby/object:Gem::Requirement
|
164
164
|
requirements:
|
165
165
|
- - '='
|
166
166
|
- !ruby/object:Gem::Version
|
167
|
-
version: 0.3.
|
167
|
+
version: 0.3.2.pre
|
168
168
|
description: Leverage a fully functional e2e framework that's integrated with Applitool's
|
169
169
|
Eyes and Sauce Labs!
|
170
170
|
email:
|
@@ -238,6 +238,7 @@ files:
|
|
238
238
|
- lib/scoutui/commands/select_window.rb
|
239
239
|
- lib/scoutui/commands/strategy.rb
|
240
240
|
- lib/scoutui/commands/submit_form.rb
|
241
|
+
- lib/scoutui/commands/switch_frame.rb
|
241
242
|
- lib/scoutui/commands/type.rb
|
242
243
|
- lib/scoutui/commands/update_url.rb
|
243
244
|
- lib/scoutui/commands/utils.rb
|
@@ -265,9 +266,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
265
266
|
version: '0'
|
266
267
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
267
268
|
requirements:
|
268
|
-
- - "
|
269
|
+
- - ">"
|
269
270
|
- !ruby/object:Gem::Version
|
270
|
-
version:
|
271
|
+
version: 1.3.1
|
271
272
|
requirements: []
|
272
273
|
rubyforge_project:
|
273
274
|
rubygems_version: 2.6.2
|