eyes_core 3.16.9 → 3.16.10
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/connectivity/server_connector.rb +23 -22
- data/lib/applitools/core/future.rb +6 -1
- data/lib/applitools/version.rb +1 -1
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c75ae72ac98e660835958999ba3ae252c959f3909dac96fd155ff16929b0b1b4
|
4
|
+
data.tar.gz: fc5ebaf6841c6f7603b2f0f304758c94ba525c4396af3d0cdc8ea8afb235ebbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4ffe23703a591f0559d083e3392625c8aac6f75588b55305e2fff06db14779a289ddfb231812f3d1edda1d11c342892635b483d549f0270f2a759dd8eedfe91
|
7
|
+
data.tar.gz: 5e5c5e0e773e38108b13c60aed7632d3daca1b111d2d9d853e7a4aa06024897922abcdc02235e781a39ca6effb28cbf8f61490f01d550c01af98496962ea7d7a
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
3
|
require 'faraday'
|
4
|
+
require 'faraday_middleware'
|
5
|
+
require 'faraday-cookie_jar'
|
4
6
|
require 'oj'
|
5
7
|
require 'securerandom'
|
6
8
|
|
@@ -10,6 +12,10 @@ require 'uri'
|
|
10
12
|
|
11
13
|
module Applitools::Connectivity
|
12
14
|
class ServerConnector
|
15
|
+
class << self
|
16
|
+
attr_accessor :faraday_adapter, :connection_timeout
|
17
|
+
end
|
18
|
+
self.faraday_adapter = :net_http
|
13
19
|
class ScreenshotUploadError < Applitools::EyesError; end
|
14
20
|
extend Applitools::Helpers
|
15
21
|
DEFAULT_SERVER_URL = 'https://eyesapi.applitools.com'.freeze
|
@@ -153,23 +159,14 @@ module Applitools::Connectivity
|
|
153
159
|
def download_resource(url, ua_string = nil)
|
154
160
|
Applitools::EyesLogger.debug "Fetching #{url}..."
|
155
161
|
resp_proc = proc do |u|
|
156
|
-
|
157
|
-
|
158
|
-
ssl: { ca_file: SSL_CERT },
|
159
|
-
proxy: @proxy.nil? ? nil : @proxy.to_hash
|
160
|
-
).send(:get) do |req|
|
161
|
-
req.options.timeout = DEFAULT_TIMEOUT
|
162
|
+
faraday_connection(u).send(:get) do |req|
|
163
|
+
req.options.timeout = self.class.connection_timeout || DEFAULT_TIMEOUT
|
162
164
|
req.headers[:accept_encoding] = 'identity'
|
163
|
-
req.headers[:accept_language] = '
|
165
|
+
req.headers[:accept_language] = '*'
|
164
166
|
req.headers[:user_agent] = ua_string if ua_string
|
165
167
|
end
|
166
168
|
end
|
167
169
|
response = resp_proc.call(url)
|
168
|
-
redirect_count = 10
|
169
|
-
while response.status == 301 && redirect_count > 0
|
170
|
-
redirect_count -= 1
|
171
|
-
response = resp_proc.call(response.headers['location'])
|
172
|
-
end
|
173
170
|
Applitools::EyesLogger.debug "Done. (#{url} #{response.status})"
|
174
171
|
response
|
175
172
|
end
|
@@ -300,6 +297,18 @@ module Applitools::Connectivity
|
|
300
297
|
|
301
298
|
private
|
302
299
|
|
300
|
+
def faraday_connection(url)
|
301
|
+
Faraday.new(
|
302
|
+
url: url,
|
303
|
+
ssl: { ca_file: SSL_CERT },
|
304
|
+
proxy: @proxy.nil? ? nil : @proxy.to_hash
|
305
|
+
) do |faraday|
|
306
|
+
faraday.use FaradayMiddleware::FollowRedirects
|
307
|
+
faraday.use :cookie_jar
|
308
|
+
faraday.adapter self.class.faraday_adapter
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
303
312
|
DEFAULT_HEADERS = {
|
304
313
|
'Accept' => 'application/json',
|
305
314
|
'Content-Type' => 'application/json'
|
@@ -338,11 +347,7 @@ module Applitools::Connectivity
|
|
338
347
|
|
339
348
|
def request(url, method, options = {})
|
340
349
|
Applitools::EyesLogger.debug("Requesting #{url} (method: #{method})")
|
341
|
-
response =
|
342
|
-
url,
|
343
|
-
ssl: { ca_file: SSL_CERT },
|
344
|
-
proxy: @proxy.nil? ? nil : @proxy.to_hash
|
345
|
-
).send(method) do |req|
|
350
|
+
response = faraday_connection(url).send(method) do |req|
|
346
351
|
req.options.timeout = DEFAULT_TIMEOUT
|
347
352
|
req.headers = DEFAULT_HEADERS.merge(options[:headers] || {})
|
348
353
|
req.headers['Content-Type'] = options[:content_type] if options.key?(:content_type)
|
@@ -354,11 +359,7 @@ module Applitools::Connectivity
|
|
354
359
|
end
|
355
360
|
|
356
361
|
def dummy_request(url, method, options = {})
|
357
|
-
|
358
|
-
url,
|
359
|
-
ssl: { ca_file: SSL_CERT },
|
360
|
-
proxy: @proxy.nil? ? nil : @proxy.to_hash
|
361
|
-
).send(method) do |req|
|
362
|
+
faraday_connection(url).send(method) do |req|
|
362
363
|
req.options.timeout = options[:timeout] || DEFAULT_TIMEOUT
|
363
364
|
req.headers = DEFAULT_HEADERS.merge(options[:headers] || {})
|
364
365
|
req.headers['Content-Type'] = options[:content_type] if options.key?(:content_type)
|
@@ -3,6 +3,11 @@
|
|
3
3
|
module Applitools
|
4
4
|
class Future
|
5
5
|
attr_accessor :result, :semaphore, :block, :thread, :description
|
6
|
+
DEFAULT_TIMEOUT = 350
|
7
|
+
class << self
|
8
|
+
attr_accessor :timeout
|
9
|
+
end
|
10
|
+
self.timeout = DEFAULT_TIMEOUT
|
6
11
|
|
7
12
|
def initialize(semaphore, description = nil, &block)
|
8
13
|
raise Applitools::EyesIllegalArgument, 'Applitools::Future must be initialized with a block' unless block_given?
|
@@ -21,7 +26,7 @@ module Applitools
|
|
21
26
|
end
|
22
27
|
|
23
28
|
def get
|
24
|
-
thread.join(
|
29
|
+
thread.join(self.class.timeout)
|
25
30
|
raise Applitools::EyesError, "Failed to execute future - got nil result! (#{description})" if result.nil?
|
26
31
|
result
|
27
32
|
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.16.
|
4
|
+
version: 3.16.10
|
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-03-
|
11
|
+
date: 2020-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oily_png
|
@@ -52,6 +52,34 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: faraday_middleware
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: faraday-cookie_jar
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: oj
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|