scoutui 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +154 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/scoutui_driver.rb +22 -0
- data/bin/setup +7 -0
- data/examples/ex1/commands.holidays.yml +45 -0
- data/examples/ex1/commands.yml +25 -0
- data/examples/ex1/test-example.sh +38 -0
- data/examples/ex1/test.config.json +16 -0
- data/examples/ex2/commands.yml +35 -0
- data/examples/ex2/page_model.json +28 -0
- data/examples/ex2/test-example.sh +39 -0
- data/examples/ex2/test.config.json +25 -0
- data/lib/scoutui.rb +8 -0
- data/lib/scoutui/appmodel/q_model.rb +82 -0
- data/lib/scoutui/base/assertions.rb +62 -0
- data/lib/scoutui/base/q_accounts.rb +52 -0
- data/lib/scoutui/base/q_applitools.rb +127 -0
- data/lib/scoutui/base/q_browser.rb +185 -0
- data/lib/scoutui/base/q_form.rb +261 -0
- data/lib/scoutui/base/test_scout.rb +120 -0
- data/lib/scoutui/base/test_settings.rb +109 -0
- data/lib/scoutui/base/user_vars.rb +108 -0
- data/lib/scoutui/base/visual_test_framework.rb +574 -0
- data/lib/scoutui/commands/click_object.rb +45 -0
- data/lib/scoutui/commands/command.rb +56 -0
- data/lib/scoutui/commands/commands.rb +133 -0
- data/lib/scoutui/commands/exists_alert.rb +54 -0
- data/lib/scoutui/commands/fill_form.rb +56 -0
- data/lib/scoutui/commands/jsalert/action_jsalert.rb +58 -0
- data/lib/scoutui/commands/mouse_over.rb +31 -0
- data/lib/scoutui/commands/pause.rb +26 -0
- data/lib/scoutui/commands/select_object.rb +54 -0
- data/lib/scoutui/commands/strategy.rb +202 -0
- data/lib/scoutui/commands/submit_form.rb +44 -0
- data/lib/scoutui/commands/type.rb +44 -0
- data/lib/scoutui/commands/update_url.rb +45 -0
- data/lib/scoutui/commands/utils.rb +128 -0
- data/lib/scoutui/commands/verify_element.rb +198 -0
- data/lib/scoutui/commands/verify_form.rb +26 -0
- data/lib/scoutui/eyes/eye_factory.rb +76 -0
- data/lib/scoutui/eyes/eye_scout.rb +239 -0
- data/lib/scoutui/logger/log_mgr.rb +105 -0
- data/lib/scoutui/navigator.rb +24 -0
- data/lib/scoutui/utils/utils.rb +352 -0
- data/lib/scoutui/version.rb +3 -0
- data/scoutui.gemspec +35 -0
- metadata +54 -2
- data/pkg/scoutui-2.0.0.gem +0 -0
@@ -0,0 +1,261 @@
|
|
1
|
+
|
2
|
+
require 'selenium-webdriver'
|
3
|
+
|
4
|
+
|
5
|
+
module Scoutui::Base
|
6
|
+
|
7
|
+
|
8
|
+
class QForm
|
9
|
+
|
10
|
+
attr_accessor :elements
|
11
|
+
attr_accessor :drv
|
12
|
+
|
13
|
+
def initialize(*p)
|
14
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " size : #{p.size}"
|
15
|
+
@drv=nil
|
16
|
+
|
17
|
+
if p.size==1 && p[0].is_a?(Hash)
|
18
|
+
|
19
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " Hash was passed"
|
20
|
+
@elements = p[0]
|
21
|
+
elsif p.size==1 && p[0].is_a?(String)
|
22
|
+
# Load form from a JSON file
|
23
|
+
elsif p.size==2
|
24
|
+
@drv=p[0]
|
25
|
+
|
26
|
+
@elements = p[1] if p[1].is_a?(Hash)
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
def dump()
|
33
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " QForm.dump()"
|
34
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " => #{@elements.to_s}"
|
35
|
+
end
|
36
|
+
|
37
|
+
def actionElement(drv, locator)
|
38
|
+
|
39
|
+
_action=nil
|
40
|
+
|
41
|
+
obj = Scoutui::Base::QBrowser.getObject(drv, locator)
|
42
|
+
_type = obj.attribute('type').to_s
|
43
|
+
_tag = obj.tag_name.to_s
|
44
|
+
|
45
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " obj => type:#{_type} tag:#{_tag}"
|
46
|
+
|
47
|
+
# element.getAttribute("type").equalsIgnoreCase("text")
|
48
|
+
if !_type.match(/(password|text|email)/i).nil? && !_tag.match(/(input|textarea)/i).nil?
|
49
|
+
|
50
|
+
_v = Scoutui::Base::UserVars.instance.get(dut[k].to_s)
|
51
|
+
|
52
|
+
_action="send_keys"
|
53
|
+
obj.send_keys(_v)
|
54
|
+
elsif !_type.match(/(date|number|search|tel|time|url|week)/i).nil?
|
55
|
+
_v = Scoutui::Base::UserVars.instance.get(dut[k].to_s)
|
56
|
+
_action="send_keys"
|
57
|
+
obj.send_keys(_v)
|
58
|
+
elsif !_type.match(/(button|checkbox|radio|submit)/i).nil?
|
59
|
+
_action="click"
|
60
|
+
obj.click()
|
61
|
+
else
|
62
|
+
_action="click"
|
63
|
+
obj.click()
|
64
|
+
end
|
65
|
+
|
66
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " action : #{_action}"
|
67
|
+
_action
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
def submitForm(drv=nil)
|
72
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " -- submit(#{drv.class.to_s} --"
|
73
|
+
|
74
|
+
rc=false
|
75
|
+
|
76
|
+
if drv.nil?
|
77
|
+
drv=@drv
|
78
|
+
end
|
79
|
+
|
80
|
+
action_obj = @elements.select { |key, e| e.is_a?(Hash) && e.has_key?('action_object') && e['action_object']==true }
|
81
|
+
|
82
|
+
if !action_obj.nil?
|
83
|
+
# Find the submit action element
|
84
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " -- submit => #{action_obj}"
|
85
|
+
actionElement(drv, action_obj[action_obj.keys[0]])
|
86
|
+
rc=true
|
87
|
+
else
|
88
|
+
Scoutui::Logger::LogMgr.instance.commands.warn __FILE__ + (__LINE__).to_s + " WARN: missing action object."
|
89
|
+
end
|
90
|
+
|
91
|
+
rc
|
92
|
+
end
|
93
|
+
|
94
|
+
|
95
|
+
def verifyForm(drv)
|
96
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " verifyForm()"
|
97
|
+
|
98
|
+
_req = Scoutui::Utils::TestUtils.instance.getReq()
|
99
|
+
|
100
|
+
puts __FILE__ + (__LINE__).to_s + " req => #{_req}"
|
101
|
+
|
102
|
+
@elements.each do |elt|
|
103
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " => #{elt.to_s} : #{elt.class.to_s}"
|
104
|
+
|
105
|
+
if elt.is_a?(Array)
|
106
|
+
|
107
|
+
n=elt[0]
|
108
|
+
v=elt[1]
|
109
|
+
|
110
|
+
k='visible_when'
|
111
|
+
if v.is_a?(Hash) && v.has_key?(k) && v.has_key?('locator')
|
112
|
+
|
113
|
+
|
114
|
+
obj = Scoutui::Base::QBrowser.getObject(drv, v['locator'])
|
115
|
+
|
116
|
+
if !v[k].match(/always/i).nil?
|
117
|
+
_rc = !obj.nil? && obj.is_a?(Selenium::WebDriver::Element) && obj.displayed?
|
118
|
+
Scoutui::Logger::LogMgr.instance.asserts.info " Verify element #{n} with locator #{v['locator']} is always visible on form - #{_rc.to_s}"
|
119
|
+
Testmgr::TestReport.instance.getReq(_req).tc(k).add(_rc, __FILE__ + (__LINE__).to_s + " Verify element #{n} with locator #{v['locator']} is always visible on form")
|
120
|
+
elsif !v[k].match(/([!])*title\((.*)\)/i).nil?
|
121
|
+
_hit = v[k].match(/([!])*title\(\/(.*)\/\)/i)
|
122
|
+
_not = _hit[1]
|
123
|
+
_title = _hit[2]
|
124
|
+
|
125
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " Verify title |#{drv.title}| matches #{_title}"
|
126
|
+
|
127
|
+
_rc = !drv.title.match(Regexp.new(_title)).nil?
|
128
|
+
|
129
|
+
if !_not.nil?
|
130
|
+
_rc=!_rc
|
131
|
+
end
|
132
|
+
|
133
|
+
Scoutui::Logger::LogMgr.instance.asserts.info " Verify expected title matches #{_not.to_s}#{_title} for form. - #{_rc.to_s}"
|
134
|
+
Testmgr::TestReport.instance.getReq(_req).tc(k).add(_rc, __FILE__ + (__LINE__).to_s + " Verify expected title matches #{_not.to_s}#{_title} for form.")
|
135
|
+
|
136
|
+
|
137
|
+
elsif !v[k].match(/\s*(visible)\((.*)\)\=(.*)/).nil?
|
138
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " ==> #{v[k].to_s}"
|
139
|
+
_match=v[k].match(/\s*(visible)\((.*)\)\=(.*)/)
|
140
|
+
_cond=_match[1]
|
141
|
+
_obj=_match[2]
|
142
|
+
_expected_val=_match[3]
|
143
|
+
|
144
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " <cond, obj, when>::<#{_cond}, #{_obj}, #{_expected_val}"
|
145
|
+
|
146
|
+
depObj = Scoutui::Base::QBrowser.getObject(drv, _obj)
|
147
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " hit => #{depObj.class.to_s} tag:#{depObj.tag_name}" if !depObj.nil?
|
148
|
+
|
149
|
+
desc=nil
|
150
|
+
if _expected_val.match(/true/i)
|
151
|
+
obj = Scoutui::Base::QBrowser.getObject(drv, v['locator'])
|
152
|
+
|
153
|
+
_rc = !depObj.nil? && depObj.displayed? && !obj.nil? && obj.displayed?
|
154
|
+
Scoutui::Logger::LogMgr.instance.asserts.info "Verify #{v['locator']} is displayed since #{_obj} is displayed - #{_rc.to_s}"
|
155
|
+
Testmgr::TestReport.instance.getReq(_req).tc(k).add(_rc, "Verify #{v['locator']} is displayed since #{_obj} is displayed")
|
156
|
+
elsif _expected_val.match(/false/i)
|
157
|
+
obj = Scoutui::Base::QBrowser.getObject(drv, v['locator'])
|
158
|
+
|
159
|
+
_rc = depObj.nil? && !obj.nil? && obj.displayed?
|
160
|
+
Scoutui::Logger::LogMgr.instance.asserts.info "Verify #{v['locator']} is displayed since #{_obj} is not visible. - #{_rc.to_s}"
|
161
|
+
Testmgr::TestReport.instance.getReq(_req).tc(k).add(_rc, "Verify #{v['locator']} is displayed since #{_obj} is not visible.")
|
162
|
+
end
|
163
|
+
|
164
|
+
elsif !v[k].match(/value\((.*)\)\=(.*)/).nil?
|
165
|
+
_match=v[k].match(/value\((.*)\)\=(.*)/)
|
166
|
+
_obj=_match[1]
|
167
|
+
_expected_val=_match[2]
|
168
|
+
|
169
|
+
obj = Scoutui::Base::QBrowser.getObject(drv, _obj)
|
170
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " hit => #{obj.class.to_s} tag:#{obj.tag_name}"
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
if !obj.nil? && obj.is_a?(Selenium::WebDriver::Element) && obj.tag_name=='select'
|
175
|
+
|
176
|
+
_options=Selenium::WebDriver::Support::Select.new(obj)
|
177
|
+
_val = _options.first_selected_option.text
|
178
|
+
|
179
|
+
Testmgr::TestReport.instance.getReq(_req).tc(k).add(!_val.match(/#{_expected_val}/).nil?, __FILE__ + (__LINE__).to_s + " Verify obj #{n} displayed when #{v.to_s}")
|
180
|
+
|
181
|
+
if false
|
182
|
+
|
183
|
+
_options=obj.find_elements(:tag_name=>"option")
|
184
|
+
|
185
|
+
_options.each do |_o|
|
186
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " | value : #{_o.attribute('value').to_s}"
|
187
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " | text : #{_o.text.to_s}"
|
188
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " | displayed : #{_o.displayed?}"
|
189
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " | enabled : #{_o.enabled?}"
|
190
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " | location : #{_o.location}"
|
191
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " | selected :#{_o.selected?}"
|
192
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " | methods:#{_o.methods.sort.to_s}" # ", #{_o.text.to_s}, selected: #{_o.to_s}"
|
193
|
+
# Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " PAUSE"; gets()
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
|
201
|
+
end
|
202
|
+
|
203
|
+
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
def fillForm(drv, dut)
|
209
|
+
|
210
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " fillForm(#{drv.to_s}, #{dut.to_s})"
|
211
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " | type => #{dut.class.to_s}"
|
212
|
+
|
213
|
+
if dut.is_a?(Hash)
|
214
|
+
|
215
|
+
dut.keys.each do |k|
|
216
|
+
if @elements.has_key?(k)
|
217
|
+
_xpath = @elements[k] # .to_s
|
218
|
+
|
219
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " key(#{k}) : locator:#{_xpath} => #{dut[k].to_s}"
|
220
|
+
|
221
|
+
if !drv.nil?
|
222
|
+
@drv=drv
|
223
|
+
obj = Scoutui::Base::QBrowser.getObject(drv, _xpath)
|
224
|
+
|
225
|
+
_type = obj.attribute('type').to_s
|
226
|
+
_tag = obj.tag_name.to_s
|
227
|
+
|
228
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " obj => type:#{_type} tag:#{_tag}"
|
229
|
+
|
230
|
+
# element.getAttribute("type").equalsIgnoreCase("text")
|
231
|
+
if !_type.match(/(password|text|email)/i).nil? && !_tag.match(/(input|textarea)/i).nil?
|
232
|
+
_v = Scoutui::Base::UserVars.instance.get(dut[k].to_s)
|
233
|
+
obj.send_keys(_v)
|
234
|
+
|
235
|
+
elsif _type.match(/(select)/i)
|
236
|
+
_v = Scoutui::Base::UserVars.instance.get(dut[k].to_s)
|
237
|
+
_opt = Selenium::WebDriver::Support::Select.new(obj)
|
238
|
+
_opt.select_by(:text, Scoutui::Base::UserVars.instance.get(_v))
|
239
|
+
else
|
240
|
+
Scoutui::Logger::LogMgr.instance.commands.warn " Unidentified attribute type : #{_type.to_s}"
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
else
|
245
|
+
Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " ** key #{k} not part of form **"
|
246
|
+
end
|
247
|
+
|
248
|
+
end
|
249
|
+
|
250
|
+
end
|
251
|
+
|
252
|
+
|
253
|
+
self
|
254
|
+
|
255
|
+
end
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
end
|
260
|
+
|
261
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module Scoutui::Base
|
4
|
+
|
5
|
+
|
6
|
+
class TestScout
|
7
|
+
attr_reader :context
|
8
|
+
attr_reader :test_settings # { host, dut }
|
9
|
+
attr_reader :userRecord
|
10
|
+
attr_reader :eyesRecord # {'title' , 'app'}
|
11
|
+
attr_reader :eyeScout
|
12
|
+
attr_reader :results
|
13
|
+
|
14
|
+
def initialize(_context)
|
15
|
+
@result = nil
|
16
|
+
@test_settings=nil
|
17
|
+
@eyesRecord=nil
|
18
|
+
|
19
|
+
if Scoutui::Utils::TestUtils.instance.hasTestConfig?
|
20
|
+
|
21
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " * test config json => " + Scoutui::Utils::TestUtils.instance.testConfigFile() if Scoutui::Utils::TestUtils.instance.isDebug?
|
22
|
+
|
23
|
+
@test_settings=Scoutui::Utils::TestUtils.instance.getTestSettings()
|
24
|
+
|
25
|
+
@eyesRecord = @test_settings['eyes']
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
def start
|
32
|
+
if hasSettings?
|
33
|
+
dumpSettings if Scoutui::Utils::TestUtils.instance.isDebug?
|
34
|
+
run()
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def stop
|
39
|
+
# TBD
|
40
|
+
end
|
41
|
+
|
42
|
+
def report
|
43
|
+
@eyeScout.generateReport()
|
44
|
+
end
|
45
|
+
|
46
|
+
def hasSettings?
|
47
|
+
Scoutui::Utils::TestUtils.instance.hasTestConfig?
|
48
|
+
end
|
49
|
+
|
50
|
+
def dumpSettings()
|
51
|
+
Scoutui::Logger::LogMgr.instance.debug '-' * 72
|
52
|
+
Scoutui::Logger::LogMgr.instance.debug @test_settings
|
53
|
+
|
54
|
+
Scoutui::Logger::LogMgr.instance.debug "UserRecord => #{@userRecord}"
|
55
|
+
Scoutui::Logger::LogMgr.instance.debug "Eyes Record => #{@eyesRecord}"
|
56
|
+
Scoutui::Logger::LogMgr.instance.debug "Host => #{@test_settings['host']}"
|
57
|
+
end
|
58
|
+
|
59
|
+
def teardown()
|
60
|
+
@eyeScout.teardown()
|
61
|
+
end
|
62
|
+
|
63
|
+
def setup()
|
64
|
+
|
65
|
+
if Scoutui::Utils::TestUtils.instance.isDebug?
|
66
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " eyes cfg => #{@eyesRecord}"
|
67
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " title => " + Scoutui::Base::UserVars.instance.getVar('eyes.title')
|
68
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " app => " + Scoutui::Base::UserVars.instance.getVar('eyes.app')
|
69
|
+
end
|
70
|
+
|
71
|
+
begin
|
72
|
+
|
73
|
+
eyeScout=Scoutui::Eyes::EyeFactory.instance.createScout()
|
74
|
+
rescue => ex
|
75
|
+
Scoutui::Logger::LogMgr.instance.debug ex.backtrace
|
76
|
+
end
|
77
|
+
|
78
|
+
eyeScout
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
def snapPage(tag)
|
83
|
+
@eyeScout.check_window(tag)
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
def run()
|
88
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " run()" if Scoutui::Utils::TestUtils.instance.isDebug?
|
89
|
+
|
90
|
+
begin
|
91
|
+
|
92
|
+
@eyeScout = setup() # Browser is created
|
93
|
+
|
94
|
+
# Navigate to the specified host
|
95
|
+
@eyeScout.navigate(Scoutui::Base::UserVars.instance.get(:host))
|
96
|
+
|
97
|
+
# snapPage('Landing Page')
|
98
|
+
|
99
|
+
Scoutui::Base::VisualTestFramework.processFile(@eyeScout, @test_settings)
|
100
|
+
|
101
|
+
teardown()
|
102
|
+
|
103
|
+
rescue => ex
|
104
|
+
Scoutui::Logger::LogMgr.instance.debug ex.backtrace
|
105
|
+
ensure
|
106
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__ ).to_s + " Close Eyes" if Scoutui::Utils::TestUtils.instance.isDebug?
|
107
|
+
@eyeScout.closeOut()
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
|
120
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Scoutui::Base
|
4
|
+
|
5
|
+
|
6
|
+
class TestSettings
|
7
|
+
|
8
|
+
attr_accessor :bEyes
|
9
|
+
attr_accessor :browserType
|
10
|
+
attr_accessor :eut
|
11
|
+
attr_accessor :user
|
12
|
+
attr_accessor :eyesReport
|
13
|
+
attr_accessor :url
|
14
|
+
|
15
|
+
|
16
|
+
def initialize(opts)
|
17
|
+
@bEyes=false
|
18
|
+
@browserType=opts[:but] || :firefox
|
19
|
+
@eut=opts[:eut] || :qa
|
20
|
+
@lang=opts[:lang] || "en-us"
|
21
|
+
@user=opts[:user] || nil
|
22
|
+
@eyesReport=opts[:eyesReport] || nil
|
23
|
+
@url=opts[:url]||nil
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
def setConfig(c)
|
28
|
+
if c.instance_of?(Hash)
|
29
|
+
@testConfig=c
|
30
|
+
else
|
31
|
+
# a JSON file was passed (ERROR handling needed)
|
32
|
+
jFile = File.read(c)
|
33
|
+
@testConfig=JSON.parse(jFile)
|
34
|
+
end
|
35
|
+
|
36
|
+
@testConfig
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
def getScout()
|
41
|
+
@testConfig["dut"]
|
42
|
+
end
|
43
|
+
|
44
|
+
def setLang(lang)
|
45
|
+
@lang=lang
|
46
|
+
end
|
47
|
+
|
48
|
+
def getUrl()
|
49
|
+
@url
|
50
|
+
end
|
51
|
+
|
52
|
+
def url
|
53
|
+
getUrl()
|
54
|
+
end
|
55
|
+
|
56
|
+
def setUrl(u)
|
57
|
+
@url=u
|
58
|
+
end
|
59
|
+
|
60
|
+
def getEyesReport()
|
61
|
+
@eyesReport
|
62
|
+
end
|
63
|
+
|
64
|
+
def getLanguage()
|
65
|
+
getLang()
|
66
|
+
end
|
67
|
+
|
68
|
+
def getUser()
|
69
|
+
@user
|
70
|
+
end
|
71
|
+
|
72
|
+
def getLang()
|
73
|
+
@lang
|
74
|
+
end
|
75
|
+
|
76
|
+
def getBUT()
|
77
|
+
@browserType
|
78
|
+
end
|
79
|
+
|
80
|
+
def setEUT(e)
|
81
|
+
@eut=e
|
82
|
+
end
|
83
|
+
|
84
|
+
def getEUT()
|
85
|
+
@eut
|
86
|
+
end
|
87
|
+
|
88
|
+
def browserType()
|
89
|
+
@browserType
|
90
|
+
end
|
91
|
+
|
92
|
+
def enableEyes(b=true)
|
93
|
+
@bEyes=b
|
94
|
+
end
|
95
|
+
|
96
|
+
def disableEyes()
|
97
|
+
@bEyes=false
|
98
|
+
end
|
99
|
+
|
100
|
+
def isEyes?
|
101
|
+
@bEyes
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
|
107
|
+
end
|
108
|
+
|
109
|
+
|