scoutui 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/examples/capabilities/win10.chrome46.json +6 -0
  3. data/examples/ex1/test-example.sh +4 -4
  4. data/examples/ex1/test.config.json +1 -1
  5. data/examples/ex2/appmodel/common.json +51 -0
  6. data/examples/ex2/appmodel/page_model.json +106 -0
  7. data/examples/ex2/appmodel/register.model.json +42 -0
  8. data/examples/ex2/commands/commands.basic.appmodel.yml +8 -0
  9. data/examples/ex2/commands/commands.yml +115 -0
  10. data/examples/ex2/commands/ex1.yml +7 -0
  11. data/examples/ex2/commands/ex1c.yml +8 -0
  12. data/examples/ex2/commands/ex1d.yml +22 -0
  13. data/examples/ex2/commands/ex2.hover.yml +43 -0
  14. data/examples/ex2/commands/ex2.yml +24 -0
  15. data/examples/ex2/data.json +6 -0
  16. data/examples/ex2/test-configs/test.config.basic.json +12 -0
  17. data/examples/ex2/{test.config.json → test-configs/test.config.json} +8 -2
  18. data/examples/ex2/tests/run-test.sh +125 -0
  19. data/examples/ex2/tests/test-basic-appmodel.sh +14 -0
  20. data/examples/ex2/{test-example.sh → tests/test-example.sh} +3 -3
  21. data/examples/ex2/tests/test-example1a.sh +16 -0
  22. data/examples/ex2/tests/test-example1b.sh +13 -0
  23. data/examples/ex2/tests/test-example1c.sh +15 -0
  24. data/examples/ex2/tests/test-example1d.sh +15 -0
  25. data/examples/ex2/tests/test-example2.forms.eyes.sh +40 -0
  26. data/examples/ex2/tests/test-example2.hover.eyes.sh +40 -0
  27. data/examples/ex2/tests/test-example2.hover.sh +26 -0
  28. data/examples/ex2/tests/test-example2.sh +43 -0
  29. data/examples/ex2/tests/test-example3.sauce.sh +77 -0
  30. data/examples/ex2/tests/test-example3.sh +41 -0
  31. data/lib/scoutui/appmodel/q_model.rb +105 -0
  32. data/lib/scoutui/base/assertions.rb +570 -10
  33. data/lib/scoutui/base/q_applitools.rb +2 -2
  34. data/lib/scoutui/base/q_browser.rb +38 -5
  35. data/lib/scoutui/base/q_form.rb +7 -7
  36. data/lib/scoutui/base/test_scout.rb +2 -1
  37. data/lib/scoutui/base/user_vars.rb +29 -2
  38. data/lib/scoutui/base/visual_test_framework.rb +308 -24
  39. data/lib/scoutui/commands/click_object.rb +86 -13
  40. data/lib/scoutui/commands/commands.rb +20 -7
  41. data/lib/scoutui/commands/jsalert/action_jsalert.rb +1 -1
  42. data/lib/scoutui/commands/mouse_over.rb +94 -8
  43. data/lib/scoutui/commands/select_object.rb +1 -1
  44. data/lib/scoutui/commands/select_window.rb +43 -0
  45. data/lib/scoutui/commands/strategy.rb +40 -3
  46. data/lib/scoutui/commands/type.rb +99 -11
  47. data/lib/scoutui/commands/update_url.rb +1 -1
  48. data/lib/scoutui/commands/utils.rb +43 -5
  49. data/lib/scoutui/commands/verify_element.rb +38 -7
  50. data/lib/scoutui/eyes/eye_factory.rb +7 -1
  51. data/lib/scoutui/eyes/eye_scout.rb +20 -7
  52. data/lib/scoutui/utils/utils.rb +59 -1
  53. data/lib/scoutui/version.rb +1 -1
  54. data/scoutui.gemspec +5 -4
  55. metadata +77 -39
  56. data/examples/ex2/commands.yml +0 -35
  57. data/examples/ex2/page_model.json +0 -28
