scoutui 2.0.3.15.pre → 2.0.3.16.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/carmax/tests/test-carmax.sh +8 -3
- data/examples/eyes/ex2.rb +23 -0
- data/lib/scoutui/base/visual_test_framework.rb +1 -1
- data/lib/scoutui/eyes/eye_scout.rb +99 -2
- 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: 99c18cd1f8d5282053583a8b37de329c02a2d71f
|
4
|
+
data.tar.gz: d1c31fd719bcce0bc7fbfa65a39c07639110ba6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0f7d17193e59de07ce21044fde89efac1c91a5d4173de19af8d608b1b84af456366a1b5d521a856544376b321d24a7bce26118923c37755d8fdf42a2bb5afc6
|
7
|
+
data.tar.gz: 339f0aac7671b53d0b04ebf0b34e865ed8ec3e8dd071b3813a17502b87938e5e8129bfdc23718855fe45780f29ce652216873699b59159fe20fcff80b106a30c
|
@@ -22,14 +22,17 @@ setup()
|
|
22
22
|
|
23
23
|
MODEL="../appmodel/main.nav.json,../appmodel/search_results.json"
|
24
24
|
|
25
|
-
EYES="--eyes --app ${TITLE} --title ${TITLE}"
|
26
|
-
EYES=
|
25
|
+
EYES="--eyes --app ${TITLE} --title ${TITLE} --match layout2"
|
26
|
+
# EYES=
|
27
27
|
|
28
28
|
SAUCE="--sauce --sauce_name ${TITLE}"
|
29
|
-
SAUCE=
|
29
|
+
SAUCE="--browser chrome"
|
30
30
|
|
31
31
|
CMD="../commands/commands.yml"
|
32
32
|
CMD="../commands/basic_search.yml"
|
33
|
+
|
34
|
+
CMD="../commands/home.commands.yml"
|
35
|
+
|
33
36
|
}
|
34
37
|
|
35
38
|
|
@@ -37,11 +40,13 @@ setup()
|
|
37
40
|
|
38
41
|
setup
|
39
42
|
|
43
|
+
mkdir -p /tmp/vt
|
40
44
|
|
41
45
|
ruby $SCOUTUI_BIN \
|
42
46
|
--config ${TESTCFG} \
|
43
47
|
--user "expense.admin@scoutui.com" --password password1 \
|
44
48
|
${EYES} \
|
49
|
+
--diff /tmp/vt \
|
45
50
|
--viewport ${VIEWPORT} \
|
46
51
|
${SAUCE} \
|
47
52
|
${CAPS} \
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'eyes_selenium'
|
2
|
+
|
3
|
+
eyes = Applitools::Eyes.new
|
4
|
+
# This is your api key, make sure you use it in all your tests.
|
5
|
+
eyes.api_key = 'dHntgIngYlRjYuG5RmdjqOFk106XDCKJplGklCXzjsWjk110'
|
6
|
+
|
7
|
+
# Get a selenium web driver object.
|
8
|
+
my_webdriver = Selenium::WebDriver.for :firefox
|
9
|
+
|
10
|
+
begin
|
11
|
+
# Start visual testing using my_webdriver and setting the viewport to 1024x768.
|
12
|
+
eyes.test(app_name: 'Applitools', test_name: 'Test Web Page',
|
13
|
+
viewport_size: {width: 1024, height: 768}, driver: my_webdriver) do |driver|
|
14
|
+
driver.get 'http://www.applitools.com'
|
15
|
+
# Visual validation point #1
|
16
|
+
eyes.check_window('Main Page')
|
17
|
+
driver.find_element(:css, ".features>a").click
|
18
|
+
# Visual validation point #2
|
19
|
+
eyes.check_window('Features Page')
|
20
|
+
end
|
21
|
+
ensure
|
22
|
+
my_webdriver.quit
|
23
|
+
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
#require 'eyes_selenium'
|
2
2
|
#require 'testmgr'
|
3
3
|
require 'httparty'
|
4
|
+
#require 'uri'
|
5
|
+
#require 'cgi'
|
4
6
|
|
5
7
|
module Scoutui::Eyes
|
6
8
|
|
@@ -36,10 +38,27 @@ module Scoutui::Eyes
|
|
36
38
|
def get_session_id(url)
|
37
39
|
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " -- get_session_id(#{url}) =="
|
38
40
|
_s=/sessions\/(?<session>\d+)/.match(url)[1]
|
41
|
+
end
|
42
|
+
|
43
|
+
def get_accountid(url)
|
44
|
+
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " -- get_account_id(#{url}) =="
|
45
|
+
|
46
|
+
uri = URI(url)
|
47
|
+
queryString = CGI::parse(uri.query)
|
48
|
+
|
49
|
+
accountid = queryString['accountId'] || queryString['accountid']
|
39
50
|
|
51
|
+
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " => accountId : #{accountid}"
|
52
|
+
|
53
|
+
# _s=/sessions\/(?<accountid>\d+)/.match(url)[1]
|
54
|
+
|
55
|
+
accountid.is_a?(Array) ? accountid[0] : accountid
|
40
56
|
end
|
41
57
|
|
42
|
-
def
|
58
|
+
def Legacyget_diff_urls(session_id, view_key)
|
59
|
+
|
60
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "=== get_diffs_url(#{session_id} ==="
|
61
|
+
|
43
62
|
info = "https://eyes.applitools.com/api/sessions/#{session_id}/?ApiKey=#{view_key}&format=json"
|
44
63
|
diff_template = "https://eyes.applitools.com/api/sessions/#{session_id}/steps/%s/diff?ApiKey=#{view_key}"
|
45
64
|
diff_urls = Hash.new
|
@@ -70,6 +89,45 @@ module Scoutui::Eyes
|
|
70
89
|
|
71
90
|
end
|
72
91
|
|
92
|
+
|
93
|
+
def get_diff_urls(session_id, account_id, view_key)
|
94
|
+
|
95
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " == get_diffs_url(#{session_id} =="
|
96
|
+
|
97
|
+
info = "https://eyes.applitools.com/api/sessions/#{session_id}?ApiKey=#{view_key}&format=json"
|
98
|
+
#info = "https://eyes.applitools.com/api/sessions/#{session_id}?accountId=#{account_id}&format=json"
|
99
|
+
diff_template = "https://eyes.applitools.com/api/sessions/#{session_id}/steps/%s/diff?ApiKey=#{view_key}"
|
100
|
+
diff_template = "https://eyes.applitools.com/api/sessions/#{session_id}?accountId=#{account_id}&format=json"
|
101
|
+
|
102
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " diff_template => #{diff_template}"
|
103
|
+
diff_urls = Hash.new
|
104
|
+
|
105
|
+
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " info => #{info}"
|
106
|
+
response = HTTParty.get(info)
|
107
|
+
|
108
|
+
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " RESP => #{response.to_s}"
|
109
|
+
|
110
|
+
begin
|
111
|
+
data = JSON.parse(response.body)
|
112
|
+
index = 1
|
113
|
+
data['actualOutput'].each do |elem|
|
114
|
+
if !elem.nil? && (elem['isMatching'] == false)
|
115
|
+
#diff_urls[index] = diff_template % [index]
|
116
|
+
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " #{index.to_s} :#{elem['tag'].to_s}"
|
117
|
+
#diff_urls[index] = diff_template % [index]
|
118
|
+
diff_urls[index] = { :tag => elem['tag'].to_s, :url => diff_template % [index] }
|
119
|
+
index+=1
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
diff_urls
|
124
|
+
|
125
|
+
rescue JSON::ParserError
|
126
|
+
;
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
|
73
131
|
def sanitize_filename(filename)
|
74
132
|
# Split the name when finding a period which is preceded by some
|
75
133
|
# character, and is followed by some character other than a period,
|
@@ -87,21 +145,49 @@ module Scoutui::Eyes
|
|
87
145
|
end
|
88
146
|
|
89
147
|
def download_images(diff_urls, destination)
|
148
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " download_images(#{diff_urls}, #{destination}"
|
149
|
+
|
90
150
|
diff_urls.each do |index, elem|
|
91
151
|
save_name = sanitize_filename(elem[:tag]) + ".step_#{index}_diff.png"
|
152
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " => download : #{save_name}"
|
153
|
+
|
92
154
|
File.open("#{destination}/#{save_name}", 'wb') do |file|
|
93
155
|
file.write HTTParty.get(elem[:url])
|
94
156
|
end
|
95
157
|
end
|
96
158
|
end
|
97
159
|
|
160
|
+
def Legacy_saveDiffs(_eyes, results, outdir, view_key)
|
161
|
+
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " saveDiffs(#{outdir.to_s})"
|
162
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " | eyesResults => #{results.to_s}"
|
163
|
+
|
164
|
+
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " | steps : #{results.steps.to_s}"
|
165
|
+
session_id = get_session_id(results.url)
|
166
|
+
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " session => #{session_id}"
|
167
|
+
|
168
|
+
diffs = Legacyget_diff_urls(session_id, view_key)
|
169
|
+
|
170
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " diffs => #{diffs}"
|
171
|
+
if diffs.is_a?(Array)
|
172
|
+
diffs.each do |d|
|
173
|
+
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " #{d.to_s}"
|
174
|
+
end
|
175
|
+
|
176
|
+
download_images(diffs, outdir)
|
177
|
+
end
|
178
|
+
|
179
|
+
end
|
180
|
+
|
98
181
|
def saveDiffs(_eyes, results, outdir, view_key)
|
99
182
|
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " saveDiffs(#{outdir.to_s})"
|
183
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " results => #{results.to_s}"
|
100
184
|
|
101
185
|
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " | steps : #{results.steps.to_s}"
|
102
186
|
session_id = get_session_id(results.url)
|
103
187
|
Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " session => #{session_id}"
|
104
188
|
|
189
|
+
account_id = get_accountid(results.url)
|
190
|
+
|
105
191
|
diffs = get_diff_urls(session_id, view_key)
|
106
192
|
|
107
193
|
diffs.each do |d|
|
@@ -121,6 +207,17 @@ module Scoutui::Eyes
|
|
121
207
|
return if !Scoutui::Utils::TestUtils.instance.eyesEnabled?
|
122
208
|
@testResults = eyes().close(false)
|
123
209
|
|
210
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " @eyes => #{eyes().to_s}"
|
211
|
+
|
212
|
+
|
213
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "| app_name : #{eyes().app_name}"
|
214
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "| match_level: #{eyes().match_level}"
|
215
|
+
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "| viewport_size: #{eyes().viewport_size.to_s}"
|
216
|
+
|
217
|
+
eyes().viewport_size.to_hash.each_pair do |k, v|
|
218
|
+
Scoutui::Logger::LogMgr.instance.debug " o " + k.to_s + " : " + v.to_s
|
219
|
+
end
|
220
|
+
|
124
221
|
Testmgr::TestReport.instance.getReq("EYES").testcase('Images').add(@testResults.steps.to_i > 0, "Verify at least 1 shot taken (#{@testResults.steps.to_s} shots)")
|
125
222
|
Testmgr::TestReport.instance.getReq("EYES").testcase('Images').add(@testResults.missing.to_i==0, "Verify Eyes did not miss any screens (#{@testResults.missing.to_s} screens)")
|
126
223
|
|
@@ -129,7 +226,7 @@ module Scoutui::Eyes
|
|
129
226
|
if ENV.has_key?('APPLITOOLS_VIEW_KEY') && !_diffdir.nil?
|
130
227
|
|
131
228
|
if Dir.exists?(_diffdir)
|
132
|
-
|
229
|
+
Legacy_saveDiffs(eyes(), @testResults, _diffdir, ENV['APPLITOOLS_VIEW_KEY'])
|
133
230
|
else
|
134
231
|
Scoutui::Logger::LogMgr.instance.warn " Specified Visual Diff folder does not exist - #{_diffdir.to_s}. Unable to download diffs"
|
135
232
|
end
|
data/lib/scoutui/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.16.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Kim
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-06-
|
12
|
+
date: 2016-06-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -219,6 +219,7 @@ files:
|
|
219
219
|
- examples/ex2/tests/test-example2.sh
|
220
220
|
- examples/ex2/tests/test-example3.sauce.sh
|
221
221
|
- examples/ex2/tests/test-example3.sh
|
222
|
+
- examples/eyes/ex2.rb
|
222
223
|
- examples/eyes_results/response.json
|
223
224
|
- lib/scoutui.rb
|
224
225
|
- lib/scoutui/appmodel/q_model.rb
|