eyes_core 3.15.48 → 3.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/applitools/appium/eyes.rb +4 -1
- data/lib/applitools/calabash/eyes.rb +4 -4
- data/lib/applitools/connectivity/server_connector.rb +49 -3
- data/lib/applitools/core/classic_runner.rb +4 -0
- data/lib/applitools/core/eyes_base.rb +12 -2
- data/lib/applitools/core/eyes_base_configuration.rb +2 -1
- data/lib/applitools/core/rendering_info.rb +26 -0
- data/lib/applitools/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7c8b1c4252bdea87951ac2bf9139c9271d2e673974f13edce49faa0d942e5101
|
|
4
|
+
data.tar.gz: 7b2c2ebe51fad932e0b391c6b892bbd378cc6c9795d3271eb6a1d68d7c63132c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 255a174ae78081297d821772d7601016e0b66b2b1f6de1f6ae162e269cf6001dd22d5497d16b0ae98f71788693e69bb73bdc0502d067ad8aa2823196336259ca
|
|
7
|
+
data.tar.gz: 1b1c4126c15b94f498c4807c3b0f96a56a258311da4f898b014dc119b59d2c39f20df5b4974be512f194951615a9d03a483f88ccb08d8d273fb2e90cb54db657
|
|
@@ -9,6 +9,7 @@ class Applitools::Appium::Eyes < Applitools::Selenium::Eyes
|
|
|
9
9
|
def initialize(*args)
|
|
10
10
|
super
|
|
11
11
|
self.dont_get_title = true
|
|
12
|
+
self.runner = Applitools::ClassicRunner.new
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
private :perform_driver_settings_for_appium_driver
|
|
@@ -59,7 +60,7 @@ class Applitools::Appium::Eyes < Applitools::Selenium::Eyes
|
|
|
59
60
|
end
|
|
60
61
|
|
|
61
62
|
def get_app_output_with_screenshot(*args)
|
|
62
|
-
super do |screenshot|
|
|
63
|
+
result = super do |screenshot|
|
|
63
64
|
if scale_provider
|
|
64
65
|
scaled_image = scale_provider.scale_image(screenshot.image)
|
|
65
66
|
self.screenshot = Applitools::Appium::Screenshot.new(
|
|
@@ -76,6 +77,8 @@ class Applitools::Appium::Eyes < Applitools::Selenium::Eyes
|
|
|
76
77
|
)
|
|
77
78
|
end
|
|
78
79
|
end
|
|
80
|
+
self.screenshot_url = nil
|
|
81
|
+
result
|
|
79
82
|
end
|
|
80
83
|
|
|
81
84
|
def dom_data
|
|
@@ -9,6 +9,7 @@ module Applitools
|
|
|
9
9
|
|
|
10
10
|
def initialize(server_url = Applitools::Connectivity::ServerConnector::DEFAULT_SERVER_URL)
|
|
11
11
|
super
|
|
12
|
+
self.runner = Applitools::ClassicRunner.new
|
|
12
13
|
self.base_agent_id = "eyes.calabash.ruby/#{Applitools::VERSION}".freeze
|
|
13
14
|
self.debug_screenshots = false
|
|
14
15
|
self.debug_screenshot_provider = Applitools::DebugScreenshotProvider.new
|
|
@@ -103,10 +104,9 @@ module Applitools
|
|
|
103
104
|
end
|
|
104
105
|
|
|
105
106
|
def get_app_output_with_screenshot(*args)
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
super(*args, &:scale_it!)
|
|
107
|
+
result = super(*args, &:scale_it!)
|
|
108
|
+
self.screenshot_url = nil
|
|
109
|
+
result
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
def entire_screenshot_region
|
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
require 'faraday'
|
|
4
4
|
require 'oj'
|
|
5
|
+
require 'securerandom'
|
|
6
|
+
|
|
5
7
|
Oj.default_options = { :mode => :compat }
|
|
6
8
|
|
|
7
9
|
require 'uri'
|
|
8
10
|
|
|
9
11
|
module Applitools::Connectivity
|
|
10
12
|
class ServerConnector
|
|
13
|
+
class ScreenshotUploadError < Applitools::EyesError; end
|
|
11
14
|
extend Applitools::Helpers
|
|
12
|
-
DEFAULT_SERVER_URL = 'https://eyesapi.applitools.com
|
|
15
|
+
DEFAULT_SERVER_URL = 'https://eyesapi.applitools.com'.freeze
|
|
13
16
|
|
|
14
17
|
SSL_CERT = File.join(File.dirname(File.expand_path(__FILE__)), '../../../certs/cacert.pem').to_s.freeze
|
|
15
18
|
DEFAULT_TIMEOUT = 300
|
|
@@ -65,6 +68,42 @@ module Applitools::Connectivity
|
|
|
65
68
|
Oj.load response.body
|
|
66
69
|
end
|
|
67
70
|
|
|
71
|
+
def put_screenshot(rendering_info, screenshot)
|
|
72
|
+
uuid = SecureRandom.uuid
|
|
73
|
+
upload_path = URI.parse(rendering_info.results_url.gsub(/__random__/, uuid))
|
|
74
|
+
retry_count = 3
|
|
75
|
+
wait = 0.5
|
|
76
|
+
loop do
|
|
77
|
+
raise ScreenshotUploadError, "Error uploading screenshot (#{upload_path})" if retry_count <= 0
|
|
78
|
+
Applitools::EyesLogger.info("Trying to upload screenshot (#{upload_path})...")
|
|
79
|
+
begin
|
|
80
|
+
response = dummy_put(
|
|
81
|
+
upload_path,
|
|
82
|
+
body: screenshot.image.to_blob,
|
|
83
|
+
headers: {
|
|
84
|
+
'x-ms-blob-type': 'BlockBlob',
|
|
85
|
+
'X-Auth-Token': rendering_info.access_token
|
|
86
|
+
},
|
|
87
|
+
query: URI.decode_www_form(upload_path.query).to_h,
|
|
88
|
+
content_type: 'image/png'
|
|
89
|
+
)
|
|
90
|
+
break if response.status == HTTP_STATUS_CODES[:created]
|
|
91
|
+
Applitools::EyesLogger.info("Failed. Retrying in #{wait} seconds")
|
|
92
|
+
sleep(wait)
|
|
93
|
+
rescue StandardError => e
|
|
94
|
+
Applitools::EyesLogger.error(e.class.to_s)
|
|
95
|
+
Applitools::EyesLogger.error(e.message)
|
|
96
|
+
Applitools::EyesLogger.info("Failed. Retrying in #{wait} seconds")
|
|
97
|
+
sleep(wait)
|
|
98
|
+
ensure
|
|
99
|
+
retry_count -= 1
|
|
100
|
+
wait *= 2
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
Applitools::EyesLogger.info('Done.')
|
|
104
|
+
upload_path.to_s
|
|
105
|
+
end
|
|
106
|
+
|
|
68
107
|
def render_put_resource(service_url, access_key, resource, render)
|
|
69
108
|
uri = URI(service_url)
|
|
70
109
|
uri.path = RESOURCES_SHA_256 + resource.hash
|
|
@@ -165,10 +204,17 @@ module Applitools::Connectivity
|
|
|
165
204
|
def match_window(session, data)
|
|
166
205
|
# Notice that this does not include the screenshot.
|
|
167
206
|
json_data = Oj.dump(Applitools::Utils.camelcase_hash_keys(data.to_hash)).force_encoding('BINARY')
|
|
168
|
-
body =
|
|
207
|
+
body = if data.screenshot.empty?
|
|
208
|
+
content_type = 'application/json'
|
|
209
|
+
json_data
|
|
210
|
+
else
|
|
211
|
+
content_type = 'application/octet-stream'
|
|
212
|
+
[json_data.length].pack('L>') + json_data + data.screenshot
|
|
213
|
+
end
|
|
214
|
+
|
|
169
215
|
Applitools::EyesLogger.debug 'Sending match data...'
|
|
170
216
|
Applitools::EyesLogger.debug json_data
|
|
171
|
-
res = long_post(URI.join(endpoint_url, session.id.to_s), content_type:
|
|
217
|
+
res = long_post(URI.join(endpoint_url, session.id.to_s), content_type: content_type, body: body)
|
|
172
218
|
raise Applitools::EyesError.new("Request failed: #{res.status} #{res.headers}") unless res.success?
|
|
173
219
|
# puts Oj.load(res.body)
|
|
174
220
|
Applitools::MatchResult.new Oj.load(res.body)
|
|
@@ -47,7 +47,7 @@ module Applitools
|
|
|
47
47
|
:match_timeout, :save_new_tests, :save_failed_tests, :failure_reports, :default_match_settings, :cut_provider,
|
|
48
48
|
:scale_ratio, :position_provider, :viewport_size, :verbose_results,
|
|
49
49
|
:inferred_environment, :remove_session_if_matching, :server_scale, :server_remainder, :exact,
|
|
50
|
-
:compare_with_parent_branch, :results, :runner
|
|
50
|
+
:compare_with_parent_branch, :results, :runner, :allow_empty_screenshot, :screenshot_url
|
|
51
51
|
|
|
52
52
|
abstract_attr_accessor :base_agent_id
|
|
53
53
|
abstract_method :capture_screenshot, true
|
|
@@ -82,6 +82,7 @@ module Applitools
|
|
|
82
82
|
self.verbose_results = false
|
|
83
83
|
self.failed = false
|
|
84
84
|
self.results = []
|
|
85
|
+
self.allow_empty_screenshot = true
|
|
85
86
|
@inferred_environment = nil
|
|
86
87
|
@properties = []
|
|
87
88
|
@server_scale = 0
|
|
@@ -650,6 +651,14 @@ module Applitools
|
|
|
650
651
|
|
|
651
652
|
screenshot = yield(screenshot) if block_given?
|
|
652
653
|
|
|
654
|
+
if screenshot
|
|
655
|
+
self.screenshot_url = server_connector.put_screenshot(
|
|
656
|
+
runner.rendering_info(server_connector),
|
|
657
|
+
screenshot
|
|
658
|
+
)
|
|
659
|
+
screenshot = nil
|
|
660
|
+
end
|
|
661
|
+
|
|
653
662
|
logger.info 'Getting title...'
|
|
654
663
|
a_title = title
|
|
655
664
|
logger.info 'Done!'
|
|
@@ -659,7 +668,8 @@ module Applitools
|
|
|
659
668
|
o.dom_url = dom_url unless dom_url && dom_url.empty?
|
|
660
669
|
o.screenshot_url = screenshot_url if respond_to?(:screenshot_url) && !screenshot_url.nil?
|
|
661
670
|
end,
|
|
662
|
-
screenshot
|
|
671
|
+
screenshot,
|
|
672
|
+
allow_empty_screenshot
|
|
663
673
|
)
|
|
664
674
|
end
|
|
665
675
|
|
|
@@ -6,6 +6,7 @@ require 'applitools/core/batch_info'
|
|
|
6
6
|
require 'applitools/connectivity/proxy'
|
|
7
7
|
require 'applitools/core/match_level'
|
|
8
8
|
require 'applitools/core/match_level_setter'
|
|
9
|
+
require 'applitools/connectivity/server_connector'
|
|
9
10
|
|
|
10
11
|
module Applitools
|
|
11
12
|
class EyesBaseConfiguration < AbstractConfiguration
|
|
@@ -17,7 +18,7 @@ module Applitools
|
|
|
17
18
|
baseline_branch_name: ENV['APPLITOOLS_BASELINE_BRANCH'] || '',
|
|
18
19
|
save_diffs: false,
|
|
19
20
|
server_url: ENV['APPLITOOLS_SERVER_URL'] ||
|
|
20
|
-
ENV['bamboo_APPLITOOLS_SERVER_URL'] ||
|
|
21
|
+
ENV['bamboo_APPLITOOLS_SERVER_URL'] || Applitools::Connectivity::ServerConnector::DEFAULT_SERVER_URL,
|
|
21
22
|
api_key: ENV['APPLITOOLS_API_KEY'] || ENV['bamboo_APPLITOOLS_API_KEY'] || '',
|
|
22
23
|
match_level: Applitools::MatchLevel::STRICT,
|
|
23
24
|
scale: 0,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Applitools
|
|
2
|
+
class RenderingInfo
|
|
3
|
+
attr_accessor :response
|
|
4
|
+
def initialize(response)
|
|
5
|
+
Applitools::ArgumentGuard.not_nil(response, 'response')
|
|
6
|
+
Applitools::ArgumentGuard.hash(response, 'response')
|
|
7
|
+
self.response = response
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def service_url
|
|
11
|
+
response['serviceUrl']
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def results_url
|
|
15
|
+
response['resultsUrl']
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def stitching_service_url
|
|
19
|
+
response['stitchingServiceUrl']
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def access_token
|
|
23
|
+
response['accessToken']
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
data/lib/applitools/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: eyes_core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.16.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Applitools Team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-01-
|
|
11
|
+
date: 2020-01-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: oily_png
|
|
@@ -297,6 +297,7 @@ files:
|
|
|
297
297
|
- lib/applitools/core/rectangle_size.rb
|
|
298
298
|
- lib/applitools/core/region.rb
|
|
299
299
|
- lib/applitools/core/region_provider.rb
|
|
300
|
+
- lib/applitools/core/rendering_info.rb
|
|
300
301
|
- lib/applitools/core/screenshot.rb
|
|
301
302
|
- lib/applitools/core/session.rb
|
|
302
303
|
- lib/applitools/core/session_start_info.rb
|