@@ -5,33 +5,121 @@ module Scoutui::Commands
5
5
  class Type < Command
6
6
 
7
7
 
8
+ def _whenTyped(page_elt)
9
+
10
+ if page_elt.is_a?(Hash) && page_elt.has_key?('when_typed')
11
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Verify #{page_elt['when_clicked']}"
12
+
13
+ page_elt['when_clicked'].each do |_elt|
14
+
15
+ _r = _elt.keys[0].to_s
16
+
17
+ _pg = _elt[_r]
18
+
19
+ # _c = Scoutui::Commands::VerifyElement.new("verifyelement(" + _elt + ")")
20
+ # _c.execute(@drv)
21
+
22
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " _whenClicked -> assertions (#{_pg}, #{_r.to_s})"
23
+
24
+
25
+ if _pg.is_a?(Array)
26
+ _pg.each do |_pg2|
27
+ isVisible=Scoutui::Base::Assertions.instance.isVisible(@drv, _pg2, _r)
28
+ end
29
+ elsif _pg.is_a?(String)
30
+ isVisible=Scoutui::Base::Assertions.instance.isVisible(@drv, _pg, _r)
31
+ else
32
+ puts __FILE__ + (__LINE__).to_s + " => #{_pg}"
33
+ end
34
+
35
+ # Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " IsVisible #{isVisible} - PAUSE"; gets
36
+
37
+ end
38
+
39
+ end
40
+
41
+ end
42
+
8
43
  def execute(drv=nil)
9
44
  @drv=drv if !drv.nil?
10
45
 
46
+ _isKb=false
11
47
  _rc=false
12
48
  _req = Scoutui::Utils::TestUtils.instance.getReq()
13
49
 
14
50
  begin
