scoutui 2.0.3.53.pre → 2.0.3.54.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/eyes/ex1.spec.rb +45 -0
- data/lib/scoutui/base/visual_test_framework.rb +17 -0
- data/lib/scoutui/commands/clauses/do_until.rb +128 -0
- data/lib/scoutui/commands/clauses/then_clause.rb +131 -40
- data/lib/scoutui/commands/click_object.rb +1 -1
- data/lib/scoutui/commands/commands.rb +99 -0
- data/lib/scoutui/commands/type.rb +31 -13
- data/lib/scoutui/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3584397e18dd66ba509646bd9072a9c74649d22a
|
4
|
+
data.tar.gz: 6d95f1c8be7a8b4cc380ffcd63d83206e2158daa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30f95d3f6f74e702d24bbb44109f18d0140c1908ac58c7bf79f3cbe3fe631065625c1c6f7a32e809bd7b69807791252bf4bedf86486015a14c0c97e4492799e6
|
7
|
+
data.tar.gz: 29cf6a760265ff1df710e1d1a2dcf5f43624bedb70728d77cd742bc09aac849ac32f1d9026f3f03d476a5dae8e94de3883de40a4c47ee12624f0585e385e51e7
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require_relative './Scout'
|
2
|
+
|
3
|
+
describe "Scout" do
|
4
|
+
|
5
|
+
before :all do
|
6
|
+
@scout=Scout.new(:firefox)
|
7
|
+
end
|
8
|
+
|
9
|
+
|
10
|
+
describe "should verify M4 is checked" do
|
11
|
+
|
12
|
+
before do
|
13
|
+
puts (__LINE__).to_s + " before: Open eyes"
|
14
|
+
# @scout.visit('BMW.M4', 'http://www.bmwusa.com/standard/content/byo/default.aspx?Series=M,4')
|
15
|
+
@scout.visit('BMW.M4', 'http://www.bmwusa.com/standard/content/byo/default.aspx?Series=4')
|
16
|
+
end
|
17
|
+
|
18
|
+
after :all do
|
19
|
+
@scout.close
|
20
|
+
@scout.report
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "should be filtered by M4" do
|
24
|
+
|
25
|
+
it "should have 4-series checkboxe enabled" do
|
26
|
+
m4=@scout.find("//*[@id='seriesBlock']//input[@value='4']")
|
27
|
+
expect(m4.selected?).to be(true)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
describe 'Verify UI' do
|
37
|
+
|
38
|
+
it "should pass all visual checks" do
|
39
|
+
expect(@scout.mismatches==0).to be(true)
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
end
|
@@ -427,6 +427,23 @@ module Scoutui::Base
|
|
427
427
|
_bm=Benchmark.measure {
|
428
428
|
_rc=Scoutui::Base::Assertions.instance.isTitle(my_driver, _a)
|
429
429
|
}
|
430
|
+
|
431
|
+
elsif _a.match(/^\s*(focused\.[Tt]ext\((.*)\))\s*$/)
|
432
|
+
|
433
|
+
_targetTxt = _a.match(/^\s*(focused.[Tt]ext\((.*)\))\s*$/)[2].to_s
|
434
|
+
|
435
|
+
_activeElt = my_driver.switch_to.active_element
|
436
|
+
|
437
|
+
if !_activeElt.nil?
|
438
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " target.text : |#{_targetTxt}|"
|
439
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " activeElt.text : |#{_activeElt.text.to_s}|"
|
440
|
+
|
441
|
+
_rc=!(_activeElt.text.to_s.match(/#{_targetTxt}/).nil?)
|
442
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " FocusedText : #{_activeElt.text} => #{_rc}"
|
443
|
+
end
|
444
|
+
|
445
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ASSERT: focusTxt: #{_targetTxt} vs #{_activeElt.text} => #{_rc}"
|
446
|
+
|
430
447
|
elsif _a.match(/^\s*(req|requirement)\s*\((.*)\)\s*$/i)
|
431
448
|
|
432
449
|
_reqID=_a.match(/^\s*(req|requirement)\s*\((.*)\)\s*$/i)[2].to_s
|
@@ -0,0 +1,128 @@
|
|
1
|
+
|
2
|
+
module Scoutui::Commands
|
3
|
+
|
4
|
+
class DoUntil
|
5
|
+
|
6
|
+
attr_accessor :drv
|
7
|
+
|
8
|
+
def initialize(driver)
|
9
|
+
@drv=driver
|
10
|
+
@pageElt=nil
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
def execute(pageElt)
|
15
|
+
|
16
|
+
rc=true
|
17
|
+
cmdList=nil
|
18
|
+
|
19
|
+
if !pageElt.nil? && pageElt.is_a?(Hash) && pageElt.has_key?('page') && pageElt['page'].has_key?('do')
|
20
|
+
@pageElt=pageElt
|
21
|
+
cmdList=pageElt['page']['do']
|
22
|
+
elsif pageElt.is_a?(Array)
|
23
|
+
cmdList=pageElt
|
24
|
+
end
|
25
|
+
|
26
|
+
rc=Scoutui::Commands.simpleCommands(@drv, cmdList) if cmdList
|
27
|
+
|
28
|
+
rc
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
def do_until(pageElt)
|
34
|
+
|
35
|
+
if !pageElt.nil? && pageElt['page'].has_key?('do') && pageElt['page'].has_key?('until')
|
36
|
+
|
37
|
+
thenList=pageElt['page']['do']
|
38
|
+
_loop=true
|
39
|
+
_i=0
|
40
|
+
_historyElts={}
|
41
|
+
_bUntil=false
|
42
|
+
|
43
|
+
while _loop && !_bUntil do
|
44
|
+
|
45
|
+
if thenList.is_a?(Array)
|
46
|
+
# thenClause = Scoutui::Commands::DoUntil.new(@drv)
|
47
|
+
# thenClause.execute(pageElt)
|
48
|
+
execute(pageElt)
|
49
|
+
|
50
|
+
# Get the active (focused) element
|
51
|
+
_activeElt = @drv.switch_to.active_element
|
52
|
+
|
53
|
+
if _activeElt.is_a?(Selenium::WebDriver::Element)
|
54
|
+
puts __FILE__ + (__LINE__).to_s + " ActiveElt => #{_activeElt.tag_name} : #{_activeElt.text}"
|
55
|
+
|
56
|
+
# Check if Tabbed element is displayed.
|
57
|
+
|
58
|
+
if !_activeElt.displayed?
|
59
|
+
puts __FILE__ + (__LINE__).to_s + " ** Tabbled-on element is NOT displayed"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
if _historyElts.size > 0 && _historyElts.has_key?(_activeElt)
|
65
|
+
puts __FILE__ + (__LINE__).to_s + "****** WRAPPED ******"
|
66
|
+
|
67
|
+
_loop=false
|
68
|
+
else
|
69
|
+
_historyElts[_activeElt]=true
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
if _loop && !pageElt.nil? && pageElt['page'].has_key?('until')
|
75
|
+
_expected=Scoutui::Base::VisualTestFramework::processAsserts(@drv, pageElt['page']['until'], false)
|
76
|
+
puts __FILE__ + (__LINE__).to_s + " ==> until : #{_expected}"
|
77
|
+
|
78
|
+
_loop=!_expected
|
79
|
+
|
80
|
+
if _expected
|
81
|
+
_bUntil=true
|
82
|
+
end
|
83
|
+
|
84
|
+
elsif !pageElt['page'].has_key?('until')
|
85
|
+
_loop=false
|
86
|
+
_bUntil=true
|
87
|
+
end
|
88
|
+
|
89
|
+
_i+=1
|
90
|
+
|
91
|
+
if !_bUntil && _i > 75
|
92
|
+
_loop=false
|
93
|
+
puts __FILE__ + (__LINE__).to_s + " ** BREAK OUT **"; STDIN.gets
|
94
|
+
end
|
95
|
+
|
96
|
+
end # while()
|
97
|
+
|
98
|
+
_rc=_bUntil
|
99
|
+
|
100
|
+
|
101
|
+
if _bUntil && pageElt['page'].has_key?('whenPassed') && pageElt['page']['whenPassed'].is_a?(Array)
|
102
|
+
|
103
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ==== whenPassed #{_rc} ======="
|
104
|
+
_whenPassed = execute(pageElt['page']['whenPassed'])
|
105
|
+
|
106
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ===== end.whenPassed : #{_whenPassed} ====="
|
107
|
+
|
108
|
+
|
109
|
+
elsif !_bUntil && pageElt['page'].has_key?('whenFailed') && pageElt['page']['whenFailed'].is_a?(Array)
|
110
|
+
|
111
|
+
_whenFailed = execute(pageElt['page']['whenFailed'])
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
|
116
|
+
elsif !pageElt.nil? && pageElt['page'].has_key?('do')
|
117
|
+
_rc=execute(pageElt)
|
118
|
+
else
|
119
|
+
_rc=true
|
120
|
+
end
|
121
|
+
|
122
|
+
_rc
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
end
|
127
|
+
|
128
|
+
end
|
@@ -10,70 +10,161 @@ module Scoutui::Commands
|
|
10
10
|
@pageElt=nil
|
11
11
|
end
|
12
12
|
|
13
|
+
def self._execute(drv, thenList)
|
14
|
+
|
15
|
+
thenList.each do |_subcmd|
|
16
|
+
|
17
|
+
if _subcmd.is_a?(String)
|
18
|
+
|
19
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " | then => #{_subcmd}"
|
20
|
+
|
21
|
+
if _subcmd.match(/^\s*press\(__TAB__\)$/)
|
22
|
+
drv.action.send_keys(:tab).perform
|
23
|
+
|
24
|
+
elsif _subcmd.match(/^\s*press\((__ESC__|__ESCAPE__)\)$/)
|
25
|
+
drv.action.send_keys(:escape).perform
|
26
|
+
|
27
|
+
elsif _subcmd.match(/^\s*press\(__HOLD_SHIFT__\)\s*$/)
|
28
|
+
drv.action.key_down(:shift).perform
|
29
|
+
Scoutui::Base::TestContext.instance.set(:shift_down, true)
|
30
|
+
|
31
|
+
elsif _subcmd.match(/^\s*press\(__RELEASE_SHIFT__\)\s*$/)
|
32
|
+
drv.action.key_up(:shift).perform
|
33
|
+
Scoutui::Base::TestContext.instance.set(:shift_down, false)
|
34
|
+
|
35
|
+
elsif _subcmd.match(/^\s*press\(__HOLD_COMMAND__\)$/)
|
36
|
+
drv.action.key_down(:command).perform
|
37
|
+
Scoutui::Base::TestContext.instance.set(:command_down, true)
|
38
|
+
|
39
|
+
elsif _subcmd.match(/^\s*press\(__RELEASE_COMMAND__\)$/)
|
40
|
+
drv.action.key_up(:command).perform
|
41
|
+
Scoutui::Base::TestContext.instance.set(:command_down, false)
|
42
|
+
|
43
|
+
elsif _subcmd.match(/^\s*press\(__CONTROL__\)$/)
|
44
|
+
|
45
|
+
drv.driver.action.key_down(:control).perform
|
46
|
+
drv.action.key_up(:control).perform
|
47
|
+
|
48
|
+
# Check for list of elements to click
|
49
|
+
|
50
|
+
elsif _subcmd.match(/^\s*press\(__DOWN__\)$/)
|
51
|
+
drv.action.send_keys(:arrow_down).perform
|
52
|
+
|
53
|
+
elsif _subcmd.match(/^\s*press\(__UP__\)$/)
|
54
|
+
drv.action.send_keys(:arrow_up).perform
|
55
|
+
|
56
|
+
elsif _subcmd.match(/^\s*press\(__ENTER__\)\s*$/)
|
57
|
+
drv.action.send_keys(:enter).perform
|
58
|
+
|
59
|
+
elsif _subcmd.match(/^\s*focused\.[Hh]ighlight\s*$/i)
|
60
|
+
|
61
|
+
_activeElt = drv.switch_to.active_element
|
62
|
+
if !_activeElt.nil?
|
63
|
+
Scoutui::Base::QBrowser.highlight(drv, _activeElt)
|
64
|
+
end
|
65
|
+
|
66
|
+
elsif _subcmd.match(/^\s*click\((.*)\)\s*$/)
|
67
|
+
# Click on the locator
|
68
|
+
|
69
|
+
_c = Scoutui::Commands::ClickObject.new(_subcmd)
|
70
|
+
_c.run(driver: drv)
|
71
|
+
|
72
|
+
elsif _subcmd.match(/^\s*press\((.*)\)\s*$/)
|
73
|
+
_locator = _subcmd.match(/^\s*press\((.*)\)\s*$/)[1].to_s
|
74
|
+
_locator = Scoutui::Base::UserVars.instance.normalize(_locator)
|
75
|
+
obj = Scoutui::Base::QBrowser.getElement(drv, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
|
76
|
+
obj.click
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
|
13
84
|
|
14
85
|
def execute(pageElt)
|
15
|
-
return if pageElt.nil?
|
16
86
|
|
17
|
-
|
87
|
+
rc=true
|
88
|
+
thenList=nil
|
18
89
|
|
19
|
-
if !pageElt.nil? && pageElt.has_key?('page') && pageElt['page'].has_key?('then')
|
20
|
-
pageElt
|
90
|
+
if !pageElt.nil? && pageElt.is_a?(Hash) && pageElt.has_key?('page') && pageElt['page'].has_key?('then')
|
91
|
+
@pageElt=pageElt
|
92
|
+
thenList=pageElt['page']['then']
|
93
|
+
elsif pageElt.is_a?(Array)
|
94
|
+
thenList=pageElt
|
95
|
+
end
|
21
96
|
|
22
|
-
|
97
|
+
rc=Scoutui::Commands::ThenClause._execute(@drv, pageElt['page']['then']) if thenList
|
23
98
|
|
24
|
-
|
99
|
+
rc
|
100
|
+
end
|
25
101
|
|
26
|
-
if _subcmd.match(/^\s*press\(__TAB__\)$/)
|
27
|
-
@drv.action.send_keys(:tab).perform
|
28
102
|
|
29
|
-
elsif _subcmd.match(/^\s*press\(__HOLD_SHIFT__\)\s*$/)
|
30
|
-
@drv.action.key_down(:shift).perform
|
31
|
-
Scoutui::Base::TestContext.instance.set(:shift_down, true)
|
32
103
|
|
33
|
-
|
34
|
-
@drv.action.key_up(:shift).perform
|
35
|
-
Scoutui::Base::TestContext.instance.set(:shift_down, false)
|
104
|
+
def execute_until(pageElt)
|
36
105
|
|
37
|
-
|
38
|
-
@drv.action.key_down(:command).perform
|
39
|
-
Scoutui::Base::TestContext.instance.set(:command_down, true)
|
106
|
+
if !pageElt.nil? && pageElt['page'].has_key?('then') && pageElt['page'].has_key?('until')
|
40
107
|
|
41
|
-
|
42
|
-
|
43
|
-
|
108
|
+
thenList=pageElt['page']['then']
|
109
|
+
_loop=true
|
110
|
+
_i=0
|
111
|
+
_historyElts={}
|
112
|
+
_bUntil=false
|
44
113
|
|
45
|
-
|
114
|
+
while _loop && !_bUntil do
|
46
115
|
|
47
|
-
|
48
|
-
|
116
|
+
if thenList.is_a?(Array)
|
117
|
+
thenClause = Scoutui::Commands::ThenClause.new(@drv)
|
118
|
+
thenClause.execute(pageElt)
|
49
119
|
|
50
|
-
|
120
|
+
_activeElt = @drv.switch_to.active_element
|
51
121
|
|
52
|
-
|
53
|
-
@drv.action.send_keys(:arrow_down).perform
|
122
|
+
puts __FILE__ + (__LINE__).to_s + " ActiveElt => #{_activeElt.text}"
|
54
123
|
|
55
|
-
|
56
|
-
|
124
|
+
if _historyElts.size > 0 && _historyElts.has_key?(_activeElt)
|
125
|
+
puts __FILE__ + (__LINE__).to_s + "****** WRAPPED ******"; STDIN.gets
|
57
126
|
|
58
|
-
|
59
|
-
|
127
|
+
_loop=false
|
128
|
+
else
|
129
|
+
_historyElts[_activeElt]=true
|
130
|
+
end
|
60
131
|
|
61
|
-
|
62
|
-
# Click on the locator
|
132
|
+
end
|
63
133
|
|
64
|
-
|
65
|
-
|
134
|
+
if _loop && !pageElt.nil? && pageElt['page'].has_key?('until')
|
135
|
+
_expected=Scoutui::Base::VisualTestFramework::processAsserts(@drv, pageElt['page']['until'], false)
|
136
|
+
puts __FILE__ + (__LINE__).to_s + " ==> until : #{_expected}"
|
66
137
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
obj.click
|
138
|
+
_loop=!_expected
|
139
|
+
|
140
|
+
if _expected
|
141
|
+
_bUntil=true
|
72
142
|
end
|
73
143
|
|
144
|
+
elsif !pageElt['page'].has_key?('until')
|
145
|
+
_loop=false
|
146
|
+
_bUntil=true
|
74
147
|
end
|
75
|
-
|
148
|
+
|
149
|
+
_i+=1
|
150
|
+
|
151
|
+
if !_bUntil && _i > 75
|
152
|
+
_loop=false
|
153
|
+
puts __FILE__ + (__LINE__).to_s + " ** BREAK OUT **"; STDIN.gets
|
154
|
+
end
|
155
|
+
|
156
|
+
end # while()
|
157
|
+
|
158
|
+
_rc=_bUntil
|
159
|
+
|
160
|
+
|
161
|
+
elsif !pageElt.nil? && pageElt['page'].has_key?('then')
|
162
|
+
_rc=execute(pageElt)
|
163
|
+
else
|
164
|
+
_rc=true
|
76
165
|
end
|
166
|
+
|
167
|
+
_rc
|
77
168
|
end
|
78
169
|
|
79
170
|
|
@@ -176,7 +176,7 @@ module Scoutui::Commands
|
|
176
176
|
|
177
177
|
|
178
178
|
if !_clicked
|
179
|
-
|
179
|
+
Scoutui::Logger::LogMgr.instance.asserts.info __FILE__ + (__LINE__).to_s + " FAILED CLICK"
|
180
180
|
end
|
181
181
|
|
182
182
|
setResult(_clicked)
|
@@ -5,6 +5,105 @@ module Scoutui::Commands
|
|
5
5
|
STEP_KEY='page'
|
6
6
|
|
7
7
|
|
8
|
+
SIMPLE_CMDS={
|
9
|
+
'__DOWN__' => { :val => :arrow_down },
|
10
|
+
'__ENTER__' => { :val => :enter },
|
11
|
+
'__ESC__' => { :val => :escape },
|
12
|
+
'__ESCAPE__' => { :val => :escape },
|
13
|
+
'__UP__' => { :val => :arrow_up },
|
14
|
+
'__LEFT__' => { :val => :arrow_left },
|
15
|
+
'__RIGHT__' => { :val => :arrow_right },
|
16
|
+
'__TAB__' => { :val => :tab }
|
17
|
+
}
|
18
|
+
|
19
|
+
|
20
|
+
def self.simpleCommands(drv, thenList)
|
21
|
+
|
22
|
+
rc=true
|
23
|
+
|
24
|
+
begin
|
25
|
+
|
26
|
+
thenList.each do |_subcmd|
|
27
|
+
|
28
|
+
|
29
|
+
if _subcmd.is_a?(String)
|
30
|
+
|
31
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " | then => #{_subcmd}"
|
32
|
+
|
33
|
+
if _subcmd.match(/^\s*press\(__TAB__\)$/)
|
34
|
+
drv.action.send_keys(:tab).perform
|
35
|
+
|
36
|
+
elsif _subcmd.match(/^\s*press\((__ESC__|__ESCAPE__)\)$/)
|
37
|
+
drv.action.send_keys(:escape).perform
|
38
|
+
|
39
|
+
elsif _subcmd.match(/^\s*press\(__HOLD_SHIFT__\)\s*$/)
|
40
|
+
drv.action.key_down(:shift).perform
|
41
|
+
Scoutui::Base::TestContext.instance.set(:shift_down, true)
|
42
|
+
|
43
|
+
elsif _subcmd.match(/^\s*press\(__RELEASE_SHIFT__\)\s*$/)
|
44
|
+
drv.action.key_up(:shift).perform
|
45
|
+
Scoutui::Base::TestContext.instance.set(:shift_down, false)
|
46
|
+
|
47
|
+
elsif _subcmd.match(/^\s*press\(__HOLD_COMMAND__\)$/)
|
48
|
+
drv.action.key_down(:command).perform
|
49
|
+
Scoutui::Base::TestContext.instance.set(:command_down, true)
|
50
|
+
|
51
|
+
elsif _subcmd.match(/^\s*press\(__RELEASE_COMMAND__\)$/)
|
52
|
+
drv.action.key_up(:command).perform
|
53
|
+
Scoutui::Base::TestContext.instance.set(:command_down, false)
|
54
|
+
|
55
|
+
elsif _subcmd.match(/^\s*press\(__CONTROL__\)$/)
|
56
|
+
|
57
|
+
drv.driver.action.key_down(:control).perform
|
58
|
+
drv.action.key_up(:control).perform
|
59
|
+
|
60
|
+
# Check for list of elements to click
|
61
|
+
|
62
|
+
elsif _subcmd.match(/^\s*press\(__DOWN__\)$/)
|
63
|
+
drv.action.send_keys(:arrow_down).perform
|
64
|
+
|
65
|
+
elsif _subcmd.match(/^\s*press\(__UP__\)$/)
|
66
|
+
drv.action.send_keys(:arrow_up).perform
|
67
|
+
|
68
|
+
elsif _subcmd.match(/^\s*press\(__ENTER__\)\s*$/)
|
69
|
+
drv.action.send_keys(:enter).perform
|
70
|
+
|
71
|
+
elsif _subcmd.match(/^\s*focused\.[Hh]ighlight\s*$/i)
|
72
|
+
|
73
|
+
_activeElt = drv.switch_to.active_element
|
74
|
+
if !_activeElt.nil?
|
75
|
+
Scoutui::Base::QBrowser.highlight(drv, _activeElt)
|
76
|
+
end
|
77
|
+
|
78
|
+
elsif _subcmd.match(/^\s*click\((.*)\)\s*$/)
|
79
|
+
# Click on the locator
|
80
|
+
|
81
|
+
_c = Scoutui::Commands::ClickObject.new(_subcmd)
|
82
|
+
_c.run(driver: drv)
|
83
|
+
|
84
|
+
elsif _subcmd.match(/^\s*press\((.*)\)\s*$/)
|
85
|
+
_locator = _subcmd.match(/^\s*press\((.*)\)\s*$/)[1].to_s
|
86
|
+
_locator = Scoutui::Base::UserVars.instance.normalize(_locator)
|
87
|
+
obj = Scoutui::Base::QBrowser.getElement(drv, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
|
88
|
+
obj.click
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
rescue => ex
|
95
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Error during processing: #{$!}"
|
96
|
+
Scoutui::Logger::LogMgr.instance.debug "Backtrace:\n\t#{e.backtrace.join("\n\t")}"
|
97
|
+
rc=false
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
rc
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
|
106
|
+
|
8
107
|
def self.processCommands(commandList, my_driver)
|
9
108
|
Scoutui::Logger::LogMgr.instance.debug " enter [processCommands]"
|
10
109
|
commandList.each do |cmd|
|
@@ -4,6 +4,16 @@ module Scoutui::Commands
|
|
4
4
|
|
5
5
|
class Type < Command
|
6
6
|
|
7
|
+
KEYBOARD_CMDS={
|
8
|
+
'__DOWN__' => { :val => :arrow_down },
|
9
|
+
'__ENTER__' => { :val => :enter },
|
10
|
+
'__ESC__' => { :val => :escape },
|
11
|
+
'__ESCAPE__' => { :val => :escape },
|
12
|
+
'__UP__' => { :val => :arrow_up },
|
13
|
+
'__LEFT__' => { :val => :arrow_left },
|
14
|
+
'__RIGHT__' => { :val => :arrow_right },
|
15
|
+
'__TAB__' => { :val => :tab }
|
16
|
+
}
|
7
17
|
|
8
18
|
KEYBOARD_LIST={
|
9
19
|
'__DOWN__' => lambda { |obj| obj.send_keys(:arrow_down) },
|
@@ -65,20 +75,28 @@ module Scoutui::Commands
|
|
65
75
|
|
66
76
|
begin
|
67
77
|
|
68
|
-
if @cmd.
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
78
|
+
if @cmd.match(/^type\((#{KEYBOARD_CMDS.keys.join('|')})\)$/)
|
79
|
+
|
80
|
+
_tm[:start]=Time.now
|
81
|
+
|
82
|
+
_keyVal=@cmd.match(/^type\((#{KEYBOARD_CMDS.keys.join('|')})\)$/)[1]
|
83
|
+
|
84
|
+
@drv.action.send_keys(KEYBOARD_CMDS[_keyVal][:val]).perform
|
85
|
+
|
86
|
+
thenClause = Scoutui::Commands::ThenClause.new(@drv)
|
87
|
+
doUntil = Scoutui::Commands::DoUntil.new(@drv)
|
88
|
+
|
89
|
+
_tm[:start]=Time.now
|
90
|
+
|
91
|
+
# _bUntil = thenClause.execute_until(pageElt)
|
92
|
+
_bUntil = doUntil.do_until(pageElt)
|
93
|
+
_tm[:end]=Time.now
|
94
|
+
|
95
|
+
Testmgr::TestReport.instance.getReq(_req).testcase('until').add(_bUntil, Scoutui::Base::UserVars.instance.normalize("Verify then-until met #{_bUntil}"), (_tm[:end] - _tm[:end]))
|
96
|
+
|
97
|
+
_rc=_bUntil
|
81
98
|
_isKb=true
|
99
|
+
|
82
100
|
else
|
83
101
|
|
84
102
|
if @cmd.match(/^\s*type[\!]*\((.*),\s*'(.*)\s*'\)\s*$/)
|
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.54.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-11-
|
11
|
+
date: 2016-11-15 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/ex6/appmodel/model.json
|
276
276
|
- examples/ex6/tests/test.sh
|
277
277
|
- examples/eyes/diff.rb
|
278
|
+
- examples/eyes/ex1.spec.rb
|
278
279
|
- examples/eyes/ex2.rb
|
279
280
|
- examples/eyes_results/response.json
|
280
281
|
- examples/screenshot/fullshot.rb
|
@@ -297,6 +298,7 @@ files:
|
|
297
298
|
- lib/scoutui/base/user_vars.rb
|
298
299
|
- lib/scoutui/base/visual_test_framework.rb
|
299
300
|
- lib/scoutui/commands/assign_var.rb
|
301
|
+
- lib/scoutui/commands/clauses/do_until.rb
|
300
302
|
- lib/scoutui/commands/clauses/then_clause.rb
|
301
303
|
- lib/scoutui/commands/click_object.rb
|
302
304
|
- lib/scoutui/commands/command.rb
|