scoutui 0.1.3 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/pkg/scoutui-2.0.0.gem +0 -0
- metadata +49 -40
- data/.gitignore +0 -9
- data/.rspec +0 -2
- data/.travis.yml +0 -4
- data/CODE_OF_CONDUCT.md +0 -13
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -21
- data/README.md +0 -116
- data/Rakefile +0 -6
- data/bin/console +0 -14
- data/bin/scoutui_driver.rb +0 -22
- data/bin/setup +0 -7
- data/examples/ex1/commands.yml +0 -25
- data/examples/ex1/test-example.sh +0 -36
- data/examples/ex1/test.config.json +0 -16
- data/examples/ex2/commands.yml +0 -35
- data/examples/ex2/page_model.json +0 -18
- data/examples/ex2/test-example.sh +0 -38
- data/examples/ex2/test.config.json +0 -25
- data/examples/ex6/commands.yml +0 -53
- data/examples/ex6/ex1.config.json +0 -24
- data/examples/ex6/test-example.sh +0 -36
- data/lib/scoutui/base/q_accounts.rb +0 -52
- data/lib/scoutui/base/q_applitools.rb +0 -125
- data/lib/scoutui/base/q_browser.rb +0 -74
- data/lib/scoutui/base/test_scout.rb +0 -123
- data/lib/scoutui/base/test_settings.rb +0 -109
- data/lib/scoutui/base/user_vars.rb +0 -105
- data/lib/scoutui/base/visual_test_framework.rb +0 -270
- data/lib/scoutui/eyes/eye_factory.rb +0 -76
- data/lib/scoutui/eyes/eye_scout.rb +0 -101
- data/lib/scoutui/navigator.rb +0 -24
- data/lib/scoutui/utils/utils.rb +0 -267
- data/lib/scoutui/version.rb +0 -3
- data/lib/scoutui.rb +0 -8
- data/scoutui.gemspec +0 -33
@@ -1,270 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
module Scoutui::Base
|
4
|
-
|
5
|
-
class VisualTestFramework
|
6
|
-
|
7
|
-
def initialize()
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
|
12
|
-
def self.isClick?(_action)
|
13
|
-
!_action.match(/click\(/).nil?
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.isMouseOver(_action)
|
17
|
-
!_action.match(/mouseover\(/).nil?
|
18
|
-
end
|
19
|
-
|
20
|
-
|
21
|
-
def self.processCommand(_action, e, my_driver)
|
22
|
-
puts __FILE__ + (__LINE__).to_s + " Process ACTION : #{_action}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
23
|
-
|
24
|
-
if !_action.match(/pause/).nil?
|
25
|
-
|
26
|
-
puts " PAUSE";
|
27
|
-
gets();
|
28
|
-
|
29
|
-
elsif !_action.match(/type\(/).nil?
|
30
|
-
_xpath = _action.match(/type\((.*),\s*/)[1].to_s
|
31
|
-
_val = _action.match(/type\(.*,\s*(.*)\)/)[1].to_s
|
32
|
-
|
33
|
-
puts __FILE__ + (__LINE__).to_s + "Process TYPE #{_val} into #{_xpath}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
34
|
-
|
35
|
-
obj = Scoutui::Base::QBrowser.getObject(my_driver, _xpath)
|
36
|
-
|
37
|
-
if !obj.nil? && !obj.attribute('type').downcase.match(/(text|password)/).nil?
|
38
|
-
obj.send_keys(Scoutui::Base::UserVars.instance.get(_val))
|
39
|
-
else
|
40
|
-
puts __FILE__ + (__LINE__).to_s + " Unable to process command TYPE => #{obj.to_s}"
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
if !_action.match(/click\(/).nil?
|
46
|
-
_xpath = _action.match(/click\s*\((.*)\)/)[1].to_s.strip
|
47
|
-
puts __FILE__ + (__LINE__).to_s + " click => #{_xpath}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
48
|
-
|
49
|
-
_xpath = Scoutui::Base::UserVars.instance.get(_xpath)
|
50
|
-
|
51
|
-
puts __FILE__ + (__LINE__).to_s + " | translate : #{_xpath}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
52
|
-
|
53
|
-
obj = Scoutui::Base::QBrowser.getObject(my_driver, _xpath)
|
54
|
-
obj.click if obj
|
55
|
-
elsif isMouseOver(_action)
|
56
|
-
_xpath = _action.match(/mouseover\s*\((.*)\)/)[1].to_s.strip
|
57
|
-
obj = Scoutui::Base::QBrowser.getObject(my_driver, _xpath)
|
58
|
-
my_driver.action.move_to(obj).perform
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
def self.isRun(e)
|
65
|
-
_run=nil
|
66
|
-
if e["page"].has_key?("run")
|
67
|
-
_run = e["page"].has_key?("run").to_s
|
68
|
-
end
|
69
|
-
_run
|
70
|
-
end
|
71
|
-
|
72
|
-
def self.isSnapIt(e)
|
73
|
-
_snapit=false
|
74
|
-
|
75
|
-
if e["page"].has_key?("snapit")
|
76
|
-
_snapit = !(e["page"]["snapit"].to_s.match(/true/i).nil?)
|
77
|
-
end
|
78
|
-
_snapit
|
79
|
-
end
|
80
|
-
|
81
|
-
def self.processExpected(my_driver, e)
|
82
|
-
puts __FILE__ + (__LINE__).to_s + "\to Expected: #{e['page']['expected'].class.to_s}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
83
|
-
|
84
|
-
if e['page'].has_key?('expected')
|
85
|
-
expected_list=e['page']['expected']
|
86
|
-
|
87
|
-
expected_list.each_pair do |link_name, xpath|
|
88
|
-
puts "\t\t#{link_name} => #{xpath}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
89
|
-
if !xpath.match(/^page\([\w\d]+\)/).nil?
|
90
|
-
|
91
|
-
xpath = Scoutui::Utils::TestUtils.instance.getPageElement(xpath)
|
92
|
-
puts __FILE__ + (__LINE__).to_s + " Process page request #{xpath} => #{xpath}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
93
|
-
end
|
94
|
-
|
95
|
-
obj = Scoutui::Base::QBrowser.getFirstObject(my_driver, xpath)
|
96
|
-
|
97
|
-
if obj.nil?
|
98
|
-
puts " NOT FOUND : #{link_name} with xpath #{xpath}"
|
99
|
-
else
|
100
|
-
puts " link object(#{link_name} with xpath #{xpath}=> #{obj.displayed?}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
101
|
-
end
|
102
|
-
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
# Scoutui::Base::VisualTestFramework.processFile(@drv, @eyes, @test_settings['host'], @test_settings['dut'])
|
108
|
-
def self.processFile(eyeScout, test_settings)
|
109
|
-
|
110
|
-
my_driver = eyeScout.drv()
|
111
|
-
|
112
|
-
baseUrl = Scoutui::Base::UserVars.instance.getHost()
|
113
|
-
datafile = test_settings['dut']
|
114
|
-
|
115
|
-
puts __FILE__ + (__LINE__).to_s + " processFile(#{eyeScout}, #{baseUrl}, #{datafile})" if Scoutui::Utils::TestUtils.instance.isDebug?
|
116
|
-
|
117
|
-
valid_file=false
|
118
|
-
i=0
|
119
|
-
begin
|
120
|
-
dut_dupes = YAML.load_stream File.read(datafile)
|
121
|
-
valid_file=true
|
122
|
-
rescue => ex
|
123
|
-
puts __FILE__ + (__LINE__).to_s + " Invalid file: #{datafile} - abort processing."
|
124
|
-
puts ex.backtrace
|
125
|
-
end
|
126
|
-
|
127
|
-
return if !valid_file
|
128
|
-
|
129
|
-
dut_dupes.each do |e|
|
130
|
-
puts '-' * 72 if Scoutui::Utils::TestUtils.instance.isDebug?
|
131
|
-
puts "#{i.to_s}. Processing #{e.inspect}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
132
|
-
i+=1
|
133
|
-
|
134
|
-
_action = e["page"]["action"]
|
135
|
-
_name = e["page"]["name"]
|
136
|
-
_url = e["page"]["url"]
|
137
|
-
_skip = e["page"]["skip"]
|
138
|
-
_region = e["page"]["region"]
|
139
|
-
|
140
|
-
|
141
|
-
if Scoutui::Utils::TestUtils.instance.isDebug?
|
142
|
-
puts __FILE__ + (__LINE__).to_s + " action: #{_action}"
|
143
|
-
puts __FILE__ + (__LINE__).to_s + " name: #{_name}"
|
144
|
-
puts __FILE__ + (__LINE__).to_s + " url : #{_url}"
|
145
|
-
puts __FILE__ + (__LINE__).to_s + " skip: #{_skip}"
|
146
|
-
puts __FILE__ + (__LINE__).to_s + " region: #{_region}"
|
147
|
-
end
|
148
|
-
|
149
|
-
skipIt = (!_skip.nil?) && (_skip.to_s.strip.downcase=='true')
|
150
|
-
puts "\to skip : #{skipIt}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
151
|
-
|
152
|
-
if skipIt
|
153
|
-
puts __FILE__ + (__LINE__).to_s + " SKIP - #{_name}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
154
|
-
next
|
155
|
-
end
|
156
|
-
|
157
|
-
|
158
|
-
if !isRun(e).nil?
|
159
|
-
|
160
|
-
tmpSettings=test_settings.dup
|
161
|
-
tmpSettings["dut"]=e["page"]["run"].to_s
|
162
|
-
|
163
|
-
processFile(eyeScout, tmpSettings)
|
164
|
-
puts __FILE__ + (__LINE__).to_s + " Completed execution of subfile" if Scoutui::Utils::TestUtils.instance.isDebug?
|
165
|
-
next
|
166
|
-
end
|
167
|
-
|
168
|
-
if !(_action.nil? || _action.empty?)
|
169
|
-
processCommand(_action, e, my_driver)
|
170
|
-
processExpected(my_driver, e)
|
171
|
-
|
172
|
-
if isSnapIt(e)
|
173
|
-
if !_region.nil?
|
174
|
-
eyeScout.check_window(_name, _region)
|
175
|
-
else
|
176
|
-
eyeScout.check_window(_name)
|
177
|
-
end
|
178
|
-
|
179
|
-
# processExpected(my_driver, e)
|
180
|
-
end
|
181
|
-
|
182
|
-
next
|
183
|
-
end
|
184
|
-
|
185
|
-
_relativeUrl = _url.strip.start_with?('/')
|
186
|
-
|
187
|
-
url = e["page"]["url"].to_s
|
188
|
-
|
189
|
-
if _relativeUrl
|
190
|
-
puts __FILE__ + (__LINE__).to_s + " [relative url]: #{baseUrl} with #{url}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
191
|
-
url = baseUrl + url
|
192
|
-
end
|
193
|
-
|
194
|
-
name = e["page"]["name"].to_s
|
195
|
-
my_driver.navigate().to(url)
|
196
|
-
|
197
|
-
|
198
|
-
puts "\to Expected: #{e['page']['expected'].class.to_s}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
199
|
-
|
200
|
-
processExpected(my_driver, e)
|
201
|
-
|
202
|
-
if false
|
203
|
-
|
204
|
-
if e['page'].has_key?('expected')
|
205
|
-
expected_list=e['page']['expected']
|
206
|
-
|
207
|
-
expected_list.each_pair do |link_name, xpath|
|
208
|
-
puts "\t\t#{link_name} => #{xpath}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
209
|
-
|
210
|
-
if !xpath.match(/^page\([\w\d]+\)/).nil?
|
211
|
-
|
212
|
-
|
213
|
-
xpath = Scoutui::Utils::TestUtils.instance.getPageElement(xpath)
|
214
|
-
|
215
|
-
puts __FILE__ + (__LINE__).to_s + " Process page request #{xpath} => #{xpath}"
|
216
|
-
|
217
|
-
end
|
218
|
-
|
219
|
-
obj = Scoutui::Base::QBrowser.getObject(my_driver, xpath)
|
220
|
-
|
221
|
-
if obj.nil?
|
222
|
-
puts " NOT FOUND : #{link_name} with xpath #{xpath}"
|
223
|
-
else
|
224
|
-
puts " link object(#{link_name} with xpath #{xpath}=> #{obj.displayed?}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
225
|
-
end
|
226
|
-
|
227
|
-
end
|
228
|
-
end
|
229
|
-
|
230
|
-
|
231
|
-
end
|
232
|
-
|
233
|
-
|
234
|
-
if !_region.nil?
|
235
|
-
eyeScount.check_window(_name, _region)
|
236
|
-
else
|
237
|
-
eyeScout.check_window(name)
|
238
|
-
end
|
239
|
-
|
240
|
-
puts "\to links : #{e['page']['links'].class.to_s}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
241
|
-
|
242
|
-
if e['page'].has_key?('links')
|
243
|
-
links=e['page']['links']
|
244
|
-
|
245
|
-
links.each_pair do |link_name, xpath|
|
246
|
-
puts "\t\t#{link_name} => #{xpath}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
247
|
-
|
248
|
-
|
249
|
-
obj = QBrowser.getObject(my_driver, xpath)
|
250
|
-
puts __FILE__ + (__LINE__).to_s + " [click]: link object => #{obj.to_s}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
251
|
-
obj.click
|
252
|
-
|
253
|
-
if !_region.nil?
|
254
|
-
eyeScount.check_window(_name, _region)
|
255
|
-
else
|
256
|
-
eyeScout.check_window(link_name)
|
257
|
-
end
|
258
|
-
|
259
|
-
end
|
260
|
-
end
|
261
|
-
|
262
|
-
end
|
263
|
-
|
264
|
-
|
265
|
-
end
|
266
|
-
|
267
|
-
end
|
268
|
-
|
269
|
-
|
270
|
-
end
|
@@ -1,76 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'singleton'
|
3
|
-
|
4
|
-
|
5
|
-
module Scoutui::Eyes
|
6
|
-
|
7
|
-
|
8
|
-
class EyeFactory
|
9
|
-
include Singleton
|
10
|
-
|
11
|
-
attr_accessor :eyesList
|
12
|
-
|
13
|
-
def initialize
|
14
|
-
@eyesList=Array.new()
|
15
|
-
end
|
16
|
-
|
17
|
-
def createScout()
|
18
|
-
browserType = Scoutui::Base::UserVars.instance.getBrowserType()
|
19
|
-
eyeScout = EyeScout.new(browserType)
|
20
|
-
end
|
21
|
-
|
22
|
-
def createEyes()
|
23
|
-
|
24
|
-
use_eyes = Scoutui::Utils::TestUtils.instance.eyesEnabled?
|
25
|
-
|
26
|
-
puts __FILE__ + (__LINE__).to_s + " create(#{use_eyes})" if Scoutui::Utils::TestUtils.instance.isDebug?
|
27
|
-
eyes=nil
|
28
|
-
|
29
|
-
|
30
|
-
if use_eyes
|
31
|
-
license_key=nil
|
32
|
-
|
33
|
-
licFile=Scoutui::Utils::TestUtils.instance.getLicenseFile()
|
34
|
-
|
35
|
-
if !licFile.empty?
|
36
|
-
|
37
|
-
valid_json=false
|
38
|
-
begin
|
39
|
-
jFile = File.read(licFile)
|
40
|
-
jLicense=jsonData=JSON.parse(jFile)
|
41
|
-
license_key=jLicense['api_key'].to_s
|
42
|
-
valid_json=true
|
43
|
-
rescue => ex
|
44
|
-
;
|
45
|
-
end
|
46
|
-
|
47
|
-
elsif ENV.has_key?('APPLITOOLS_API_KEY')
|
48
|
-
license_key=ENV['APPLITOOLS_API_KEY'].to_s
|
49
|
-
end
|
50
|
-
|
51
|
-
|
52
|
-
if !license_key.nil?
|
53
|
-
eyes=Applitools::Eyes.new()
|
54
|
-
eyes.api_key = license_key
|
55
|
-
eyes.force_fullpage_screenshot = true
|
56
|
-
|
57
|
-
match_level = Scoutui::Base::UserVars.instance.getVar('eyes.match_level')
|
58
|
-
|
59
|
-
eyes.match_level = Applitools::Eyes::MATCH_LEVEL[match_level.to_sym]
|
60
|
-
end
|
61
|
-
|
62
|
-
## TBD - eyes.open()
|
63
|
-
|
64
|
-
|
65
|
-
end
|
66
|
-
|
67
|
-
# eyes
|
68
|
-
@eyesList << eyes
|
69
|
-
@eyesList.last()
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
end
|
@@ -1,101 +0,0 @@
|
|
1
|
-
require 'eyes_selenium'
|
2
|
-
|
3
|
-
module Scoutui::Eyes
|
4
|
-
|
5
|
-
|
6
|
-
class EyeScout
|
7
|
-
|
8
|
-
attr_accessor :drv
|
9
|
-
attr_accessor :eyes
|
10
|
-
attr_accessor :testResults
|
11
|
-
|
12
|
-
def teardown()
|
13
|
-
@drv.quit()
|
14
|
-
end
|
15
|
-
|
16
|
-
def navigate(url)
|
17
|
-
@drv.navigate().to(url)
|
18
|
-
end
|
19
|
-
|
20
|
-
def drv()
|
21
|
-
@drv
|
22
|
-
end
|
23
|
-
|
24
|
-
def eyes()
|
25
|
-
@eyes
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
def closeOut()
|
30
|
-
return if !Scoutui::Utils::TestUtils.instance.eyesEnabled?
|
31
|
-
@testResults = eyes().close(false)
|
32
|
-
eyes().abort_if_not_closed if !eyes().nil?
|
33
|
-
end
|
34
|
-
|
35
|
-
def check_window(tag, region=nil)
|
36
|
-
puts __FILE__ + (__LINE__).to_s + " check_window(#{tag.to_s})" if Scoutui::Utils::TestUtils.instance.isDebug?
|
37
|
-
|
38
|
-
return if !Scoutui::Utils::TestUtils.instance.eyesEnabled?
|
39
|
-
|
40
|
-
if region.nil?
|
41
|
-
eyes().check_window(tag.to_s)
|
42
|
-
else
|
43
|
-
f = eyes().force_fullpage_screenshot
|
44
|
-
eyes().check_region(:xpath, region, tag)
|
45
|
-
eyes().force_fullpage_screenshot = f
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
def generateReport()
|
51
|
-
puts " TestReport => #{@testResults}"
|
52
|
-
end
|
53
|
-
|
54
|
-
def getResults()
|
55
|
-
@testResults
|
56
|
-
end
|
57
|
-
|
58
|
-
def initialize(browserType)
|
59
|
-
@testResults=nil
|
60
|
-
|
61
|
-
browserType = Scoutui::Base::UserVars.instance.getBrowserType()
|
62
|
-
viewport_size = Scoutui::Base::UserVars.instance.getViewPort()
|
63
|
-
|
64
|
-
if Scoutui::Utils::TestUtils.instance.isDebug?
|
65
|
-
puts __FILE__ + (__LINE__).to_s + " setup() : #{browserType}"
|
66
|
-
puts __FILE__ + (__LINE__).to_s + " viewport => #{viewport_size}"
|
67
|
-
puts __FILE__ + (__LINE__).to_s + " eyes cfg => #{@eyesRecord}"
|
68
|
-
puts __FILE__ + (__LINE__).to_s + " title => " + Scoutui::Base::UserVars.instance.getVar('eyes.title')
|
69
|
-
puts __FILE__ + (__LINE__).to_s + " app => " + Scoutui::Base::UserVars.instance.getVar('eyes.app')
|
70
|
-
puts __FILE__ + (__LINE__).to_s + " match_level => " + Scoutui::Base::UserVars.instance.getVar('eyes.match_level')
|
71
|
-
end
|
72
|
-
|
73
|
-
begin
|
74
|
-
@drv=Selenium::WebDriver.for browserType.to_sym
|
75
|
-
@eyes=Scoutui::Eyes::EyeFactory.instance.createEyes()
|
76
|
-
|
77
|
-
puts __FILE__ + (__LINE__).to_s + " eyes => #{eyes}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
78
|
-
|
79
|
-
## TBD - move the following into eye_scout ??
|
80
|
-
if Scoutui::Utils::TestUtils.instance.eyesEnabled?
|
81
|
-
@driver = @eyes.open(
|
82
|
-
app_name: Scoutui::Base::UserVars.instance.getVar('eyes.app'), # @eyesRecord['app'],
|
83
|
-
test_name: Scoutui::Base::UserVars.instance.getVar('eyes.title'), # @eyesRecord['title'],
|
84
|
-
viewport_size: viewport_size,
|
85
|
-
# viewport_size: {width: 800, height: 600},
|
86
|
-
driver: @drv)
|
87
|
-
end
|
88
|
-
|
89
|
-
rescue => ex
|
90
|
-
puts ex.backtrace
|
91
|
-
end
|
92
|
-
|
93
|
-
end
|
94
|
-
|
95
|
-
|
96
|
-
end
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
end
|
data/lib/scoutui/navigator.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require_relative 'version'
|
2
|
-
|
3
|
-
require 'forwardable'
|
4
|
-
|
5
|
-
class Scoutui::Navigator
|
6
|
-
extend Forwardable
|
7
|
-
|
8
|
-
attr_reader :test_options
|
9
|
-
|
10
|
-
attr_reader :app_name
|
11
|
-
attr_reader :test_name
|
12
|
-
attr_reader :viewport_size
|
13
|
-
attr_reader :driver
|
14
|
-
attr_reader :test_list
|
15
|
-
|
16
|
-
def initialize(opts={})
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|