eyes_core 3.16.12 → 3.16.13
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fec9e08863b0523e81a22dc9ca814594c1807af15103cd33d3ae5fdd920f6ff
|
4
|
+
data.tar.gz: cd99b6053547f98d71919530ad7863ef2defaac8fd7ea829f64fecf5e4732ad7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 917324723274f093a3806993011e5baf127b57c54500265d0317f7419fa3247a2a8bb1cf50a9ef1fc52269ea08f42d9bdced2ba8a714e90879ce890148fa97ac
|
7
|
+
data.tar.gz: 99e9601adee40be269992a387c727dc91b12c0a3e6bd23d9b619a8c35cd5b5db7c34ccc019d2936576bba21e9524c3af2b0b3952cd68f059a612ca97b566c077
|
@@ -43,12 +43,23 @@ module Applitools::Connectivity
|
|
43
43
|
attr_accessor :server_url
|
44
44
|
attr_reader :endpoint_url
|
45
45
|
attr_reader :proxy
|
46
|
+
attr_reader :agent_id_proc
|
46
47
|
environment_attribute :api_key, 'APPLITOOLS_API_KEY'
|
47
48
|
|
48
49
|
def initialize(url = nil)
|
49
50
|
self.server_url = url
|
50
51
|
end
|
51
52
|
|
53
|
+
def obtain_agent_id(&block)
|
54
|
+
@agent_id_proc = block if block_given?
|
55
|
+
end
|
56
|
+
|
57
|
+
def agent_id
|
58
|
+
return agent_id_proc.call if agent_id_proc
|
59
|
+
Applitools::EyesLogger.error('The agent id is not set!')
|
60
|
+
"eyes.sdk.ruby/#{Applitools::VERSION}"
|
61
|
+
end
|
62
|
+
|
52
63
|
def rendering_info
|
53
64
|
response = long_get(URI.join(server_url, RENDER_INFO_PATH), content_type: 'application/json')
|
54
65
|
unless response.status == HTTP_STATUS_CODES[:ok]
|
@@ -159,7 +170,7 @@ module Applitools::Connectivity
|
|
159
170
|
def download_resource(url, ua_string = nil)
|
160
171
|
Applitools::EyesLogger.debug "Fetching #{url}..."
|
161
172
|
resp_proc = proc do |u|
|
162
|
-
faraday_connection(u).send(:get) do |req|
|
173
|
+
faraday_connection(u, false).send(:get) do |req|
|
163
174
|
req.options.timeout = self.class.connection_timeout || DEFAULT_TIMEOUT
|
164
175
|
req.headers[:accept_encoding] = 'identity'
|
165
176
|
req.headers[:accept_language] = '*'
|
@@ -185,7 +196,10 @@ module Applitools::Connectivity
|
|
185
196
|
end
|
186
197
|
|
187
198
|
def server_url=(url)
|
188
|
-
|
199
|
+
if url
|
200
|
+
uri = URI.parse(url)
|
201
|
+
url = "#{uri.scheme}://#{uri.hostname}".freeze
|
202
|
+
end
|
189
203
|
@server_url = url.nil? ? DEFAULT_SERVER_URL : url
|
190
204
|
unless @server_url.is_a? String
|
191
205
|
raise Applitools::EyesIllegalArgument.new 'You should pass server url as a String!' \
|
@@ -297,12 +311,19 @@ module Applitools::Connectivity
|
|
297
311
|
|
298
312
|
private
|
299
313
|
|
300
|
-
def faraday_connection(url)
|
314
|
+
def faraday_connection(url, pass_user_agent_header = true)
|
301
315
|
Faraday.new(
|
302
316
|
url: url,
|
303
317
|
ssl: { ca_file: SSL_CERT },
|
304
318
|
proxy: @proxy.nil? ? nil : @proxy.to_hash
|
305
319
|
) do |faraday|
|
320
|
+
if pass_user_agent_header
|
321
|
+
faraday.use(
|
322
|
+
Applitools::Connectivity::UserAgentMiddleware,
|
323
|
+
get_user_agent: @agent_id_proc,
|
324
|
+
get_server_url: proc { server_url }
|
325
|
+
)
|
326
|
+
end
|
306
327
|
faraday.use FaradayMiddleware::FollowRedirects
|
307
328
|
faraday.use :cookie_jar
|
308
329
|
faraday.adapter self.class.faraday_adapter
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Applitools::Connectivity
|
2
|
+
class UserAgentMiddleware
|
3
|
+
attr_accessor :app, :get_user_id_proc, :server_url_proc
|
4
|
+
def initialize(app, params)
|
5
|
+
self.app = app
|
6
|
+
self.get_user_id_proc = params[:get_user_agent]
|
7
|
+
self.server_url_proc = params[:get_server_url]
|
8
|
+
end
|
9
|
+
|
10
|
+
def call(env)
|
11
|
+
# server_url = URI.parse(server_url_proc.call)
|
12
|
+
env.request_headers['x-applitools-eyes-client'] = obtain_user_id
|
13
|
+
@app.call(env)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def obtain_user_id
|
19
|
+
return get_user_id_proc.call if get_user_id_proc.is_a?(Proc)
|
20
|
+
Applitools::EyesLogger.error('The user ID was not set!')
|
21
|
+
"eyes.sdk.ruby/#{Applitools::VERSION}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -66,6 +66,9 @@ module Applitools
|
|
66
66
|
self.runner = options[:runner]
|
67
67
|
server_url = args.first
|
68
68
|
@server_connector = Applitools::Connectivity::ServerConnector.new(server_url)
|
69
|
+
@server_connector.obtain_agent_id do
|
70
|
+
full_agent_id
|
71
|
+
end
|
69
72
|
ensure_config
|
70
73
|
self.server_url = server_url if server_url
|
71
74
|
self.disabled = false
|
@@ -108,6 +108,7 @@ module Applitools
|
|
108
108
|
object_field :default_match_settings, Applitools::ImageMatchSettings
|
109
109
|
int_field :scale
|
110
110
|
int_field :remainder
|
111
|
+
boolean_field :ignore_caret
|
111
112
|
|
112
113
|
methods_to_delegate.delete(:batch_info)
|
113
114
|
methods_to_delegate.delete(:batch_info=)
|
@@ -152,6 +153,14 @@ module Applitools
|
|
152
153
|
default_match_settings.match_level
|
153
154
|
end
|
154
155
|
|
156
|
+
def custom_getter_for_ignore_caret(_value)
|
157
|
+
default_match_settings.ignore_caret
|
158
|
+
end
|
159
|
+
|
160
|
+
def custom_setter_for_ignore_caret(value)
|
161
|
+
default_match_settings.ignore_caret = value
|
162
|
+
end
|
163
|
+
|
155
164
|
methods_to_delegate.push(:set_proxy)
|
156
165
|
end
|
157
166
|
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.13
|
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-
|
11
|
+
date: 2020-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oily_png
|
@@ -285,6 +285,7 @@ files:
|
|
285
285
|
- lib/applitools/chunky_png_patch.rb
|
286
286
|
- lib/applitools/connectivity/proxy.rb
|
287
287
|
- lib/applitools/connectivity/server_connector.rb
|
288
|
+
- lib/applitools/connectivity/user_agent_middleware.rb
|
288
289
|
- lib/applitools/core/abstract_configuration.rb
|
289
290
|
- lib/applitools/core/abstract_region.rb
|
290
291
|
- lib/applitools/core/accessibility_level.rb
|