15
- _xpath = @cmd.match(/type\((.*),\s*/)[1].to_s
16
- _val = @cmd.match(/type\(.*,\s*(.*)\)/)[1].to_s
51
+ # _xpath = @cmd.match(/type[\!]*\((.*),\s*/)[1].to_s
52
+ # _val = @cmd.match(/type[\!]*\(.*,\s*(.*)\)/)[1].to_s
53
+
17
54
 
18
- Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + "Process TYPE #{_val} into #{_xpath}" if Scoutui::Utils::TestUtils.instance.isDebug?
19
55
 
20
- obj = Scoutui::Base::QBrowser.getObject(@drv, _xpath)
21
56
 
22
- if !obj.nil? && !obj.attribute('type').downcase.match(/(text|password|email)/).nil?
23
- obj.send_keys(Scoutui::Base::UserVars.instance.get(_val))
57
+ if @cmd.strip.match(/^\s*type\s*\(\s*__TAB__\s*\)\s*$/)
58
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " HIT TAB key"
59
+ @drv.action.send_keys(:tab).perform
24
60
  _rc=true
61
+ _isKb=true
25
62
  else
26
- Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " Unable to process command TYPE => #{obj.to_s}"
63
+ _xpath = @cmd.match(/^\s*type[\!]*\((.*),\s*/)[1].to_s
64
+ _val = @cmd.match(/^\s*type[\!]*\(.*,\s*(.*)\)/)[1].to_s
65
+
66
+
67
+ Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + "Process TYPE #{_val} into #{_xpath}"
68
+
69
+ obj = Scoutui::Base::QBrowser.getObject(@drv, _xpath, Scoutui::Commands::Utils.instance.getTimeout)
70
+
71
+
72
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " type(#{_val})"
73
+
74
+ if !obj.nil? && !obj.attribute('type').downcase.match(/(text|password|email)/).nil?
75
+
76
+ # Refactor in qbrowser
77
+
78
+ wait = Selenium::WebDriver::Wait.new(:timeout => Scoutui::Commands::Utils.instance.getTimeout)
79
+ isDisplayed=false
80
+ isDisplayed = wait.until {
81
+ true if obj.displayed?
82
+ }
83
+
84
+ if @cmd.match(/type\!/i)
85
+
86
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " clear()"
87
+ obj.clear if isDisplayed
88
+ end
89
+
90
+
91
+
92
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " send_keys(#{_val})"
93
+
94
+ if isDisplayed
95
+ if _val.match(/__DOWN__/)
96
+ obj.send_keys(:arrow_down)
97
+ elsif _val.match(/__TAB__/)
98
+ obj.send_keys(:tab)
99
+ else
100
+
101
+ obj.send_keys(Scoutui::Base::UserVars.instance.get(_val))
102
+ end
103
+
104
+
105
+ _rc=true
106
+ end
107
+
108
+ else
109
+ Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " Unable to process command TYPE => #{obj.to_s}"
110
+ end
27
111
  end
28
112
 
29
- rescue
30
- ;
113
+ rescue => ex
114
+ Scoutui::Logger::LogMgr.instance.debug "Error during processing: #{ex}"
115
+ puts __FILE__ + (__LINE__).to_s + "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
116
+ end
117
+
118
+ if !_isKb
119
+ Testmgr::TestReport.instance.getReq(_req).testcase('type').add(!obj.nil?, "Verify object #{_xpath} to type #{_val} exists : #{obj.class.to_s}")
120
+ Testmgr::TestReport.instance.getReq(_req).testcase('type').add(_rc, "Verify typed data #{_rc}")
31
121
  end
32
122
 
33
- Testmgr::TestReport.instance.getReq(_req).testcase('type').add(!obj.nil?, "Verify object #{_xpath} to type #{_val} exists : #{obj.class.to_s}")
34
- Testmgr::TestReport.instance.getReq(_req).testcase('type').add(_rc, "Verify typed data #{_rc}")
35
123
  setResult(_rc)
36
124
 
37
125
  end
@@ -10,7 +10,7 @@ module Scoutui::Commands
10
10
 
11
11
  baseUrl = Scoutui::Base::UserVars.instance.getHost()
12
12
 
13
- url = @cmd.match(/navigate\s*\((.*)\)/)[1].to_s.strip
13
+ url = @cmd.match(/navigate\s*\((.*)\)/i)[1].to_s.strip
14
14
  Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " url => #{url}" if Scoutui::Utils::TestUtils.instance.isDebug?
15
15
 
16
16
  _relativeUrl = url.strip.start_with?('/')
@@ -9,10 +9,12 @@ module Scoutui::Commands
9
9
 
10
10
  attr_accessor :totalCommands
11
11
  attr_accessor :timeout
12
+ attr_accessor :hwnds
12
13
 
13
14
  def initialize
14
15
  @command_list=['pause',
15
16
  'existsAlert',
17
+ 'clickJsAlert',
16
18
  'fillform',
17
19
  'submitform',
18
20
  'type',
@@ -20,6 +22,7 @@ module Scoutui::Commands
20
22
  'mouseover',
21
23
  'navigate',
22
24
  'select',
25
+ 'select_window',
23
26
  'verifyelt',
24
27
  'verifyelement',
25
28
  'verifyform']
@@ -28,17 +31,48 @@ module Scoutui::Commands
28
31
  @command_list.each do |c|
29
32
  @totalCommands[c]=0
30
33
  end
34
+
35
+ @hwnds = { :current => nil, :previous => nil, :handles => [] }
36
+ end
37
+
38
+
39
+ def isCSS(_locator)
40
+ rc=nil
41
+
42
+ if _locator.match(/^css\=/i)
43
+ rc = _locator.match(/\s*(css\=.*)/i)[1].to_s.strip
44
+ elsif _locator.match(/^#/i)
45
+ rc=_locator.strip
46
+ end
47
+
48
+ rc
31
49
  end
32
50
 
33
- def resetTimeout()
34
- setTimeout(30)
51
+
52
+ def setCurrentWindow(_w)
53
+ if @hwnds[:previous].nil?
54
+ @hwnds[:previous]=_w
55
+ else
56
+ @hwnds[:previous]=@hwnds[:current]
57
+ end
58
+
59
+ @hwnds[:current]=_w
60
+ end
61
+
62
+ def resetTimeout(t=30)
63
+ setTimeout(t)
35
64
  end
36
65
 
37
66
  def setTimeout(_t)
38
- @timeout=_t
67
+ @timeout=_t.to_i
39
68
  end
40
69
  def getTimeout()
41
- @timeout
70
+ @timeout.to_i
71
+ end
72
+
73
+ def isSelectWindow?(_action)
74
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isSelectWindow?(#{_action})"
75
+ !_action.match(/select_window/i).nil?
42
76
  end
43
77
 
44
78
  def isExistsAlert?(_action)
@@ -66,7 +100,7 @@ module Scoutui::Commands
66
100
  end
67
101
 
68
102
  def isType?(_action)
69
- !_action.match(/type\(/).nil?
103
+ !_action.match(/type[\!]*\(/).nil?
70
104
  end
71
105
 
72
106
  def isSubmitForm?(_action)
@@ -97,6 +131,8 @@ module Scoutui::Commands
97
131
  @totalCommands['pause']+=1
98
132
  elsif isExistsAlert?(cmd)
99
133
  @totalCommands['existsAlert']+=1
134
+ elsif isGetAlert?(cmd)
135
+ @totalCommands['clickJsAlert']+=1
100
136
  elsif isVerifyElt?(cmd)
101
137
  @totalCommands['verifyelt']+=1
102
138
  elsif isVerifyForm?(cmd)
@@ -115,6 +151,8 @@ module Scoutui::Commands
115
151
  @totalCommands['select']+=1
116
152
  elsif isNavigate?(cmd)
117
153
  @totalCommands['navigate']+=1
154
+ elsif isSelectWindow?(cmd)
155
+ @totalCommands['select_window']+=1
118
156
  else
119
157
  rc=false
120
158
  end
@@ -20,7 +20,13 @@ module Scoutui::Commands
20
20
  if a.is_a?(Hash)
21
21
  _v=a
22
22
 
23
- _req = Scoutui::Utils::TestUtils.instance.getReq()
23
+
24
+ if _v.has_key?('reqid')
25
+ _req=_v['reqid'].to_s
26
+ else
27
+ _req = Scoutui::Utils::TestUtils.instance.getReq()
28
+ end
29
+
24
30
 
25
31
  if _v.has_key?('locator')
26
32
  _locator = _v['locator'].to_s
@@ -35,7 +41,35 @@ module Scoutui::Commands
35
41
 
36
42
  if _v.has_key?('visible_when')
37
43
 
38
- if _v['visible_when'].match(/always/i)
44
+
45
+ if _v['visible_when'].match(/^\s*(text|value)\s*\(/)
46
+
47
+ _elt = _v['visible_when']
48
+
49
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " verify text";
50
+ condition = _elt.match(/(value|text)\((.*)\)/)[1].to_s
51
+ tmpObj = _elt.match(/(value|text)\((.*)\)/)[2].to_s
52
+ expectedVal = _elt.match(/(value|text)\s*\(.*\)\s*\=\s*(.*)/)[2].to_s
53
+
54
+ _xpath = Scoutui::Base::UserVars.instance.get(tmpObj)
55
+
56
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " locator : #{_xpath}"; #gets
57
+
58
+ obj = Scoutui::Base::QBrowser.getObject(@drv, _xpath, Scoutui::Commands::Utils.instance.getTimeout)
59
+
60
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " text : #{obj.text} vs #{expectedVal}"
61
+
62
+ expected_regex = Regexp.new(expectedVal)
63
+ rc = !obj.text.to_s.match(expected_regex).nil?
64
+
65
+
66
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " req: #{_req} obj : #{obj}, rc:#{rc}"; #gets
67
+ if rc
68
+ Testmgr::TestReport.instance.getReq(_req).get_child('visible_when').add(!obj.nil?, "Verify element exists when #{condition} match #{expectedVal}")
69
+ end
70
+
71
+
72
+ elsif _v['visible_when'].match(/always/i)
39
73
  Scoutui::Logger::LogMgr.instance.asserts.info __FILE__ + (__LINE__).to_s + " Verify assertion #{_k} - #{_locator} visible - #{!_obj.nil?.to_s}"
40
74
  Testmgr::TestReport.instance.getReq(_req).get_child('visible_when').add(!_obj.nil?, "Verify assertion #{_k} - #{_locator} visible")
41
75
  elsif _v['visible_when'].match(/never/i)
@@ -119,7 +153,7 @@ module Scoutui::Commands
119
153
 
120
154
  xpath = Scoutui::Base::UserVars.instance.get(tmpObj)
121
155
 
122
- obj = Scoutui::Base::QBrowser.getObject(@drv, xpath)
156
+ obj = Scoutui::Base::QBrowser.getObject(@drv, xpath, Scoutui::Commands::Utils.instance.getTimeout)
123
157
 
124
158
  if !obj.nil?
125
159
  # Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " value : #{obj.value.to_s}"
@@ -145,7 +179,7 @@ module Scoutui::Commands
145
179
  end
146
180
 
147
181
  if !desc.nil?
148
- locatorObj = Scoutui::Base::QBrowser.getObject(@drv, locator)
182
+ locatorObj = Scoutui::Base::QBrowser.getObject(@drv, locator, Scoutui::Commands::Utils.instance.getTimeout)
149
183
 
150
184
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " LocatorObj : #{locatorObj} : #{!locatorObj.nil? && locatorObj.displayed?}"
151
185
 
@@ -162,9 +196,6 @@ module Scoutui::Commands
162
196
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " value : #{obj.attribute('value').to_s}"
163
197
  end
164
198
 
165
-
166
-
167
-
168
199
  end
169
200
 
170
201
  elsif page_elt.is_a?(Hash)
@@ -1,6 +1,6 @@
1
1
 
2
2
  require 'singleton'
3
-
3
+ require 'eyes_selenium'
4
4
 
5
5
  module Scoutui::Eyes
6
6
 
@@ -16,6 +16,8 @@ module Scoutui::Eyes
16
16
 
17
17
  def createScout()
18
18
  browserType = Scoutui::Base::UserVars.instance.getBrowserType()
19
+
20
+ puts __FILE__ + (__LINE__).to_s + "BrowserType : #{browserType}"
19
21
  eyeScout = EyeScout.new(browserType)
20
22
  end
21
23
 
@@ -45,18 +47,22 @@ module Scoutui::Eyes
45
47
  end
46
48
 
47
49
  elsif ENV.has_key?('APPLITOOLS_API_KEY')
50
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " APPLITOOLS_API_KEY from ENV"
48
51
  license_key=ENV['APPLITOOLS_API_KEY'].to_s
49
52
  end
50
53
 
51
54
 
52
55
  if !license_key.nil?
53
56
  eyes=Applitools::Eyes.new()
57
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Eyes Object created #{eyes}"
54
58
  eyes.api_key = license_key
55
59
  eyes.force_fullpage_screenshot = true
56
60
 
57
61
  match_level = Scoutui::Base::UserVars.instance.getVar('eyes.match_level')
58
62
 
59
63
  eyes.match_level = Applitools::Eyes::MATCH_LEVEL[match_level.to_sym]
64
+
65
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " eyes => #{eyes}"
60
66
  end
61
67
 
62
68
  ## TBD - eyes.open()
@@ -1,5 +1,6 @@
1
- require 'eyes_selenium'
2
- require 'testmgr'
1
+ #require 'eyes_selenium'
2
+ #require 'testmgr'
3
+ require 'httparty'
3
4
 
4
5
  module Scoutui::Eyes
5
6
 
@@ -168,8 +169,15 @@ module Scoutui::Eyes
168
169
  end
169
170
 
170
171
  Scoutui::Logger::LogMgr.instance.info " TestReport => #{@testResults}"
171
- # Testmgr::TestReport.instance.generateReport()
172
+
172
173
  Testmgr::TestReport.instance.report()
174
+
175
+ # Testmgr::TestReport.instance.generateReport()
176
+
177
+ metrics=Testmgr::TestReport.instance.getMetrics()
178
+ Scoutui::Logger::LogMgr.instance.info "Metrics => #{metrics}"
179
+
180
+ Scoutui::Utils::TestUtils.instance.setMetrics(metrics)
173
181
  end
174
182
 
175
183
  def getResults()
@@ -184,8 +192,13 @@ module Scoutui::Eyes
184
192
  browserType = Scoutui::Base::UserVars.instance.getBrowserType()
185
193
  viewport_size = Scoutui::Base::UserVars.instance.getViewPort()
186
194
 
195
+ puts __FILE__ + (__LINE__).to_s + " browserType => #{browserType}"
196
+
197
+
187
198
  Testmgr::TestReport.instance.setDescription('ScoutUI Test')
188
199
  Testmgr::TestReport.instance.setEnvironment(:qa, Scoutui::Utils::TestUtils.instance.getHost())
200
+ Testmgr::TestReport.instance.setHost(Scoutui::Base::UserVars.instance.get(:host))
201
+ Testmgr::TestReport.instance.setBrowserUnderTest(browserType)
189
202
  Testmgr::TestReport.instance.addRequirement('UI')
190
203
  Testmgr::TestReport.instance.getReq('UI').add(Testmgr::TestCase.new('visible_when', "visible_when"))
191
204
  Testmgr::TestReport.instance.addRequirement('Command')
@@ -195,12 +208,12 @@ module Scoutui::Eyes
195
208
 
196
209
  if Scoutui::Utils::TestUtils.instance.isDebug?
197
210
  Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " setup() : #{browserType}"
198
- Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " sauce => " + Scoutui::Utils::TestUtils.instance.eyesEnabled?.to_s
211
+ Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " eyes => " + Scoutui::Utils::TestUtils.instance.eyesEnabled?.to_s
199
212
  Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " viewport => #{viewport_size}"
200
213
  Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " eyes cfg => #{@eyesRecord}"
201
- Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " title => " + Scoutui::Base::UserVars.instance.getVar('eyes.title')
202
- Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " app => " + Scoutui::Base::UserVars.instance.getVar('eyes.app')
203
- Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " match_level => " + Scoutui::Base::UserVars.instance.getVar('eyes.match_level')
214
+ Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " eyes.title => " + Scoutui::Base::UserVars.instance.getVar('eyes.title')
215
+ Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " eyes.app => " + Scoutui::Base::UserVars.instance.getVar('eyes.app')
216
+ Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " eyes.match_level => " + Scoutui::Base::UserVars.instance.getVar('eyes.match_level')
204
217
  end
205
218
 
206
219
  begin
@@ -15,8 +15,17 @@ module Scoutui::Utils
15
15
  attr_accessor :app_model
16
16
  attr_accessor :currentTest
17
17
 
18
+ attr_accessor :metrics
19
+ attr_accessor :final_rc
20
+
21
+ attr_accessor :coverage
22
+
18
23
  def initialize
19
24
 
25
+ @coverage={:pages => []}
26
+ @final_rc=false
27
+ @metrics=nil
28
+
20
29
  @env_list={:accounts => 'SCOUTUI_ACCOUNTS', :browser => 'SCOUTUI_BROWSER', :applitools_api_key => 'APPLITOOLS_API_KEY'}
21
30
  @options={}
22
31
  @currentTest={:reqid => 'UI', :testcase => '00' }
@@ -26,12 +35,14 @@ module Scoutui::Utils
26
35
  @options[o]=nil
27
36
  end
28
37
 
38
+ @options[:include_expected_as_asserts]=false
29
39
  @options[:role]=nil
30
40
  @options[:sauce_name]='unnamed'
31
41
  @options[:enable_eyes]=false
32
42
  @options[:enable_sauce]=false
33
43
  @options[:log_level]=:info # :debug, :info, :warn, :error, :fatal
34
44
  @options[:match_level]='layout'
45
+ @options[:default_wait]=30 # seconds
35
46
  @options[:debug]=false
36
47
 
37
48
  @app_model=nil
@@ -40,6 +51,30 @@ module Scoutui::Utils
40
51
 
41
52
  end
42
53
 
54
+ def getPageCoverage()
55
+ @coverage[:pages]
56
+ end
57
+
58
+ def addPageCoverage(p)
59
+ @coverage[:pages] << p
60
+ end
61
+
62
+ def getFinalRc()
63
+ @final_rc
64
+ end
65
+
66
+ def setFinalRc(b)
67
+ @final_rc=b
68
+ end
69
+
70
+ def getMetrics()
71
+ @metrics
72
+ end
73
+
74
+ def setMetrics(_m)
75
+ @metrics=_m
76
+ end
77
+
43
78
  def getReq()
44
79
  @currentTest[:reqid]
45
80
  end
@@ -73,6 +108,10 @@ module Scoutui::Utils
73
108
  @app_model.getPageElement(s)
74
109
  end
75
110
 
111
+ def getAppModel()
112
+ @app_model
113
+ end
114
+
76
115
  def parseCommandLine()
77
116
 
78
117
  OptionParser.new do |opt|
@@ -119,7 +158,11 @@ module Scoutui::Utils
119
158
  }
120
159
  opt.on('--dut DUT') { |o| @options[:dut]=o }
121
160
  opt.on('-h', '--host HOST') { |o| @options[:host] = o }
122
- opt.on('-l', '--lang LOCAL') { |o| @options[:loc] = o }
161
+ opt.on('-i', '--include_expectations') { |o| @options[:include_expected_as_asserts] = true}
162
+ opt.on('-l', '--lang LOCAL') { |o|
163
+ @options[:loc] = o
164
+ Scoutui::Base::UserVars.instance.setVar(:lang, @options[:loc].to_s)
165
+ }
123
166
  opt.on('-k', '--key EyesLicense') { |o| options[:license_file] = o }
124
167
  opt.on('-a', '--app AppName') { |o| @options[:app] = o }
125
168
  opt.on('--match [LEVEL]', [:layout2, :layout, :strict, :exact, :content], "Select match level (layout, strict, exact, content)") { |o| @options[:match_level] = o }
@@ -135,6 +178,12 @@ module Scoutui::Utils
135
178
  @options[:page_model] = o
136
179
  loadModel(@options[:page_model].to_s)
137
180
  }
181
+
182
+ opt.on('-w', '--wait WaitOnElement') { |o|
183
+ if o.match(/\d+/)
184
+ @options[:default_wait] = o.to_i
185
+ end
186
+ }
138
187
  opt.on('-t', '--title TITLE') { |o| @options[:title] = o }
139
188
 
140
189
  opt.on('-u', '--user USER_ID') { |o|
@@ -219,6 +268,15 @@ module Scoutui::Utils
219
268
  @options[:browser]
220
269
  end
221
270
 
271
+ def getDefaultWait()
272
+ @options[:default_wait]
273
+ end
274
+
275
+
276
+ def assertExpected?
277
+ @options[:include_expected_as_asserts]
278
+ end
279
+
222
280
  def hasTestConfig?
223
281
  !@options[:json_config_file].nil?
224
282
  end