scoutui 2.0.3.48.pre → 2.0.3.49.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/screenshot/fullshot.rb +66 -0
- data/lib/scoutui/base/assertions.rb +35 -35
- data/lib/scoutui/base/q_browser.rb +30 -30
- data/lib/scoutui/base/user_vars.rb +4 -0
- data/lib/scoutui/base/visual_test_framework.rb +45 -33
- data/lib/scoutui/commands/click_object.rb +2 -2
- data/lib/scoutui/commands/highlight.rb +2 -0
- data/lib/scoutui/commands/type.rb +7 -7
- data/lib/scoutui/commands/update_url.rb +1 -1
- data/lib/scoutui/commands/utils.rb +10 -10
- data/lib/scoutui/eyes/eye_factory.rb +11 -0
- data/lib/scoutui/eyes/eye_scout.rb +1 -1
- data/lib/scoutui/logger/log_mgr.rb +4 -1
- data/lib/scoutui/utils/utils.rb +37 -0
- 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: 56198d903e76686d5d7c19967087e96604dc0f2e
|
4
|
+
data.tar.gz: c597f3635b475beb5ae53ffc5c1cd726540b9b2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 240d65f90565942c321bef2a1988ea4b9cd49ae650960236d41b0a35eeffe2772f5ef456d31c3f7365d24c7e8445f532a3c7b7d73860f89b97ea074668858f2d
|
7
|
+
data.tar.gz: c19cc9bfef61ddb103ea035f12d324fb342297b48ae16e555bf67fe5c3cdff7e32b4fad8fddecfc3a7a2e8a1290cb101aeda03a10e1c27f257bad1f85d239035
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# needs the selenium-webdriver and mini_magick gems
|
2
|
+
]
|
3
|
+
require 'eyes_selenium'
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
# Substitute these with the size of your web page
|
11
|
+
page_width = 1024
|
12
|
+
page_height = 800
|
13
|
+
|
14
|
+
height_captured = 0
|
15
|
+
y_tiles = 0
|
16
|
+
|
17
|
+
wd = Selenium::WebDriver.for :firefox # Connect to your Selenium Webdriver
|
18
|
+
|
19
|
+
eyes=Applitools::Eyes.new()
|
20
|
+
eyes.api_key = "Peter"
|
21
|
+
eyes.force_fullpage_screenshot = true
|
22
|
+
|
23
|
+
viewport = Selenium::WebDriver::Dimension.new(1024, 768)
|
24
|
+
|
25
|
+
driver = eyes.open(
|
26
|
+
app_name: 'Full',
|
27
|
+
test_name: 'FullShot',
|
28
|
+
viewport_size: viewport,
|
29
|
+
driver: wd)
|
30
|
+
|
31
|
+
|
32
|
+
asb = Applitools::Selenium::Browser.new(driver, eyes)
|
33
|
+
|
34
|
+
driver.navigate.to "http://www.concursolutions.com"
|
35
|
+
driver.manage.window.maximize
|
36
|
+
shot=driver.get_screenshot
|
37
|
+
puts __FILE__ + (__LINE__).to_s + " shot => #{shot.class}"
|
38
|
+
|
39
|
+
if false
|
40
|
+
while height_captured < page_height
|
41
|
+
width_captured = 0
|
42
|
+
x_tiles = 0
|
43
|
+
|
44
|
+
while width_captured < page_width
|
45
|
+
tile_file = "screenshot-#{y_tiles}-#{x_tiles}.png"
|
46
|
+
|
47
|
+
driver.execute_script("window.scrollTo(#{width_captured}px, #{height_captured});")
|
48
|
+
|
49
|
+
driver.save_screenshot tile_file
|
50
|
+
|
51
|
+
screenshot = MiniMagick::Image.new tile_file
|
52
|
+
width_captured += screenshot.width
|
53
|
+
x_tiles += 1
|
54
|
+
end
|
55
|
+
|
56
|
+
height_captured += screenshot.height
|
57
|
+
y_tiles += 1
|
58
|
+
end
|
59
|
+
|
60
|
+
# Use imagemagick's montage command to stitch the screenshot tiles together
|
61
|
+
`montage screenshot-[0-#(y_tiles}]-[0-#{x_tiles}].png -tile #{x_tiles}x#{y_tiles} -geometry #{screenshot.width}x#{screenshot.height}+0+0 screenshot.png`
|
62
|
+
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
driver.quit
|
@@ -25,19 +25,19 @@ module Scoutui::Base
|
|
25
25
|
|
26
26
|
def isValidAssertType(_a)
|
27
27
|
|
28
|
-
|
28
|
+
Scoutui::Logger::LogMgr.instance.asserts.debug __FILE__ + (__LINE__).to_s + " isValidAssertionType(#{_a})"
|
29
29
|
@assertionTypes.each do |e|
|
30
30
|
_p=e[:pattern]
|
31
31
|
|
32
|
-
|
32
|
+
Scoutui::Logger::LogMgr.instance.asserts.debug __FILE__ + (__LINE__).to_s + " == verify #{_a} matches #{_p} =="
|
33
33
|
|
34
34
|
if _a.match(/#{_p}/)
|
35
|
-
|
35
|
+
Scoutui::Logger::LogMgr.instance.asserts.debug __FILE__ + (__LINE__).to_s + " matched : #{e}"
|
36
36
|
return e
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
|
40
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " => unknown command : #{_a}"
|
41
41
|
return nil
|
42
42
|
end
|
43
43
|
|
@@ -67,7 +67,7 @@ module Scoutui::Base
|
|
67
67
|
if _fMatch
|
68
68
|
f=c[2].strip
|
69
69
|
|
70
|
-
|
70
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " arg: #{f}"
|
71
71
|
|
72
72
|
rc = { 'cmd' => cmd,
|
73
73
|
'frame' => _fMatch[1].strip,
|
@@ -102,10 +102,10 @@ module Scoutui::Base
|
|
102
102
|
#
|
103
103
|
# { 'locator => <locator> '}
|
104
104
|
def _parseFrameLocator(_a)
|
105
|
-
|
105
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " _parseFrameLocator(#{_a})"
|
106
106
|
_pattern='(frame\(.*\)[\.frame\(.*\)]*)\s*,\s*(.*)\s*$'
|
107
107
|
_fMatch = _a.match(/#{_pattern}/)
|
108
|
-
|
108
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " === _fMatch : #{_fMatch}"
|
109
109
|
rc=nil
|
110
110
|
if _fMatch
|
111
111
|
rc = {
|
@@ -117,7 +117,7 @@ module Scoutui::Base
|
|
117
117
|
}
|
118
118
|
end
|
119
119
|
|
120
|
-
|
120
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " _parseFrameLocator(#{_a}) => #{rc}"
|
121
121
|
rc
|
122
122
|
end
|
123
123
|
|
@@ -143,7 +143,7 @@ module Scoutui::Base
|
|
143
143
|
if _fMatch
|
144
144
|
f=c[2].strip
|
145
145
|
|
146
|
-
|
146
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " arg: #{f}"
|
147
147
|
|
148
148
|
rc = { 'cmd' => cmd,
|
149
149
|
'frame' => _fMatch[1].strip,
|
@@ -191,7 +191,7 @@ module Scoutui::Base
|
|
191
191
|
def isVisibleFrameCmd?(_a)
|
192
192
|
rc=nil
|
193
193
|
|
194
|
-
|
194
|
+
Scoutui::Logger::LogMgr.instance.asserts.debug __FILE__ + (__LINE__).to_s + " [isVisibleFrameCmd]: #{_a}"
|
195
195
|
|
196
196
|
begin
|
197
197
|
if isVisibleCmd?(_a)
|
@@ -200,19 +200,19 @@ module Scoutui::Base
|
|
200
200
|
|
201
201
|
f=_a.match(/^\s*[!]*visible\((.*)\)\s*$/)[1].strip
|
202
202
|
|
203
|
-
|
203
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " arg: #{f}"
|
204
204
|
rc = { 'frame' => f.match(/#{_pattern}/)[1].strip,
|
205
205
|
'locator' => f.match(/#{_pattern}/)[2].strip }
|
206
206
|
|
207
207
|
else
|
208
|
-
|
208
|
+
Scoutui::Logger::LogMgr.instance.asserts.debug "=> NOT vsibleCmd"
|
209
209
|
end
|
210
210
|
|
211
211
|
rescue => ex
|
212
212
|
;
|
213
213
|
end
|
214
214
|
|
215
|
-
|
215
|
+
Scoutui::Logger::LogMgr.instance.asserts.debug __FILE__ + (__LINE__).to_s + " isVisibleFrameCmd?(#{_a}) : #{rc}"
|
216
216
|
rc
|
217
217
|
end
|
218
218
|
|
@@ -255,7 +255,7 @@ module Scoutui::Base
|
|
255
255
|
|
256
256
|
obj = Scoutui::Base::QBrowser.getObject(my_driver, xpath, Scoutui::Commands::Utils.instance.getTimeout)
|
257
257
|
|
258
|
-
|
258
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{condition} : #{obj}"
|
259
259
|
|
260
260
|
begin
|
261
261
|
|
@@ -281,7 +281,7 @@ module Scoutui::Base
|
|
281
281
|
rescue => ex
|
282
282
|
rc=false
|
283
283
|
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " #{ex.class.to_s}"
|
284
|
-
|
284
|
+
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
|
285
285
|
end
|
286
286
|
|
287
287
|
end
|
@@ -298,7 +298,7 @@ module Scoutui::Base
|
|
298
298
|
_t=nil
|
299
299
|
|
300
300
|
_assertType=isValidAssertType(_execute_when)
|
301
|
-
|
301
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " assertType => #{_assertType}"
|
302
302
|
if !_assertType.nil?
|
303
303
|
_t = _assertType[:parse].call(_execute_when)
|
304
304
|
end
|
@@ -345,7 +345,7 @@ module Scoutui::Base
|
|
345
345
|
|
346
346
|
_enabled = Scoutui::Base::QBrowser.isEnabled?(_obj, my_driver, _locator)
|
347
347
|
|
348
|
-
|
348
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " _obj.enabled? => #{_enabled}"
|
349
349
|
|
350
350
|
if _execute_when.match(/^\s*!isEnabled/i) && _enabled
|
351
351
|
|
@@ -357,7 +357,7 @@ module Scoutui::Base
|
|
357
357
|
begin
|
358
358
|
Selenium::WebDriver::Wait.new(timeout: 15).until {
|
359
359
|
_obj = Scoutui::Base::QBrowser.findElement(my_driver, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
|
360
|
-
|
360
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " waiting .. => #{_obj.class.to_s} : enabled - #{_obj.enabled?}"
|
361
361
|
|
362
362
|
!_obj.enabled?
|
363
363
|
}
|
@@ -420,7 +420,7 @@ module Scoutui::Base
|
|
420
420
|
_obj = Scoutui::Base::QBrowser.findElement(my_driver, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
|
421
421
|
|
422
422
|
_state = _obj.selected?
|
423
|
-
|
423
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " _obj.selected? => #{_state}"
|
424
424
|
|
425
425
|
if _execute_when.match(/^\s*!(isSelected|selected)/i) && _state
|
426
426
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " !isSelected(#{_locator}) : false"
|
@@ -479,7 +479,7 @@ module Scoutui::Base
|
|
479
479
|
|
480
480
|
Selenium::WebDriver::Wait.new(timeout: 15).until {
|
481
481
|
_obj = Scoutui::Base::QBrowser.findElement(my_driver, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
|
482
|
-
|
482
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " waiting .. => #{_obj.class.to_s}"
|
483
483
|
_rc = (_obj.is_a?(Selenium::WebDriver::Element) && !_obj.displayed?) || _obj.nil?
|
484
484
|
}
|
485
485
|
|
@@ -487,10 +487,10 @@ module Scoutui::Base
|
|
487
487
|
|
488
488
|
Selenium::WebDriver::Wait.new(timeout: 15).until {
|
489
489
|
_obj = Scoutui::Base::QBrowser.findElement(my_driver, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
|
490
|
-
|
490
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " waiting .. => #{_obj.class.to_s}"
|
491
491
|
|
492
492
|
if _obj.is_a?(Selenium::WebDriver::Element)
|
493
|
-
|
493
|
+
Scoutui::Logger::LogMgr.instance.debug "***** displayed? : #{_obj.displayed?}"
|
494
494
|
end
|
495
495
|
|
496
496
|
_rc = !_obj.nil? && _obj.displayed?
|
@@ -502,12 +502,12 @@ module Scoutui::Base
|
|
502
502
|
;
|
503
503
|
end
|
504
504
|
|
505
|
-
|
505
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " waitFor : #{_rc}"
|
506
506
|
return _rc
|
507
507
|
end
|
508
508
|
|
509
509
|
|
510
|
-
|
510
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " _obj.displayed? => #{_state}"
|
511
511
|
|
512
512
|
if _execute_when.match(/^\s*!visible/i) && _state
|
513
513
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " !visible(#{_locator}) : false"
|
@@ -520,7 +520,7 @@ module Scoutui::Base
|
|
520
520
|
rescue => ex
|
521
521
|
rc=false
|
522
522
|
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " #{ex.class.to_s}"
|
523
|
-
|
523
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
|
524
524
|
end
|
525
525
|
|
526
526
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " visible?(#{_execute_when}) => #{rc}"
|
@@ -611,8 +611,8 @@ module Scoutui::Base
|
|
611
611
|
|
612
612
|
|
613
613
|
if _v.is_a?(String)
|
614
|
-
|
615
|
-
|
614
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{_v} is a string - next"
|
615
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_S + " TBD" # Pause", gets
|
616
616
|
next
|
617
617
|
end
|
618
618
|
|
@@ -663,7 +663,7 @@ module Scoutui::Base
|
|
663
663
|
|
664
664
|
|
665
665
|
elsif assertPageElement(_k, _v, _obj, my_driver, _req)
|
666
|
-
|
666
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Processed assertPageElement(#{_k}, #{_v})";
|
667
667
|
;
|
668
668
|
# elsif visible_when_title(_k, _v, _obj, my_driver, _req)
|
669
669
|
# ;
|
@@ -693,7 +693,7 @@ module Scoutui::Base
|
|
693
693
|
|
694
694
|
rescue => ex
|
695
695
|
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " Invalid file: #{datafile} - abort processing."
|
696
|
-
|
696
|
+
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
|
697
697
|
end
|
698
698
|
|
699
699
|
|
@@ -726,7 +726,7 @@ module Scoutui::Base
|
|
726
726
|
|
727
727
|
end
|
728
728
|
|
729
|
-
|
729
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Pause debug"; gets
|
730
730
|
end
|
731
731
|
|
732
732
|
#
|
@@ -736,7 +736,7 @@ module Scoutui::Base
|
|
736
736
|
_req = Scoutui::Utils::TestUtils.instance.getReq()
|
737
737
|
end
|
738
738
|
|
739
|
-
|
739
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " [isVisible]: #{page_elt}, req:#{_req}"
|
740
740
|
|
741
741
|
rc=false
|
742
742
|
cmd='visible'
|
@@ -762,7 +762,7 @@ module Scoutui::Base
|
|
762
762
|
|
763
763
|
obj = Scoutui::Base::QBrowser.getObject(my_driver, xpath, Scoutui::Commands::Utils.instance.getTimeout)
|
764
764
|
|
765
|
-
|
765
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{condition} : #{obj}"
|
766
766
|
|
767
767
|
if condition.match(/^text/)
|
768
768
|
_txt = obj.text
|
@@ -779,7 +779,7 @@ module Scoutui::Base
|
|
779
779
|
expected_url = page_elt.match(/^\s*(url)\s*\((.*)\)/)[2].to_s
|
780
780
|
|
781
781
|
|
782
|
-
|
782
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " verify is URL matches #{current_url} with expected #{expected_url}"
|
783
783
|
|
784
784
|
expected_regex = Regexp.new(expected_url)
|
785
785
|
rc=!current_url.match(expected_regex).nil?
|
@@ -994,7 +994,7 @@ module Scoutui::Base
|
|
994
994
|
if page_elt.is_a?(Hash) && page_elt.has_key?('visible_when') && !page_elt['visible_when'].is_a?(Array) && page_elt['visible_when'].match(/^\s*(text|value)\s*\(/)
|
995
995
|
|
996
996
|
begin
|
997
|
-
|
997
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ==> #{page_elt['visible_when'].match(/^\s*(text|value)\s*\(/)[1]}"
|
998
998
|
|
999
999
|
_processed=true
|
1000
1000
|
rc=nil
|
@@ -1079,7 +1079,7 @@ module Scoutui::Base
|
|
1079
1079
|
|
1080
1080
|
rescue => ex
|
1081
1081
|
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Error during processing: #{ex}"
|
1082
|
-
|
1082
|
+
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
|
1083
1083
|
|
1084
1084
|
end
|
1085
1085
|
|
@@ -151,7 +151,7 @@ module Scoutui::Base
|
|
151
151
|
|
152
152
|
if isChrome?(drv)
|
153
153
|
|
154
|
-
|
154
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " swtich on Chrome browser"
|
155
155
|
bframes = drv.find_elements(:xpath, '//iframe')
|
156
156
|
|
157
157
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " //iframe : size #{bframes.size}"
|
@@ -172,14 +172,14 @@ module Scoutui::Base
|
|
172
172
|
end
|
173
173
|
|
174
174
|
|
175
|
-
|
175
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "[switch_into_frame.chrome]: <tag, id> :: <#{_tag}, #{id} >"
|
176
176
|
|
177
177
|
if !_tag.empty? && id==_tag
|
178
178
|
|
179
179
|
hit = bframes[i]
|
180
180
|
drv.switch_to.frame hit
|
181
181
|
|
182
|
-
|
182
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " swtichframe to #{i} - #{_tag}"
|
183
183
|
break
|
184
184
|
end
|
185
185
|
|
@@ -192,7 +192,7 @@ module Scoutui::Base
|
|
192
192
|
|
193
193
|
else
|
194
194
|
# Firefox, IE
|
195
|
-
|
195
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " [switch_into_frame]: drv.switch_to.frame(#{id.to_s}";
|
196
196
|
|
197
197
|
hit = drv.switch_to.frame(id.to_s.strip)
|
198
198
|
end
|
@@ -207,10 +207,10 @@ module Scoutui::Base
|
|
207
207
|
# format: frame(<string>)[.frame(<string>)]*
|
208
208
|
def self.switch_frame(drv, e)
|
209
209
|
|
210
|
-
|
210
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "\n\n== self.switch_frame(#{e}) =="
|
211
211
|
frames=nil
|
212
212
|
if e.is_a?(Hash) && e.has_key?('page') && e['page'].has_key?('frames')
|
213
|
-
|
213
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " frames => #{e['page']['frames']}";
|
214
214
|
|
215
215
|
frames=e['page']['frames']
|
216
216
|
elsif e.is_a?(String)
|
@@ -219,19 +219,19 @@ module Scoutui::Base
|
|
219
219
|
|
220
220
|
|
221
221
|
if !frames.nil?
|
222
|
-
|
222
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " [self.switch_frame]: frames => #{frames}";
|
223
223
|
|
224
224
|
# frame_list=frames.split(/(frame\(.*\))\.(?=[\w])/)
|
225
225
|
frame_list=frames.split(/\.(?=frame)/)
|
226
226
|
|
227
227
|
|
228
228
|
frame_list.each do |_f|
|
229
|
-
|
229
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " processing #{_f}"
|
230
230
|
|
231
231
|
if !_f.empty?
|
232
232
|
_id = _f.match(/frame\((.*)\)/)[1]
|
233
233
|
|
234
|
-
|
234
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " [self.switch_frame]: switch_to.frame #{_id}"
|
235
235
|
|
236
236
|
# Swtich based on browser type
|
237
237
|
|
@@ -243,14 +243,14 @@ module Scoutui::Base
|
|
243
243
|
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Sucessfully switched frame into #{_id}"
|
244
244
|
end
|
245
245
|
else
|
246
|
-
|
246
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " [firefox]: switch_to.frame #{_id}"
|
247
247
|
drv.switch_to.frame _id
|
248
248
|
end
|
249
249
|
|
250
250
|
if false
|
251
251
|
|
252
252
|
if drv.browser.to_s.match(/firefox/i)
|
253
|
-
|
253
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " [firefox]: switch_to.frame #{_id}"
|
254
254
|
drv.switch_to.frame _id
|
255
255
|
else
|
256
256
|
|
@@ -285,7 +285,7 @@ module Scoutui::Base
|
|
285
285
|
_obj.tag_name
|
286
286
|
_obj.attribute('type')
|
287
287
|
else
|
288
|
-
|
288
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " | isStale? => nil"
|
289
289
|
return nil
|
290
290
|
end
|
291
291
|
|
@@ -300,7 +300,7 @@ module Scoutui::Base
|
|
300
300
|
puts ex.backtrace
|
301
301
|
end
|
302
302
|
|
303
|
-
|
303
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " | isStale?(#{_obj}) : nosuch=#{_noSuch}, stale=#{_isStale}"
|
304
304
|
return (_noSuch || _isStale)
|
305
305
|
end
|
306
306
|
|
@@ -326,7 +326,7 @@ module Scoutui::Base
|
|
326
326
|
wait = Selenium::WebDriver::Wait.new(:timeout => Scoutui::Commands::Utils.instance.getTimeout)
|
327
327
|
isDisplayed = wait.until {
|
328
328
|
if Scoutui::Base::QBrowser.isStale?(_obj)
|
329
|
-
|
329
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ** refetch #{_locator} **"
|
330
330
|
_obj=Scoutui::Base::QBrowser.findElement(my_driver, Scoutui::Base::UserVars.instance.normalize(_locator), Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
|
331
331
|
end
|
332
332
|
true if _obj.enabled?
|
@@ -334,15 +334,15 @@ module Scoutui::Base
|
|
334
334
|
|
335
335
|
end
|
336
336
|
|
337
|
-
|
337
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " enabled => #{_obj.enabled?}"
|
338
338
|
|
339
339
|
if _obj.enabled?
|
340
340
|
_disabled=_obj.attribute("disabled")
|
341
341
|
_rdonly = _obj.attribute("readonly")
|
342
342
|
|
343
|
-
|
344
|
-
|
345
|
-
|
343
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " disabled: #{_disabled} nil: #{_disabled.nil?}"
|
344
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " readonly: #{_rdonly} nil: #{_rdonly.nil?}"
|
345
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " enabled: #{_obj.enabled?}"
|
346
346
|
|
347
347
|
rc = _obj.enabled? && !(_obj.attribute("disabled") || _obj.attribute("readonly") )
|
348
348
|
|
@@ -374,9 +374,9 @@ module Scoutui::Base
|
|
374
374
|
_frames,
|
375
375
|
_timeout)
|
376
376
|
|
377
|
-
|
378
|
-
|
379
|
-
|
377
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " | locator: #{_locator}"
|
378
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " | obj : #{obj}"
|
379
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " | stale : " + Scoutui::Base::QBrowser.isStale?(obj).to_s
|
380
380
|
|
381
381
|
cnt=0
|
382
382
|
if obj.is_a?(Selenium::WebDriver::Element) && Scoutui::Base::QBrowser.isStale?(obj) && !_locator.nil?
|
@@ -390,7 +390,7 @@ module Scoutui::Base
|
|
390
390
|
wait = Selenium::WebDriver::Wait.new(:timeout => Scoutui::Commands::Utils.instance.getTimeout)
|
391
391
|
_isntStale = wait.until {
|
392
392
|
_rc=Scoutui::Base::QBrowser.isStale?(obj)
|
393
|
-
|
393
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " stale(#{_locator}) : #{_rc}"
|
394
394
|
if _rc
|
395
395
|
obj = Scoutui::Base::QBrowser.findElement(drv, _locator,
|
396
396
|
_frames,
|
@@ -403,10 +403,10 @@ module Scoutui::Base
|
|
403
403
|
end
|
404
404
|
|
405
405
|
|
406
|
-
|
406
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{i} ==> stale(#{_locator}) : #{_isntStale}"
|
407
407
|
|
408
408
|
if !_isntStale
|
409
|
-
|
409
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{i} => obj is STALE : #{_locator}"
|
410
410
|
obj = Scoutui::Base::QBrowser.findElement(drv, _locator,
|
411
411
|
_frames,
|
412
412
|
_timeout)
|
@@ -419,7 +419,7 @@ module Scoutui::Base
|
|
419
419
|
|
420
420
|
end
|
421
421
|
|
422
|
-
|
422
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " getElement(#{_locator}) : #{obj}, cnt:#{cnt}, isntStale:#{_isntStale}"
|
423
423
|
obj
|
424
424
|
end
|
425
425
|
|
@@ -437,7 +437,7 @@ module Scoutui::Base
|
|
437
437
|
elsif Scoutui::Commands::Utils.instance.isFrameSearch?
|
438
438
|
hits = Scoutui::Base::QBrowser.frame_getObject(drv, _locator, _timeout)
|
439
439
|
|
440
|
-
|
440
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " hits => #{hits.class} : #{hits}"
|
441
441
|
if hits.is_a?(Array) && !hits.empty?
|
442
442
|
obj=hits[0]
|
443
443
|
elsif hits.is_a?(Selenium::WebDriver::Element)
|
@@ -456,7 +456,7 @@ module Scoutui::Base
|
|
456
456
|
|
457
457
|
def self.frame_getObject(drv, _locator, _timeout=nil)
|
458
458
|
|
459
|
-
|
459
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " [enter]:frame_getObject : #{_locator}"
|
460
460
|
|
461
461
|
rc = Array.new()
|
462
462
|
|
@@ -472,7 +472,7 @@ module Scoutui::Base
|
|
472
472
|
|
473
473
|
_obj = getObject(drv, _locator, _timeout)
|
474
474
|
|
475
|
-
|
475
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " frames => #{frames} : #{_obj}"
|
476
476
|
|
477
477
|
if _obj.nil? || (_obj.is_a?(Array) && _obj.empty?)
|
478
478
|
|
@@ -500,7 +500,7 @@ module Scoutui::Base
|
|
500
500
|
drv.switch_to.frame frames[i]
|
501
501
|
else
|
502
502
|
|
503
|
-
|
503
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " switch_to.frame #{_tag}"
|
504
504
|
drv.switch_to.frame _tag
|
505
505
|
end
|
506
506
|
|
@@ -524,7 +524,7 @@ module Scoutui::Base
|
|
524
524
|
break
|
525
525
|
end
|
526
526
|
|
527
|
-
|
527
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " switch_to.parent_frame()"
|
528
528
|
drv.switch_to.parent_frame if _madeSwitch
|
529
529
|
|
530
530
|
end
|
@@ -15,7 +15,7 @@ module Scoutui::Base
|
|
15
15
|
|
16
16
|
def self.processPageElement(my_driver, k, xpath)
|
17
17
|
|
18
|
-
|
18
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " processPageElement(#{xpath})"
|
19
19
|
processed=false
|
20
20
|
_obj=nil
|
21
21
|
|
@@ -78,7 +78,7 @@ module Scoutui::Base
|
|
78
78
|
|
79
79
|
|
80
80
|
if _v.is_a?(String)
|
81
|
-
|
81
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{_v} is a string - next"
|
82
82
|
next
|
83
83
|
end
|
84
84
|
|
@@ -147,7 +147,7 @@ module Scoutui::Base
|
|
147
147
|
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " visible_when : (Array) - TBD #{_v['visible_when']}"
|
148
148
|
|
149
149
|
_v['visible_when'].each do |_vwhen|
|
150
|
-
|
150
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{_vwhen} #{_vwhen.class}"
|
151
151
|
|
152
152
|
Scoutui::Base::Assertions.instance.assertPageElement(_k, _vwhen, _obj, my_driver, _req)
|
153
153
|
|
@@ -157,8 +157,8 @@ module Scoutui::Base
|
|
157
157
|
|
158
158
|
|
159
159
|
rescue => ex
|
160
|
-
Scoutui::Logger::LogMgr.instance.
|
161
|
-
|
160
|
+
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Error during processing: #{ex}"
|
161
|
+
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
|
162
162
|
end
|
163
163
|
|
164
164
|
|
@@ -366,9 +366,9 @@ module Scoutui::Base
|
|
366
366
|
|
367
367
|
_reqID=_a.match(/^\s*(req|requirement)\s*\((.*)\)\s*$/i)[2].to_s
|
368
368
|
|
369
|
-
|
369
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Process REQ ASSERT: #{_reqID}";
|
370
370
|
_reqAsserts=Scoutui::Base::Requirements.instance.get(_reqID)
|
371
|
-
|
371
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " => #{_reqAsserts}"
|
372
372
|
|
373
373
|
_req = Scoutui::Utils::TestUtils.instance.setReq(_reqID)
|
374
374
|
_rc=processAsserts(my_driver, _reqAsserts, _enableAsserts)
|
@@ -410,7 +410,7 @@ module Scoutui::Base
|
|
410
410
|
|
411
411
|
_req = Scoutui::Utils::TestUtils.instance.getReq()
|
412
412
|
|
413
|
-
|
413
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "======= #{e[STEP_KEY][_conditionType]} ========="
|
414
414
|
|
415
415
|
|
416
416
|
e[STEP_KEY][_conditionType].each do |elt|
|
@@ -450,7 +450,7 @@ module Scoutui::Base
|
|
450
450
|
|
451
451
|
if !_locator.match(/^page\([\w\d]+\)/).nil?
|
452
452
|
_obj = processPageElement(my_driver, _k, _locator)
|
453
|
-
|
453
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Processed #{_locator} => #{_obj.class.to_s}"
|
454
454
|
else
|
455
455
|
|
456
456
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " " + _k.to_s + " => " + _locator
|
@@ -475,8 +475,8 @@ module Scoutui::Base
|
|
475
475
|
|
476
476
|
|
477
477
|
|
478
|
-
|
479
|
-
|
478
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " _uservar_val : #{_uservar_val}"
|
479
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Assert user variable - #{user_var} matches #{expected_v} => #{_uservar_val.match(expected_v)}"
|
480
480
|
|
481
481
|
|
482
482
|
if _uservar_val.match(expected_v) || _uservar_val==expected_v
|
@@ -518,9 +518,9 @@ module Scoutui::Base
|
|
518
518
|
|
519
519
|
rescue => ex
|
520
520
|
|
521
|
-
Scoutui::Logger::LogMgr.instance.
|
522
|
-
Scoutui::Logger::LogMgr.instance.
|
523
|
-
|
521
|
+
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " abort processing."
|
522
|
+
Scoutui::Logger::LogMgr.instance.warn "Error during processing: #{ex}"
|
523
|
+
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
|
524
524
|
end
|
525
525
|
|
526
526
|
|
@@ -593,17 +593,17 @@ module Scoutui::Base
|
|
593
593
|
|
594
594
|
_obj = Scoutui::Base::QBrowser.getObject(my_driver, _e, Scoutui::Commands::Utils.instance.getTimeout)
|
595
595
|
|
596
|
-
|
596
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Wait until element #{xpath} => #{_e} is not visible #{_obj}.class.to_s"
|
597
597
|
|
598
598
|
if _obj.nil?
|
599
599
|
_rc = true
|
600
600
|
else
|
601
|
-
|
601
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " _obj => #{_obj} : exists: #{!_obj.nil?}"
|
602
602
|
|
603
603
|
begin
|
604
604
|
Selenium::WebDriver::Wait.new(timeout: _timeout).until {
|
605
605
|
_obj = Scoutui::Base::QBrowser.getObject(my_driver, _e, 5)
|
606
|
-
|
606
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " waiting .. => #{_obj.class.to_s}"
|
607
607
|
|
608
608
|
_obj.nil?
|
609
609
|
}
|
@@ -665,7 +665,7 @@ module Scoutui::Base
|
|
665
665
|
|
666
666
|
|
667
667
|
if _v.is_a?(String)
|
668
|
-
|
668
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{_v} is a string - next"
|
669
669
|
next
|
670
670
|
end
|
671
671
|
|
@@ -740,8 +740,8 @@ module Scoutui::Base
|
|
740
740
|
|
741
741
|
|
742
742
|
rescue => ex
|
743
|
-
Scoutui::Logger::LogMgr.instance.
|
744
|
-
|
743
|
+
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Invalid file: #{datafile} - abort processing."
|
744
|
+
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
|
745
745
|
end
|
746
746
|
|
747
747
|
|
@@ -801,7 +801,7 @@ module Scoutui::Base
|
|
801
801
|
# Scoutui::Base::VisualTestFramework.processFile(@drv, @eyes, @test_settings['host'], @test_settings['dut'])
|
802
802
|
def self.processFile(eyeScout, test_settings, strategy=nil)
|
803
803
|
|
804
|
-
|
804
|
+
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " [enter]:processFile(#{test_settings['dut']})"
|
805
805
|
my_driver = eyeScout.drv()
|
806
806
|
|
807
807
|
baseUrl = Scoutui::Base::UserVars.instance.getHost()
|
@@ -899,7 +899,7 @@ module Scoutui::Base
|
|
899
899
|
|
900
900
|
_rc=(_uservar_val.match(/#{_val}/) || _uservar_val==_val)
|
901
901
|
|
902
|
-
|
902
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " _rc => #{_rc} is nil (#{_rc.nil?})"
|
903
903
|
|
904
904
|
if !_rc
|
905
905
|
Scoutui::Logger::LogMgr.instance.info " Execute_When: #{_uservar_val} == #{_val} : false - skip #{e[STEP_KEY]}"
|
@@ -927,7 +927,7 @@ module Scoutui::Base
|
|
927
927
|
_executeIt=true
|
928
928
|
|
929
929
|
_execute_when.each do |_a|
|
930
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "
|
930
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " execute_when => #{_a.class} : #{_a}"
|
931
931
|
|
932
932
|
|
933
933
|
if _a.to_s.match(/^\s*(\$\{.*\})\s*(==|!=)(.*)$/)
|
@@ -954,7 +954,7 @@ module Scoutui::Base
|
|
954
954
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isEnabled #{_a} : failed"
|
955
955
|
_executeIt=false
|
956
956
|
else
|
957
|
-
|
957
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " IS_ENABLED : #{_a}";
|
958
958
|
end
|
959
959
|
|
960
960
|
|
@@ -963,6 +963,8 @@ module Scoutui::Base
|
|
963
963
|
if !Scoutui::Base::Assertions.instance.isRole?(_a)
|
964
964
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isRole #{_a} : failed"
|
965
965
|
_executeIt = false
|
966
|
+
else
|
967
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " execute => role matched"
|
966
968
|
end
|
967
969
|
|
968
970
|
elsif Scoutui::Base::Assertions.instance.isVisibleCmd?(_a)
|
@@ -1003,7 +1005,7 @@ module Scoutui::Base
|
|
1003
1005
|
elsif _execute_when.is_a?(String)
|
1004
1006
|
_rc=Scoutui::Base::Assertions.instance.isVisible(my_driver, _execute_when, _reqid, true)
|
1005
1007
|
|
1006
|
-
|
1008
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " EXECUTE_WHEN #{_rc}";
|
1007
1009
|
|
1008
1010
|
if !_rc
|
1009
1011
|
Scoutui::Logger::LogMgr.instance.info " Execute_When: true - skip #{e[STEP_KEY]}"
|
@@ -1014,6 +1016,7 @@ module Scoutui::Base
|
|
1014
1016
|
end
|
1015
1017
|
|
1016
1018
|
|
1019
|
+
|
1017
1020
|
skipIt = (!_skip.nil?) && (_skip.to_s.strip.downcase=='true')
|
1018
1021
|
Scoutui::Logger::LogMgr.instance.info "\to skip : #{skipIt}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
1019
1022
|
|
@@ -1032,18 +1035,18 @@ module Scoutui::Base
|
|
1032
1035
|
if e[STEP_KEY].has_key?('command')
|
1033
1036
|
_id = e[STEP_KEY]['command']['id'].to_s
|
1034
1037
|
_rc=CmdShellMgr::DSL.instance.cmd(:cmd => "execute(#{_id})")
|
1035
|
-
|
1038
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " rc => #{_rc}"
|
1036
1039
|
next
|
1037
1040
|
end
|
1038
1041
|
|
1039
1042
|
if e[STEP_KEY].has_key?('getResults')
|
1040
1043
|
_id = e[STEP_KEY]['getResults']['id'].to_s
|
1041
1044
|
_rc = CmdShellMgr::DSL.instance.cmd(:cmd => "getResults(#{_id})")
|
1042
|
-
|
1045
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " rc => #{_rc}"
|
1043
1046
|
|
1044
1047
|
if e[STEP_KEY]['getResults'].has_key?('capture')
|
1045
1048
|
m2=CmdShellMgr::DSL.instance.cmd(:cmd => "getResult(#{_id}).capture(#{e[STEP_KEY]['getResults']['capture'].to_s})")
|
1046
|
-
|
1049
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Capture => #{m2}"
|
1047
1050
|
|
1048
1051
|
|
1049
1052
|
if e[STEP_KEY]['getResults'].has_key?('assignto')
|
@@ -1103,8 +1106,6 @@ module Scoutui::Base
|
|
1103
1106
|
end
|
1104
1107
|
|
1105
1108
|
processExpected(my_driver, e)
|
1106
|
-
|
1107
|
-
|
1108
1109
|
processAssertions(my_driver, e)
|
1109
1110
|
_assertResult=processAsserts(my_driver, e[STEP_KEY]["asserts"])
|
1110
1111
|
|
@@ -1139,6 +1140,10 @@ module Scoutui::Base
|
|
1139
1140
|
return
|
1140
1141
|
end
|
1141
1142
|
|
1143
|
+
|
1144
|
+
##
|
1145
|
+
# SaveAs
|
1146
|
+
##
|
1142
1147
|
if e[STEP_KEY].has_key?('saveas')
|
1143
1148
|
# processSaveAs(e)
|
1144
1149
|
|
@@ -1160,19 +1165,24 @@ module Scoutui::Base
|
|
1160
1165
|
end
|
1161
1166
|
|
1162
1167
|
rescue => ex
|
1163
|
-
|
1164
|
-
|
1168
|
+
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " #{ex}"
|
1169
|
+
Scoutui::Logger::LogMgr.instance.warn ex.backtrace
|
1165
1170
|
ensure
|
1166
1171
|
_f.close
|
1167
1172
|
end
|
1168
1173
|
|
1169
1174
|
end
|
1170
1175
|
|
1176
|
+
if Scoutui::Utils::TestUtils.instance.screenShots?
|
1177
|
+
_saveScreenAs=Scoutui::Utils::TestUtils.instance.sanitize_filename(_name)
|
1178
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ScreenSave : #{_saveScreenAs}"
|
1179
|
+
my_driver.save_screenshot("/tmp/#{_saveScreenAs}.png")
|
1180
|
+
end
|
1171
1181
|
|
1172
1182
|
if isSnapIt(e)
|
1173
1183
|
|
1174
1184
|
if QBrowser.existsAlert?(my_driver)
|
1175
|
-
|
1185
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Snapit with existing Alert"
|
1176
1186
|
end
|
1177
1187
|
|
1178
1188
|
if !_region.nil?
|
@@ -1222,6 +1232,8 @@ module Scoutui::Base
|
|
1222
1232
|
|
1223
1233
|
processExpected(my_driver, e)
|
1224
1234
|
processAssertions(my_driver, e)
|
1235
|
+
_assertResult=processAsserts(my_driver, e[STEP_KEY]["asserts"]) # 5150
|
1236
|
+
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " ====== assertResults : #{_assertResult}"
|
1225
1237
|
|
1226
1238
|
if e[STEP_KEY].has_key?("highlight") && e[STEP_KEY]["highlight"].has_key?("locators")
|
1227
1239
|
_cmd="Highlight"
|
@@ -30,7 +30,7 @@ module Scoutui::Commands
|
|
30
30
|
elsif _pg.is_a?(String)
|
31
31
|
isVisible=Scoutui::Base::Assertions.instance.isVisible(@drv, _pg, _r)
|
32
32
|
else
|
33
|
-
|
33
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " => #{_pg}"
|
34
34
|
end
|
35
35
|
|
36
36
|
end
|
@@ -102,7 +102,7 @@ module Scoutui::Commands
|
|
102
102
|
|
103
103
|
(0..5).each do |_i|
|
104
104
|
_retry = true
|
105
|
-
|
105
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{_i} => click(#{obj})"
|
106
106
|
begin
|
107
107
|
|
108
108
|
_startTime=Time.now
|
@@ -37,7 +37,7 @@ module Scoutui::Commands
|
|
37
37
|
elsif _pg.is_a?(String)
|
38
38
|
isVisible=Scoutui::Base::Assertions.instance.isVisible(@drv, _pg, _r)
|
39
39
|
else
|
40
|
-
|
40
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " => #{_pg}"
|
41
41
|
end
|
42
42
|
|
43
43
|
# Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " IsVisible #{isVisible} - PAUSE"; gets
|
@@ -151,13 +151,13 @@ module Scoutui::Commands
|
|
151
151
|
for i in 0 .. (_uservars.size - 1)
|
152
152
|
|
153
153
|
_t = Scoutui::Base::UserVars.instance.get(_uservars[i][0])
|
154
|
-
|
154
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " translate(#{_uservars[i][0]}) => #{_t}"
|
155
155
|
|
156
156
|
if !_t.nil? && _uservars[i][0]!=_t
|
157
157
|
_v2.gsub!("\$\{#{_uservars[i][0]}\}", _t)
|
158
158
|
end
|
159
159
|
|
160
|
-
|
160
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " value => #{_v2}"
|
161
161
|
|
162
162
|
end
|
163
163
|
|
@@ -193,7 +193,7 @@ module Scoutui::Commands
|
|
193
193
|
|
194
194
|
|
195
195
|
|
196
|
-
|
196
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Stale: #{_stale}, i: #{_cnt}, _inRow:#{_inRow}"
|
197
197
|
end
|
198
198
|
|
199
199
|
obj.send_keys(_text_to_type)
|
@@ -213,7 +213,7 @@ module Scoutui::Commands
|
|
213
213
|
if i > 0
|
214
214
|
obj.send_keys("")
|
215
215
|
@drv.action.send_keys(:enter).perform
|
216
|
-
|
216
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ENTER"; STDIN.gets()
|
217
217
|
obj.send_keys("<ENTER>")
|
218
218
|
end
|
219
219
|
|
@@ -234,8 +234,8 @@ module Scoutui::Commands
|
|
234
234
|
end
|
235
235
|
|
236
236
|
rescue => ex
|
237
|
-
Scoutui::Logger::LogMgr.instance.
|
238
|
-
|
237
|
+
Scoutui::Logger::LogMgr.instance.warn "Error during processing: #{ex.class}"
|
238
|
+
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
|
239
239
|
end
|
240
240
|
|
241
241
|
_endTime=Time.now
|
@@ -39,7 +39,7 @@ module Scoutui::Commands
|
|
39
39
|
_stop=Time.now
|
40
40
|
_duration=_stop - _start
|
41
41
|
|
42
|
-
|
42
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Perf navigate to #{normUrl} : #{_duration}"
|
43
43
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " => title #{@drv.title.to_s}"
|
44
44
|
_rc=true
|
45
45
|
rescue => ex
|
@@ -59,34 +59,34 @@ module Scoutui::Commands
|
|
59
59
|
'__DDMMYY__' => lambda { Date.parse(Time.now.to_s).strftime("%d%m%Y") },
|
60
60
|
'__MM/DD/YY__' => lambda { Date.parse(Time.now.to_s).strftime("%m/%d/%y") },
|
61
61
|
'__MM/DD/YY\+\d+__' => lambda { |s|
|
62
|
-
|
62
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Process s => #{s}"
|
63
63
|
d=s.match(/__MM\/DD\/YY\+(\d+)__/)[1]
|
64
64
|
d=(Date.today + d.to_i).strftime("%m/%d/%y")
|
65
|
-
|
65
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " new date: #{d}"
|
66
66
|
d
|
67
67
|
},
|
68
68
|
'__MMDDYY__' => lambda { Date.parse(Time.now.to_s).strftime("%m%d%y") },
|
69
69
|
'__MMDDYY\+\d+__' => lambda { |s|
|
70
|
-
|
70
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Process s => #{s}"
|
71
71
|
d=s.match(/__MMDDYY\+(\d+)__/)[1]
|
72
72
|
d=(Date.today + d.to_i).strftime("%m%d%y")
|
73
|
-
|
73
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " new date: #{d}"
|
74
74
|
d
|
75
75
|
},
|
76
76
|
'__MM/DD/YYYY__' => lambda { Date.parse(Time.now.to_s).strftime("%m/%d/%Y") },
|
77
77
|
'__MM/DD/YYYY\+\d+__' => lambda { |s|
|
78
|
-
|
78
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Process s => #{s}"
|
79
79
|
d=s.match(/__MM\/DD\/YYYY\+(\d+)__/)[1]
|
80
80
|
d=(Date.today + d.to_i).strftime("%m/%d/%Y")
|
81
|
-
|
81
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " new date: #{d}"
|
82
82
|
d
|
83
83
|
},
|
84
84
|
'__MMDDYYYY__' => lambda { Date.parse(Time.now.to_s).strftime("%m%d%Y") },
|
85
85
|
'__MMDDYYYY\+\d+__' => lambda { |s|
|
86
|
-
|
86
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Process s => #{s}"
|
87
87
|
d=s.match(/__MMDDYYYY\+(\d+)__/)[1]
|
88
88
|
d=(Date.today + d.to_i).strftime("%m%d%Y")
|
89
|
-
|
89
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " new date: #{d}"
|
90
90
|
d
|
91
91
|
},
|
92
92
|
'__PARAGRAPH__' => lambda { Faker::Lorem.paragraph.to_s },
|
@@ -144,7 +144,7 @@ module Scoutui::Commands
|
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
|
-
|
147
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " expandMacro : #{_text_to_type}"
|
148
148
|
|
149
149
|
_text_to_type.to_s
|
150
150
|
|
@@ -156,7 +156,7 @@ module Scoutui::Commands
|
|
156
156
|
setEnableFrameSearch(false)
|
157
157
|
|
158
158
|
if stanza.is_a?(Hash) && stanza.has_key?('page') && stanza['page'].has_key?('frames')
|
159
|
-
|
159
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " frames => #{stanza['page']['frames']}";
|
160
160
|
|
161
161
|
setEnableFrameSearch(stanza['page']['frames'])
|
162
162
|
# setEnableFrameSearch(!stanza['page']['frames'].to_s.match(/true/i).nil?)
|
@@ -62,6 +62,17 @@ 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.eyesBatchname().nil?
|
66
|
+
batch = Applitools::Base::BatchInfo.new(Scoutui::Utils::TestUtils.instance.eyesBatchname())
|
67
|
+
|
68
|
+
if !Scoutui::Utils::TestUtils.instance.eyesBatchId().nil?
|
69
|
+
batch.id = Scoutui::Utils::TestUtils.instance.eyesBatchId()
|
70
|
+
end
|
71
|
+
|
72
|
+
eyes.batch = batch
|
73
|
+
end
|
74
|
+
|
75
|
+
|
65
76
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " eyes => #{eyes}"
|
66
77
|
end
|
67
78
|
|
@@ -236,7 +236,7 @@ module Scoutui::Eyes
|
|
236
236
|
# Testmgr::TestReport.instance.generateReport()
|
237
237
|
|
238
238
|
metrics=Testmgr::TestReport.instance.getMetrics()
|
239
|
-
|
239
|
+
puts __FILE__ + (__LINE__).to_s + "Metrics => #{metrics}"
|
240
240
|
|
241
241
|
Scoutui::Utils::TestUtils.instance.setMetrics(metrics)
|
242
242
|
end
|
@@ -64,7 +64,8 @@ module Scoutui::Logger
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def setLevel(_level)
|
67
|
-
|
67
|
+
|
68
|
+
@asserts.level = @benchmarks.level = @commands.level = @root.level = _level.to_sym
|
68
69
|
|
69
70
|
_l = _level.to_s
|
70
71
|
if _l.match(/debug/i)
|
@@ -77,6 +78,8 @@ module Scoutui::Logger
|
|
77
78
|
@level = LOGLEVELS[ERROR]
|
78
79
|
elsif _l.match(/fatal/i)
|
79
80
|
@level = LOGLEVELS[FATAL]
|
81
|
+
else
|
82
|
+
raise "UNKNOWN_LEVEL"
|
80
83
|
end
|
81
84
|
|
82
85
|
end
|
data/lib/scoutui/utils/utils.rb
CHANGED
@@ -45,11 +45,14 @@ module Scoutui::Utils
|
|
45
45
|
@options[:enable_eyes]=false
|
46
46
|
@options[:enable_fullscreen]=true
|
47
47
|
@options[:enable_sauce]=false
|
48
|
+
@options[:batchid]=nil
|
49
|
+
@options[:batchname]=nil
|
48
50
|
@options[:log_level]=:info # :debug, :info, :warn, :error, :fatal
|
49
51
|
@options[:match_level]='layout'
|
50
52
|
@options[:default_wait]=30 # seconds
|
51
53
|
@options[:debug]=false
|
52
54
|
@options[:fail_fast]=false
|
55
|
+
@options[:screenshots]=false
|
53
56
|
|
54
57
|
|
55
58
|
@app_model=nil
|
@@ -248,6 +251,8 @@ module Scoutui::Utils
|
|
248
251
|
@options[:enable_eyes]=true
|
249
252
|
}
|
250
253
|
opt.on('--eyes:run Bool', [:true, :false]) { |o| @options[:enable_eyes] = !o.match(/true/i).nil? }
|
254
|
+
opt.on('--eyes:batchname Name') { |o| @options[:batchname] = o }
|
255
|
+
opt.on('--eyes:batchid ID') { |o| @options[:batchid] = o }
|
251
256
|
opt.on('--eyes:fullscreen Bool', [:true, :false]) { |o| @options[:enable_fullscreen] = !o.match(/true/i).nil? }
|
252
257
|
opt.on('--eyes:app AppName') { |o| @options[:app] = o }
|
253
258
|
opt.on('--eyes:title Title') { |o| @options[:title] = o }
|
@@ -256,6 +261,9 @@ module Scoutui::Utils
|
|
256
261
|
opt.on('--report:junit File') { |o| @options[:report] = o }
|
257
262
|
|
258
263
|
|
264
|
+
opt.on('--screenshots Bool', [:true, :false]) { |o| @options[:screenshots] = !o.match(/true/i).nil? }
|
265
|
+
|
266
|
+
|
259
267
|
|
260
268
|
opt.on('--role ROLE') { |o|
|
261
269
|
@options[:role]=o
|
@@ -347,6 +355,27 @@ module Scoutui::Utils
|
|
347
355
|
@options[:capabilities]
|
348
356
|
end
|
349
357
|
|
358
|
+
|
359
|
+
def sanitize_filename(filename)
|
360
|
+
# Split the name when finding a period which is preceded by some
|
361
|
+
# character, and is followed by some character other than a period,
|
362
|
+
# if there is no following period that is followed by something
|
363
|
+
# other than a period
|
364
|
+
fn = filename.split /(?<=.)\.(?=[^.])(?!.*\.[^.])/m
|
365
|
+
|
366
|
+
# We now have one or two parts (depending on whether we could find
|
367
|
+
# a suitable period). For each of these parts, replace any unwanted
|
368
|
+
# sequence of characters with an underscore
|
369
|
+
fn.map! { |s| s.gsub /[^a-z0-9\-]+/i, '_' }
|
370
|
+
|
371
|
+
# Finally, join the parts with a period and return the result
|
372
|
+
return fn.join '.'
|
373
|
+
end
|
374
|
+
|
375
|
+
def screenShots?
|
376
|
+
@options[:screenshots]
|
377
|
+
end
|
378
|
+
|
350
379
|
def getHost()
|
351
380
|
@options[:host].to_s
|
352
381
|
end
|
@@ -363,6 +392,14 @@ module Scoutui::Utils
|
|
363
392
|
@options[:debug]
|
364
393
|
end
|
365
394
|
|
395
|
+
def eyesBatchname()
|
396
|
+
@options[:batchname]
|
397
|
+
end
|
398
|
+
|
399
|
+
def eyesBatchId()
|
400
|
+
@options[:batchid]
|
401
|
+
end
|
402
|
+
|
366
403
|
def eyesEnabled?
|
367
404
|
@options[:enable_eyes]
|
368
405
|
end
|
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.49.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-09-
|
11
|
+
date: 2016-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -275,6 +275,7 @@ files:
|
|
275
275
|
- examples/eyes/diff.rb
|
276
276
|
- examples/eyes/ex2.rb
|
277
277
|
- examples/eyes_results/response.json
|
278
|
+
- examples/screenshot/fullshot.rb
|
278
279
|
- examples/shell/run_shell.rb
|
279
280
|
- examples/shell/runit.sh
|
280
281
|
- examples/yaml/dut.yml
|