scoutui 2.0.3.30.pre → 2.0.3.31.pre
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/lib/scoutui/base/assertions.rb +109 -26
- data/lib/scoutui/base/visual_test_framework.rb +23 -5
- data/lib/scoutui/eyes/eye_scout.rb +1 -1
- data/lib/scoutui/utils/utils.rb +7 -1
- data/lib/scoutui/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73a3448dde2bef2a6176cd5a8845b08caca7d92c
|
4
|
+
data.tar.gz: 808bda329dce2017ffd5133606337a70512a2379
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59ba1d8747567b7a8261afd434f3a86e8c8a6913d6e28a1d7afaee997b0e72041d12c03d72ceb03fb488e116219c393957a8e366891697fa88c3b3d14f53dd37
|
7
|
+
data.tar.gz: 0cca14d03c2acb9a15c87cf6b979f61a0f8a4840f39a47860842c0ed1062b5755697e644d23efb24f8ebe92e4efe50d6883f5a5178524b84a34c0aefa0aca518
|
@@ -13,8 +13,10 @@ module Scoutui::Base
|
|
13
13
|
|
14
14
|
def initialize
|
15
15
|
@assertionTypes=[
|
16
|
-
{ :cmd => 'isEnabled', :pattern => '^\s*[!]*isEnabled\((.*)\)\s*$'},
|
17
|
-
{ :cmd => '
|
16
|
+
{ :cmd => 'isEnabled', :pattern => '^\s*[!]*isEnabled\((.*)\)\s*$', :parse => lambda { |_a| _parseFrameLoc('isEnabled', _a) } },
|
17
|
+
{ :cmd => 'isSelected', :pattern => '^\s*[!]*isSelected\((.*)\)\s*$', :parse => lambda { |_a| _parseFrameLoc('isSelected', _a) } },
|
18
|
+
{ :cmd => 'isValue', :pattern => '^\s*(isValue)\s*\(.*\)\s*\=\s*(.*)\s*$', :parse => lambda { |_a| _parseWith('isValue', _a) } },
|
19
|
+
{ :cmd => 'visible', :pattern => '^\s*[!]*visible\((.*)\)\s*$', :parse => nil }
|
18
20
|
]
|
19
21
|
|
20
22
|
end
|
@@ -26,14 +28,15 @@ module Scoutui::Base
|
|
26
28
|
@assertionTypes.each do |e|
|
27
29
|
_p=e[:pattern]
|
28
30
|
|
29
|
-
puts __FILE__ + (__LINE__).to_s + " == verify #{_p} =="
|
31
|
+
puts __FILE__ + (__LINE__).to_s + " == verify #{_a} matches #{_p} =="
|
30
32
|
|
31
33
|
if _a.match(/#{_p}/)
|
34
|
+
puts __FILE__ + (__LINE__).to_s + " matched : #{e}"
|
32
35
|
return e
|
33
36
|
end
|
34
37
|
end
|
35
38
|
|
36
|
-
puts
|
39
|
+
puts __FILE__ + (__LINE__).to_s + " => unknown command : #{_a}"
|
37
40
|
return nil
|
38
41
|
end
|
39
42
|
|
@@ -41,9 +44,54 @@ module Scoutui::Base
|
|
41
44
|
@drv=_drv
|
42
45
|
end
|
43
46
|
|
47
|
+
def _parseWith(_cmd, _a)
|
48
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " _parseWith(#{_cmd}, #{_a})"
|
49
|
+
rc=nil
|
50
|
+
|
51
|
+
begin
|
52
|
+
_fMatch=nil
|
53
|
+
_expectedVal=nil
|
54
|
+
|
55
|
+
_pattern='(frame\(.*\)[\.frame\(.*\)]*)\s*,\s*(.*)\s*$'
|
56
|
+
|
57
|
+
c=_a.match(/^\s*([!]*#{_cmd})\((.*)\)\s*\=(.*)\s*$/)
|
58
|
+
|
59
|
+
if c
|
60
|
+
cmd = c[1].strip
|
61
|
+
_fMatch = c[2].match(/#{_pattern}/)
|
62
|
+
_expectedVal = c[3]
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
if _fMatch
|
67
|
+
f=c[2].strip
|
68
|
+
|
69
|
+
puts __FILE__ + (__LINE__).to_s + " arg: #{f}"
|
70
|
+
|
71
|
+
rc = { 'cmd' => cmd,
|
72
|
+
'frame' => _fMatch[1].strip,
|
73
|
+
'locator' => _fMatch[2].strip,
|
74
|
+
'expected_value' => _expectedVal }
|
75
|
+
elsif c
|
76
|
+
rc = {
|
77
|
+
'cmd' => cmd,
|
78
|
+
'locator' => c[2].strip,
|
79
|
+
'expected_value' => _expectedVal
|
80
|
+
}
|
81
|
+
end
|
82
|
+
|
83
|
+
rescue => ex
|
84
|
+
;
|
85
|
+
end
|
86
|
+
|
87
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " => #{rc}"
|
88
|
+
rc
|
89
|
+
end
|
44
90
|
|
45
91
|
# _a : frame(xyz).frame(123), <locator>
|
46
92
|
def _parseFrameLoc(_cmd, _a)
|
93
|
+
|
94
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " _parseFrameLoc(#{_cmd}, #{_a})"
|
47
95
|
rc=nil
|
48
96
|
|
49
97
|
begin
|
@@ -85,10 +133,6 @@ module Scoutui::Base
|
|
85
133
|
_a.is_a?(String) && _a.match(/^\s*[!]*isEnabled\((.*)\)\s*$/i)
|
86
134
|
end
|
87
135
|
|
88
|
-
def isEnabledFrameCmd?(_a)
|
89
|
-
_parseFrameLoc('isEnabled', _a)
|
90
|
-
end
|
91
|
-
|
92
136
|
def isRoleCmd?(_a)
|
93
137
|
_a.is_a?(String) && _a.match(/^\s*(isrole|role)\(.*\)\s*/i)
|
94
138
|
end
|
@@ -180,19 +224,31 @@ module Scoutui::Base
|
|
180
224
|
|
181
225
|
puts __FILE__ + (__LINE__).to_s + " #{condition} : #{obj}"
|
182
226
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
227
|
+
begin
|
228
|
+
|
229
|
+
if !obj.nil?
|
230
|
+
if condition.match(/^\s*text/)
|
231
|
+
_txt = obj.text
|
232
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " text : #{_txt}"
|
233
|
+
expected_regex = Regexp.new(expectedVal)
|
234
|
+
rc = !_txt.to_s.match(expected_regex).nil?
|
235
|
+
elsif condition.match(/^\s*value/)
|
236
|
+
_txt = obj.attribute('value')
|
237
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " value : #{_txt}"
|
238
|
+
expected_regex = Regexp.new(expectedVal)
|
239
|
+
rc = !_txt.to_s.match(expected_regex).nil?
|
240
|
+
else
|
241
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Unknown conditon: #{condition}"
|
242
|
+
end
|
243
|
+
|
244
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "txt/val: #{_txt} rc => #{rc}"
|
193
245
|
end
|
194
246
|
|
195
|
-
|
247
|
+
|
248
|
+
rescue => ex
|
249
|
+
rc=false
|
250
|
+
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " #{ex.class.to_s}"
|
251
|
+
puts __FILE__ + (__LINE__).to_s + "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
|
196
252
|
end
|
197
253
|
|
198
254
|
end
|
@@ -202,29 +258,47 @@ module Scoutui::Base
|
|
202
258
|
|
203
259
|
|
204
260
|
def isEnabled?(my_driver, _execute_when)
|
205
|
-
rc=true
|
206
261
|
|
207
|
-
|
262
|
+
rc=true
|
208
263
|
_locator=nil
|
209
264
|
_obj=nil
|
265
|
+
_t=nil
|
210
266
|
|
211
|
-
|
267
|
+
_assertType=isValidAssertType(_execute_when)
|
268
|
+
puts __FILE__ + (__LINE__).to_s + " assertType => #{_assertType}"
|
269
|
+
if !_assertType.nil?
|
270
|
+
_t = _assertType[:parse].call(_execute_when)
|
271
|
+
end
|
212
272
|
|
213
273
|
if !_t.nil?
|
214
274
|
_locator = _t['locator']
|
275
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " locator => #{_locator}"
|
215
276
|
|
216
277
|
if _t.has_key?('frame')
|
217
278
|
Scoutui::Commands::Utils.instance.setEnableFrameSearch(_t['frame'])
|
218
279
|
end
|
219
280
|
|
220
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isChecked => #{_locator}"
|
221
281
|
_obj = Scoutui::Base::QBrowser.findElement(my_driver, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
|
222
282
|
else
|
223
|
-
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " invalid
|
283
|
+
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " invalid assertion cmd: #{_execute_when}"
|
224
284
|
end
|
225
285
|
|
226
286
|
|
227
|
-
if _obj.is_a?(Selenium::WebDriver::Element) && _t.has_key?('cmd') && !_t['cmd'].empty?
|
287
|
+
if _obj.is_a?(Selenium::WebDriver::Element) && _t.has_key?('cmd') && !_t['cmd'].empty? && _t['cmd'].match(/[!]*isSelected/i)
|
288
|
+
|
289
|
+
_selected = _obj.selected?
|
290
|
+
if _execute_when.match(/^\s*!isSelected/i) && _selected
|
291
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " !isSelected(#{_locator}) : false"
|
292
|
+
rc=false
|
293
|
+
elsif _execute_when.match(/^\s*isSelected/i) && !_selected
|
294
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isSelected(#{_locator}) : false"
|
295
|
+
rc=false
|
296
|
+
end
|
297
|
+
|
298
|
+
|
299
|
+
##
|
300
|
+
# Object must exist and be enabled to 'pass' assertion.
|
301
|
+
elsif _obj.is_a?(Selenium::WebDriver::Element) && _t.has_key?('cmd') && !_t['cmd'].empty? && _t['cmd'].match(/[!]*isEnabled/i)
|
228
302
|
|
229
303
|
_enabled = _obj.enabled?
|
230
304
|
|
@@ -238,11 +312,20 @@ module Scoutui::Base
|
|
238
312
|
rc=false
|
239
313
|
end
|
240
314
|
|
315
|
+
elsif _t.has_key?('cmd') && !_t['cmd'].empty? && _t['cmd'].match(/[!]*isValue/i)
|
316
|
+
rc=false
|
317
|
+
|
318
|
+
if _obj.is_a?(Selenium::WebDriver::Element)
|
319
|
+
_v = _obj.attribute('value')
|
320
|
+
rc=!_v.match(/#{_t['expected_value']}/).nil?
|
321
|
+
end
|
322
|
+
|
323
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " assert #{_t['locator']} expected: #{_t['expected_value']} with actual: #{_v} => #{rc}"
|
241
324
|
else
|
242
325
|
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Element not found: #{_execute_when}"
|
243
326
|
end
|
244
327
|
|
245
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "
|
328
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " GeneralAssertion: #{_execute_when} => #{rc}"
|
246
329
|
rc
|
247
330
|
end
|
248
331
|
|
@@ -322,14 +322,14 @@ module Scoutui::Base
|
|
322
322
|
|
323
323
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " processAsserts#{_execute_when}"
|
324
324
|
|
325
|
-
|
325
|
+
result=true
|
326
326
|
|
327
327
|
if !_execute_when.nil? && _execute_when.is_a?(Array)
|
328
328
|
|
329
329
|
_req = Scoutui::Utils::TestUtils.instance.getReq()
|
330
330
|
|
331
331
|
_execute_when.each do |_a|
|
332
|
-
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "
|
332
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " assert: => #{_a}"
|
333
333
|
|
334
334
|
_rc=nil
|
335
335
|
|
@@ -343,6 +343,10 @@ module Scoutui::Base
|
|
343
343
|
_rc=Scoutui::Base::Assertions.instance.isEnabled?(my_driver, _a)
|
344
344
|
elsif _assertType[:cmd]=='visible'
|
345
345
|
_rc=Scoutui::Base::Assertions.instance.isVisible?(my_driver, _a)
|
346
|
+
elsif _assertType[:cmd]=='isSelected'
|
347
|
+
_rc=Scoutui::Base::Assertions.instance.isEnabled?(my_driver, _a)
|
348
|
+
elsif _assertType[:cmd]=='isValue'
|
349
|
+
_rc=Scoutui::Base::Assertions.instance.isEnabled?(my_driver, _a)
|
346
350
|
end
|
347
351
|
|
348
352
|
elsif Scoutui::Base::Assertions.instance.isRoleCmd?(_a)
|
@@ -358,15 +362,20 @@ module Scoutui::Base
|
|
358
362
|
end
|
359
363
|
|
360
364
|
if !_rc.nil?
|
361
|
-
Scoutui::Logger::LogMgr.instance.asserts.info __FILE__ + (__LINE__).to_s + "Verify #{_a} - #{_rc}"
|
365
|
+
Scoutui::Logger::LogMgr.instance.asserts.info __FILE__ + (__LINE__).to_s + " Verify #{_a} - #{_rc}"
|
362
366
|
Testmgr::TestReport.instance.getReq(_req).get_child('visible_when').add(_rc, "Verify #{_a}")
|
363
367
|
|
364
368
|
Scoutui::Commands::Utils.instance.resetFrameSearch()
|
369
|
+
|
370
|
+
result=(result && _rc)
|
365
371
|
end
|
366
372
|
|
367
373
|
end
|
368
374
|
end
|
369
375
|
|
376
|
+
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " ************* processAsserts() => #{result}"
|
377
|
+
result
|
378
|
+
|
370
379
|
end
|
371
380
|
|
372
381
|
|
@@ -789,7 +798,8 @@ module Scoutui::Base
|
|
789
798
|
dut_dupes = YAML.load_stream File.read(datafile)
|
790
799
|
valid_file=true
|
791
800
|
rescue => ex
|
792
|
-
Scoutui::
|
801
|
+
Scoutui::Utils::TestUtils.instance.setState(:abort, "Unable to read #{datafile}.")
|
802
|
+
Scoutui::Logger::LogMgr.instance.fatal __FILE__ + (__LINE__).to_s + " #{ex.class}: Invalid file: #{datafile} - abort processing."
|
793
803
|
Scoutui::Logger::LogMgr.instance.info ex.backtrace
|
794
804
|
end
|
795
805
|
|
@@ -1024,8 +1034,16 @@ module Scoutui::Base
|
|
1024
1034
|
|
1025
1035
|
processExpected(my_driver, e)
|
1026
1036
|
|
1037
|
+
|
1027
1038
|
processAssertions(my_driver, e)
|
1028
|
-
processAsserts(my_driver, e[STEP_KEY]["asserts"])
|
1039
|
+
_assertResult=processAsserts(my_driver, e[STEP_KEY]["asserts"])
|
1040
|
+
|
1041
|
+
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " ====== assertResults : #{_assertResult}"
|
1042
|
+
|
1043
|
+
if !_assertResult && Scoutui::Utils::TestUtils.instance.isFailFast?
|
1044
|
+
Scoutui::Utils::TestUtils.instance.setState(:abort, 'Failed assertion with failfast enabled.')
|
1045
|
+
return
|
1046
|
+
end
|
1029
1047
|
|
1030
1048
|
if e[STEP_KEY].has_key?('saveas')
|
1031
1049
|
# processSaveAs(e)
|
@@ -225,7 +225,7 @@ module Scoutui::Eyes
|
|
225
225
|
Scoutui::Logger::LogMgr.instance.info " Eyes.TestResults.Steps : #{@testResults.steps.to_s}"
|
226
226
|
end
|
227
227
|
|
228
|
-
Testmgr::TestReport.instance.getReq("Execution").testcase('Status').add(!Scoutui::Utils::TestUtils.instance.abort?, "Verify execution did not abort.")
|
228
|
+
Testmgr::TestReport.instance.getReq("Execution").testcase('Status').add(!Scoutui::Utils::TestUtils.instance.abort?, "Verify execution did not abort. #{Scoutui::Utils::TestUtils.instance.currentMessage}")
|
229
229
|
|
230
230
|
Scoutui::Logger::LogMgr.instance.info " TestReport.Tap => #{@testResults.to_json}"
|
231
231
|
|
data/lib/scoutui/utils/utils.rb
CHANGED
@@ -22,6 +22,7 @@ module Scoutui::Utils
|
|
22
22
|
|
23
23
|
def initialize
|
24
24
|
|
25
|
+
@currentMessage=""
|
25
26
|
@coverage={:pages => []}
|
26
27
|
@final_rc=false
|
27
28
|
@metrics=nil
|
@@ -56,8 +57,13 @@ module Scoutui::Utils
|
|
56
57
|
|
57
58
|
end
|
58
59
|
|
59
|
-
def setState(s)
|
60
|
+
def setState(s, _d=nil)
|
60
61
|
@execution_status=s
|
62
|
+
@currentMessage=_d if !_d.nil?
|
63
|
+
end
|
64
|
+
|
65
|
+
def currentMessage
|
66
|
+
@currentMessage
|
61
67
|
end
|
62
68
|
|
63
69
|
def abort?
|
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.31.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-07-
|
11
|
+
date: 2016-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|