scoutui 2.0.3.28.pre → 2.0.3.29.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/examples/converters/jsonupdate.rb +31 -0
- data/examples/ex6/tests/test.sh +1 -1
- data/lib/scoutui/base/assertions.rb +25 -2
- data/lib/scoutui/base/visual_test_framework.rb +63 -13
- data/lib/scoutui/utils/utils.rb +49 -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: 5d84c794cae92dd79cce22350ab9384e82ec4569
|
4
|
+
data.tar.gz: bffc895c5992b8bcbbbdfe63d2977fc2d3ac36c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4f33996046dd9dda7e351056b926995877969033b674ad9ba41828cef58de0b11293151fa00448049a4dc0c2a74f8b42bb3c4f543e9b7ab4cb060c4ffc80308
|
7
|
+
data.tar.gz: 1308726062f9fff6cfae328a657bb72571a3a878eb081a703942f21fd42c7b003a1881be52a2c1c825701c2145d597dc65262e10cb6a3a5924faf79c03eafc85
|
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
def iterate(h)
|
4
|
+
h.each do |k, v|
|
5
|
+
if v.is_a?(Hash) || v.is_a?(Array)
|
6
|
+
iterate(v)
|
7
|
+
else
|
8
|
+
puts("k is #{k}, value is #{v}")
|
9
|
+
if v.match(/peter/i)
|
10
|
+
h[k]='Elvis'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
h={
|
18
|
+
'person': {
|
19
|
+
'first': 'Peter',
|
20
|
+
'last': 'Kim',
|
21
|
+
'address': {
|
22
|
+
'city': 'Manhattan peter',
|
23
|
+
'state': 'New York'
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
|
29
|
+
iterate(h)
|
30
|
+
|
31
|
+
puts "h => #{h}"
|
data/examples/ex6/tests/test.sh
CHANGED
@@ -27,6 +27,11 @@ module Scoutui::Base
|
|
27
27
|
_a.is_a?(String) && _a.match(/^\s*[!]*(isSelected|selected)\((.*)\)\s*$/i)
|
28
28
|
end
|
29
29
|
|
30
|
+
|
31
|
+
def isTitleCmd?(_a)
|
32
|
+
_a.is_a?(String) && _a.match(/^\s*[!]*(isTitle|title)\s*\((.*)\)\s*$/i)
|
33
|
+
end
|
34
|
+
|
30
35
|
def isValueCmd?(_a)
|
31
36
|
_a.is_a?(String) && _a.match(/^\s*(value|text)\s*\(.*\)\s*\=\s*(.*)/i)
|
32
37
|
end
|
@@ -35,6 +40,24 @@ module Scoutui::Base
|
|
35
40
|
_a.is_a?(String) && _a.match(/^\s*[!]*visible\((.*)\)\s*$/i)
|
36
41
|
end
|
37
42
|
|
43
|
+
|
44
|
+
def isTitle(my_driver, _execute_when)
|
45
|
+
|
46
|
+
rc=nil
|
47
|
+
|
48
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isTitle(#{_execute_when}"
|
49
|
+
|
50
|
+
_locator = _execute_when.match(/^\s*[!]*(isTitle|title)\((.*)\)\s*$/i)[2].to_s
|
51
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isTitle => #{_locator}"
|
52
|
+
|
53
|
+
current_title = my_driver.title
|
54
|
+
expected_title = Regexp.new(_locator)
|
55
|
+
rc=!expected_title.match(current_title).nil?
|
56
|
+
|
57
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isTitle?(#{_execute_when}) => #{rc}"
|
58
|
+
rc
|
59
|
+
end
|
60
|
+
|
38
61
|
def isValue?(my_driver, page_elt)
|
39
62
|
|
40
63
|
rc = false
|
@@ -59,12 +82,12 @@ module Scoutui::Base
|
|
59
82
|
puts __FILE__ + (__LINE__).to_s + " #{condition} : #{obj}"
|
60
83
|
|
61
84
|
if !obj.nil?
|
62
|
-
if condition.match(
|
85
|
+
if condition.match(/^\s*text/)
|
63
86
|
_txt = obj.text
|
64
87
|
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " text : #{_txt}"
|
65
88
|
expected_regex = Regexp.new(expectedVal)
|
66
89
|
rc = !_txt.to_s.match(expected_regex).nil?
|
67
|
-
elsif condition.match(
|
90
|
+
elsif condition.match(/^\*value/)
|
68
91
|
_txt = obj.attribute('value')
|
69
92
|
expected_regex = Regexp.new(expectedVal)
|
70
93
|
rc = !_txt.to_s.match(expected_regex).nil?
|
@@ -314,25 +314,68 @@ module Scoutui::Base
|
|
314
314
|
|
315
315
|
end
|
316
316
|
|
317
|
-
|
318
317
|
def self.processAssertions(my_driver, e)
|
318
|
+
processConditions(my_driver, e, 'assertions')
|
319
|
+
end
|
320
|
+
|
321
|
+
def self.processAsserts(my_driver, _execute_when)
|
322
|
+
|
323
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " processAsserts#{_execute_when}"
|
324
|
+
|
325
|
+
_executeIt=true
|
326
|
+
|
327
|
+
if !_execute_when.nil? && _execute_when.is_a?(Array)
|
328
|
+
|
329
|
+
_req = Scoutui::Utils::TestUtils.instance.getReq()
|
330
|
+
|
331
|
+
_execute_when.each do |_a|
|
332
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " exeucute_when => #{_a}"
|
333
|
+
|
334
|
+
_rc=nil
|
335
|
+
|
336
|
+
if Scoutui::Base::Assertions.instance.isEnabledCmd?(_a)
|
337
|
+
_rc=Scoutui::Base::Assertions.instance.isEnabled?(my_driver, _a)
|
338
|
+
elsif Scoutui::Base::Assertions.instance.isRoleCmd?(_a)
|
339
|
+
_rc=Scoutui::Base::Assertions.instance.isRole?(_a)
|
340
|
+
elsif Scoutui::Base::Assertions.instance.isVisibleCmd?(_a)
|
341
|
+
_rc=Scoutui::Base::Assertions.instance.isVisible?(my_driver, _a)
|
342
|
+
elsif Scoutui::Base::Assertions.instance.isSelectedCmd?(_a)
|
343
|
+
_rc=Scoutui::Base::Assertions.instance.isSelected?(my_driver, _a)
|
344
|
+
elsif Scoutui::Base::Assertions.instance.isValueCmd?(_a)
|
345
|
+
_rc=Scoutui::Base::Assertions.instance.isValue?(my_driver, _a)
|
346
|
+
elsif Scoutui::Base::Assertions.instance.isTitleCmd?(_a)
|
347
|
+
_rc=Scoutui::Base::Assertions.instance.isTitle(my_driver, _a)
|
348
|
+
end
|
349
|
+
|
350
|
+
if !_rc.nil?
|
351
|
+
Scoutui::Logger::LogMgr.instance.asserts.info __FILE__ + (__LINE__).to_s + "Verify #{_a} - #{_rc}"
|
352
|
+
Testmgr::TestReport.instance.getReq(_req).get_child('visible_when').add(_rc, "Verify #{_a}")
|
353
|
+
end
|
354
|
+
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
end
|
359
|
+
|
360
|
+
|
361
|
+
def self.processConditions(my_driver, e, _conditionType)
|
319
362
|
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " === ProcessAssertions(#{e.to_s} ====" if Scoutui::Utils::TestUtils.instance.isDebug?
|
320
363
|
|
321
|
-
if !e[STEP_KEY].has_key?(
|
364
|
+
if !e[STEP_KEY].has_key?(_conditionType)
|
322
365
|
return
|
323
366
|
end
|
324
367
|
|
325
|
-
if !e[STEP_KEY][
|
368
|
+
if !e[STEP_KEY][_conditionType].is_a?(Array)
|
326
369
|
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " \'assertions\' field must be type Array."
|
327
370
|
return
|
328
371
|
end
|
329
372
|
|
330
373
|
_req = Scoutui::Utils::TestUtils.instance.getReq()
|
331
374
|
|
332
|
-
puts __FILE__ + (__LINE__).to_s + "======= #{e[STEP_KEY][
|
375
|
+
puts __FILE__ + (__LINE__).to_s + "======= #{e[STEP_KEY][_conditionType]} ========="
|
333
376
|
|
334
377
|
|
335
|
-
e[STEP_KEY][
|
378
|
+
e[STEP_KEY][_conditionType].each do |elt|
|
336
379
|
|
337
380
|
begin
|
338
381
|
|
@@ -970,24 +1013,31 @@ module Scoutui::Base
|
|
970
1013
|
processExpected(my_driver, e)
|
971
1014
|
|
972
1015
|
processAssertions(my_driver, e)
|
1016
|
+
processAsserts(my_driver, e[STEP_KEY]["asserts"])
|
973
1017
|
|
974
1018
|
if e[STEP_KEY].has_key?('saveas')
|
975
1019
|
# processSaveAs(e)
|
976
1020
|
|
977
|
-
puts __FILE__ + (__LINE__).to_s + " == Process SaveAs =="
|
978
1021
|
_saveAs = e[STEP_KEY]['saveas']['file'].to_s
|
1022
|
+
|
1023
|
+
puts __FILE__ + (__LINE__).to_s + " == Process SaveAs #{_saveAs}=="
|
1024
|
+
|
979
1025
|
_f=File.open(_saveAs, 'w')
|
980
1026
|
|
981
|
-
if
|
982
|
-
|
983
|
-
|
1027
|
+
if _saveAs.match(/.*\.json\s*$/)
|
1028
|
+
# _f.puts e[STEP_KEY]['saveas']['data'].to_json
|
1029
|
+
_f.puts Scoutui::Utils::TestUtils.instance.expandVars(e[STEP_KEY]['saveas']['data'])
|
984
1030
|
|
985
|
-
|
986
|
-
_f.write(YAML.dump(JSON.parse(IO.read($json_file))))
|
987
|
-
y_file.close
|
1031
|
+
elsif _saveAs.match(/.*\.(yml|yaml)\s*$/)
|
988
1032
|
|
1033
|
+
# y_file = File.open("#{$yaml_file}", 'a')
|
1034
|
+
puts __FILE__ + (__LINE__).to_s + " Generate a YAML file"
|
1035
|
+
# _f.write(e[STEP_KEY]['saveas']['data'].to_yaml)
|
989
1036
|
|
990
|
-
_f.
|
1037
|
+
_f.write(Scoutui::Utils::TestUtils.instance.expandVars(e[STEP_KEY]['saveas']['data'].to_yaml))
|
1038
|
+
_f.close
|
1039
|
+
else
|
1040
|
+
__FILE__ + (__LINE__).to_s + " Unknown file extension."
|
991
1041
|
end
|
992
1042
|
|
993
1043
|
_f.close
|
data/lib/scoutui/utils/utils.rb
CHANGED
@@ -513,6 +513,55 @@ module Scoutui::Utils
|
|
513
513
|
@options[:title]
|
514
514
|
end
|
515
515
|
|
516
|
+
|
517
|
+
def transpile(_val)
|
518
|
+
_uservars = _val.scan(/\$\{(.*?)\}/)
|
519
|
+
|
520
|
+
_v2 = _val
|
521
|
+
for i in 0 .. (_uservars.size - 1)
|
522
|
+
|
523
|
+
_t = Scoutui::Base::UserVars.instance.get(_uservars[i][0])
|
524
|
+
puts __FILE__ + (__LINE__).to_s + " translate(#{_uservars[i][0]}) => #{_t}"
|
525
|
+
|
526
|
+
if !_t.nil? && _uservars[i][0]!=_t
|
527
|
+
_v2.gsub!("\$\{#{_uservars[i][0]}\}", _t)
|
528
|
+
end
|
529
|
+
|
530
|
+
puts __FILE__ + (__LINE__).to_s + " value => #{_v2}"
|
531
|
+
|
532
|
+
end
|
533
|
+
|
534
|
+
## Global replaces
|
535
|
+
_text_to_type = Scoutui::Base::UserVars.instance.get(_v2)
|
536
|
+
|
537
|
+
puts __FILE__ + (__LINE__).to_s + " rawText : #{_text_to_type}"
|
538
|
+
_text_to_type = Scoutui::Commands::Utils.instance.expandMacro(_text_to_type)
|
539
|
+
puts __FILE__ + (__LINE__).to_s + " Text to type : #{_text_to_type}"
|
540
|
+
|
541
|
+
_text_to_type
|
542
|
+
end
|
543
|
+
|
544
|
+
|
545
|
+
|
546
|
+
def expandVars(h)
|
547
|
+
|
548
|
+
puts __FILE__ + (__LINE__).to_s + " expandVars(#{h})"
|
549
|
+
|
550
|
+
h.each do |k, v|
|
551
|
+
if v.is_a?(Hash) || v.is_a?(Array)
|
552
|
+
expandVars(v)
|
553
|
+
else
|
554
|
+
puts("k is #{k}, value is #{v}")
|
555
|
+
|
556
|
+
h[k]=transpile(v)
|
557
|
+
end
|
558
|
+
end
|
559
|
+
|
560
|
+
h
|
561
|
+
end
|
562
|
+
|
563
|
+
|
564
|
+
|
516
565
|
end
|
517
566
|
|
518
567
|
|
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.29.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-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -191,6 +191,7 @@ files:
|
|
191
191
|
- examples/carmax/commands/commands.yml
|
192
192
|
- examples/carmax/tests/test-carmax.sh
|
193
193
|
- examples/ci_reporter/ci_example.rb
|
194
|
+
- examples/converters/jsonupdate.rb
|
194
195
|
- examples/converters/jsony.rb
|
195
196
|
- examples/ex1/commands.holidays.yml
|
196
197
|
- examples/ex1/commands.yml
|