scoutui 2.0.3.4.pre → 2.0.3.5.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 527f1f2733f22189ec8c9c60df25ef1bdd5dcc07
4
- data.tar.gz: 7b4038b15f762a0fa0514ba1a2fa73feccd9f7c4
3
+ metadata.gz: 72d63f27b4ad75996c75b6f0dee10a171fc8c253
4
+ data.tar.gz: da5188f0b749627620d8c503feaa6ae5fe571a7c
5
5
  SHA512:
6
- metadata.gz: b616c6f713ee98f9707f86aece0f819ca94dff25b0b9ea056746ec771d172932ee82fb5a84df5b224192fc739526e507ed412d92ad99f7f978d6592053e37220
7
- data.tar.gz: e0ffad4cdbfcd7dfa7f8a37e9eaadbe2b5d15dc9cc2febe92d768f414d0e076075909f9f22a9c090e0ecac0bc958f1d9ceb9ca36caab9d44de1a5ea1069ff081
6
+ metadata.gz: 654175f6640baf9a7ba3c67f5a86f6d03af6c200d7956c4fb266494d379cc06f8361721f45b63f12e6100897ce755cbb7a014c8992930f171316e7b3a74e4461
7
+ data.tar.gz: 8fe1826a4bbf267a92ae9dc40408cc301f3c84a3b91e32336bef117ba2a60f3ae7ee613950c131b8bb1cee3d955d4e01c4609f02188f4504dad16b0587f31564
@@ -12,6 +12,10 @@ module Scoutui::Base
12
12
  def initialize()
13
13
  end
14
14
 
15
+ def self.isChrome?(drv)
16
+ drv.browser.to_s.match(/chrome/i)
17
+ end
18
+
15
19
  def self.wait_for_displayed(drv, locator, _timeout=30)
16
20
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " wait_for_displayed(#{xpath}"
17
21
  rc=nil
@@ -92,13 +96,82 @@ module Scoutui::Base
92
96
  end
93
97
 
94
98
 
99
+ def self.switch_into_frame(drv, id)
100
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " switch_into_frame(#{id})"
101
+
102
+ hit=nil
103
+
104
+ if isChrome?(drv)
105
+
106
+ puts __FILE__ + (__LINE__).to_s + " swtich on Chrome browser"
107
+ bframes = drv.find_elements(:xpath, '//iframe')
108
+
109
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " //iframe : #{bframes.size}"
110
+
111
+ if bframes.size == 0
112
+ bframes = drv.find_elements(:xpath, '//frame')
113
+
114
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " //frame : #{bframes.size}"
115
+ end
116
+
117
+ for i in 0 .. bframes.size - 1
118
+ begin
119
+
120
+ _tag = bframes[i].attribute('name')
121
+
122
+ if !_tag.nil? && _tag.empty?
123
+ _tag = bframes[i].attribute('id')
124
+ end
125
+
126
+
127
+ puts __FILE__ + (__LINE__).to_s + " <tag, id> :: <#{_tag}, #{id} >"
128
+
129
+ if !_tag.empty? && id==_tag
130
+
131
+ hit = bframes[i]
132
+ drv.switch_to.frame hit
133
+
134
+ puts __FILE__ + (__LINE__).to_s + " swtichframe to #{i} - #{_tag}"
135
+ break
136
+ end
137
+
138
+ rescue => ex
139
+ Scoutui::Logger::LogMgr.instance.debug "Error during processing: #{$!}"
140
+ Scoutui::Logger::LogMgr.instance.debug "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
141
+ end
142
+
143
+ end
144
+
145
+ else
146
+ # Firefox, IE
147
+ hit = drv.switch_to.frame(id.to_s.strip)
148
+ end
149
+
150
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " switch_into_frame(#{id}) => #{hit}"
151
+ hit
152
+ end
153
+
95
154
  # e : Hash : Command stanza from YML
155
+ # s : String
156
+ #
157
+ # format: frame(<string>)[.frame(<string>)]*
96
158
  def self.switch_frame(drv, e)
159
+
160
+ frames=nil
97
161
  if e.is_a?(Hash) && e.has_key?('page') && e['page'].has_key?('frames')
98
162
  puts __FILE__ + (__LINE__).to_s + " frames => #{e['page']['frames']}";
99
163
 
100
164
  frames=e['page']['frames']
165
+ elsif e.is_a?(String)
166
+ frames=e
167
+ end
168
+
169
+
170
+ if !frames.nil?
171
+ puts __FILE__ + (__LINE__).to_s + " frames => #{frames}";
172
+
101
173
  frame_list=frames.split(/(frame\(.*\))\.(?=[\w])/)
174
+
102
175
  frame_list.each do |_f|
103
176
 
104
177
 
@@ -107,7 +180,13 @@ module Scoutui::Base
107
180
 
108
181
  puts __FILE__ + (__LINE__).to_s + " switch_to.frame #{_id}"
109
182
 
110
- drv.switch_to.frame(_id.to_s.strip)
183
+ # Swtich based on browser type
184
+
185
+ if switch_into_frame(drv, _id).nil?
186
+ Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Frame with name/id #{_id} not found"
187
+ break
188
+ end
189
+
111
190
  end
112
191
 
113
192
  end
@@ -162,8 +241,6 @@ module Scoutui::Base
162
241
  rc.concat frames
163
242
  end
164
243
 
165
-
166
- # _obj = drv.find_elements(:xpath, _locator)
167
244
  _obj = getObject(drv, _locator, _timeout)
168
245
 
169
246
  puts __FILE__ + (__LINE__).to_s + " frames => #{frames} : #{_obj}"
@@ -304,8 +381,6 @@ module Scoutui::Base
304
381
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Locator => #{locator}"
305
382
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Visible_When => #{visible_when}"
306
383
 
307
- # Selenium::WebDriver::Wait.new(timeout: _timeout).until { drv.find_element(:xpath => locator).displayed? }
308
- # rc=drv.find_element(:xpath => locator)
309
384
  Selenium::WebDriver::Wait.new(timeout: _timeout).until { rc=drv.find_element( locateBy => locator) }
310
385
 
311
386
 
@@ -324,15 +399,6 @@ module Scoutui::Base
324
399
 
325
400
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " getObject(#{locator}) => #{rc.to_s}" if Scoutui::Utils::TestUtils.instance.isDebug?
326
401
 
327
- # if rc.kind_of?(Selenium::WebDriver::Element)
328
- #
329
- # if visible_when
330
- # Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Displayed => #{rc.displayed?}"
331
- # Testmgr::TestReport.instance.getReq('UI').tc('visible_when').add(rc.displayed?, "Verify #{locator} is visible")
332
- # end
333
- #
334
- # end
335
-
336
402
  rc
337
403
  end
338
404
 
@@ -1,3 +1,3 @@
1
1
  module Scoutui
2
- VERSION = "2.0.3.4.pre"
2
+ VERSION = "2.0.3.5.pre"
3
3
  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.3.4.pre
4
+ version: 2.0.3.5.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-05-06 00:00:00.000000000 Z
12
+ date: 2016-05-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler