eyes_core 3.16.6 → 3.16.7

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: 24805d46d94b91197c0673638ca055d92474533cf314d307bd14eabee94a00ed
4
- data.tar.gz: '038378742f8fe1d8936f4791d36df3ff91de1fb8e549402e4cb212ce0e629914'
3
+ metadata.gz: 5cf31bf1fdae6c75e1517e0db4839a6d0331fc4afd3a5d86fc01299a8e84bd53
4
+ data.tar.gz: 1a001a48cf3a381e02855554d7b959e618877a0644c8135059bd9e27feb3836c
5
5
  SHA512:
6
- metadata.gz: eaeaeb4f48a2ffe3cd0a773771fa124aae14ed2d0b51bf90f549db169e8d51386b5de9ade2b068b0f59eb7cb715b56580d47d87c822ea30a1c6a318d1b06a39e
7
- data.tar.gz: c9cd0e30967c16b757917218c2f5faf439155751a94f5f920d45af1bf4b2dd71f42077e89dc542fcf71d907cf6febf76da6b0b5be75861bf4c46a5568dd874f4
6
+ metadata.gz: 2c37a84a9a9c967d7282bb1ed8c8491cf134d961708fb7f4ad9b15004c1d932ec2d169276fae359097435e03f6a87465c7962293560cf348ea4de3cb0e7642d4
7
+ data.tar.gz: a8a3a376b24994573285ec88d1c789e08c1e3a3b6b106ebc9f595315f300edd482e97aa5c4eb05d5fef0f7aae8b2b1ebcf9b41bf21f03ef3d4a599cc15ece583
@@ -68,23 +68,31 @@ module Applitools::Connectivity
68
68
  end
69
69
 
70
70
  def put_screenshot(rendering_info, screenshot)
71
+ put_data(rendering_info, screenshot.image.to_blob, 'image/png', 'screenshot')
72
+ end
73
+
74
+ def put_dom(rendering_info, dom_data)
75
+ put_data(rendering_info, dom_data, 'application/octet-stream', 'dom data')
76
+ end
77
+
78
+ def put_data(rendering_info, data, content_type, log_message_entity)
71
79
  uuid = SecureRandom.uuid
72
80
  upload_path = URI.parse(rendering_info.results_url.gsub(/__random__/, uuid))
73
81
  retry_count = 3
74
82
  wait = 0.5
75
83
  loop do
76
- raise ScreenshotUploadError, "Error uploading screenshot (#{upload_path})" if retry_count <= 0
77
- Applitools::EyesLogger.info("Trying to upload screenshot (#{upload_path})...")
84
+ raise ScreenshotUploadError, "Error uploading #{log_message_entity} (#{upload_path})" if retry_count <= 0
85
+ Applitools::EyesLogger.info("Trying to upload #{log_message_entity} (#{upload_path})...")
78
86
  begin
79
87
  response = dummy_put(
80
88
  upload_path,
81
- body: screenshot.image.to_blob,
89
+ body: data,
82
90
  headers: {
83
91
  'x-ms-blob-type': 'BlockBlob',
84
92
  'X-Auth-Token': rendering_info.access_token
85
93
  },
86
94
  query: URI.decode_www_form(upload_path.query).to_h,
87
- content_type: 'image/png'
95
+ content_type: content_type
88
96
  )
89
97
  break if response.status == HTTP_STATUS_CODES[:created]
90
98
  Applitools::EyesLogger.info("Failed. Retrying in #{wait} seconds")
@@ -279,23 +287,14 @@ module Applitools::Connectivity
279
287
  Applitools::TestResults.new(response)
280
288
  end
281
289
 
282
- def post_dom_json(dom_data)
290
+ def post_dom_json(dom_data, rendering_info)
283
291
  Applitools::EyesLogger.debug 'About to send captured DOM...'
284
- # request_body = Oj.dump(dom_data)
285
292
  request_body = dom_data
286
293
  Applitools::EyesLogger.debug request_body
287
294
  processed_request_body = yield(request_body) if block_given?
288
- res = post(
289
- endpoint_url + 'data',
290
- body: processed_request_body.nil? ? request_body : processed_request_body,
291
- content_type: 'application/octet-stream'
292
- )
293
-
295
+ location = put_dom(rendering_info, processed_request_body)
294
296
  Applitools::EyesLogger.debug 'Done!'
295
- raise Applitools::EyesError.new("Request failed: #{res.status} #{res.body}") unless res.success?
296
- Applitools::EyesLogger.debug 'Server response headers:'
297
- Applitools::EyesLogger.debug res.headers.inspect
298
- res.headers['location']
297
+ location
299
298
  end
300
299
 
301
300
  private
@@ -618,7 +618,7 @@ module Applitools
618
618
  unless captured_dom_data.empty?
619
619
  begin
620
620
  logger.info 'Processing DOM..'
621
- dom_url = server_connector.post_dom_json(captured_dom_data) do |json|
621
+ dom_url = server_connector.post_dom_json(captured_dom_data, runner.rendering_info(server_connector)) do |json|
622
622
  io = StringIO.new
623
623
  gz = Zlib::GzipWriter.new(io)
624
624
  gz.write(json.encode('UTF-8'))
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Applitools
4
- VERSION = '3.16.6'.freeze
4
+ VERSION = '3.16.7'.freeze
5
5
  end
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.6
4
+ version: 3.16.7
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-05 00:00:00.000000000 Z
11
+ date: 2020-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oily_png