eyes_core 3.2.2 → 3.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64f8c3db87db9835c4dc79c765959e83c8aeb946
4
- data.tar.gz: 7d727cecee7d09a6a9fe4f835bcbb4adab06c5f4
3
+ metadata.gz: e7e9bc76bd9015774835b3ff69d84a0a99a72c26
4
+ data.tar.gz: 88068cae26e46a091931f6ca3a85cd30e34a4a28
5
5
  SHA512:
6
- metadata.gz: '018bbc1ef29fa85b6bf41e4265926372dc04cfb27bc1afcdd71655ce495c2707736f713ceffe774b670282e1b1551c10e54d879eb5a6776e526d881590b8a69c'
7
- data.tar.gz: 46a71295b6d39855ee931165c4eb804dcee4c5d8c0032ff6c1344c2f5e7ceea8c5dffd6be95b748171d347b1a20689e0c0cc5233f0ceb992f259c57d65436ad5
6
+ metadata.gz: 611499123fdc78d786155cc188a185ca7a8dcf9fb4f2a84551648e6658dd19cd92585134c0b67ade65ac0b2f12e14c98de77e1c6a746434b8eaaa5df3589678b
7
+ data.tar.gz: cefb39a916f17a2de86f80f5836f5979e7330f8afb0f2ce847cf72a5da3fa0c66370d99479cd859ff5ab5cfd67a1c09b446b5c1d53f9279113e9f9c1140c75e0
@@ -49,16 +49,17 @@ module Applitools::Connectivity
49
49
  # Notice that this does not include the screenshot.
50
50
  json_data = Oj.dump(Applitools::Utils.camelcase_hash_keys(data.to_hash)).force_encoding('BINARY')
51
51
  body = [json_data.length].pack('L>') + json_data + data.screenshot
52
+ #Applitools::EyesLogger.debug json_data
52
53
  Applitools::EyesLogger.debug 'Sending match data...'
53
54
  res = post(URI.join(endpoint_url, session.id.to_s), content_type: 'application/octet-stream', body: body)
54
- raise Applitools::EyesError.new("Request failed: #{res.status}") unless res.success?
55
+ raise Applitools::EyesError.new("Request failed: #{res.status} #{res.headers}") unless res.success?
55
56
  Applitools::MatchResult.new Oj.load(res.body)
56
57
  end
57
58
 
58
59
  def start_session(session_start_info)
59
60
  res = post(endpoint_url, body: Oj.dump(startInfo:
60
61
  Applitools::Utils.camelcase_hash_keys(session_start_info.to_hash)))
61
- raise Applitools::EyesError.new("Request failed: #{res.status}") unless res.success?
62
+ raise Applitools::EyesError.new("Request failed: #{res.status} #{res.body}") unless res.success?
62
63
 
63
64
  response = Oj.load(res.body)
64
65
  Applitools::Session.new(response['id'], response['url'], res.status == HTTP_STATUS_CODES[:created])
@@ -172,7 +172,7 @@ module Applitools
172
172
  raise e
173
173
  end
174
174
 
175
- def check_window_base(region_provider, tag, ignore_mismatch, retry_timeout)
175
+ def check_window_base(region_provider, tag, ignore_mismatch, retry_timeout, options = {})
176
176
  if disabled?
177
177
  logger.info "#{__method__} Ignored"
178
178
  result = Applitools::MatchResults.new
@@ -207,7 +207,9 @@ module Applitools
207
207
  tag: tag,
208
208
  should_match_window_run_once_on_timeout: should_match_window_run_once_on_timeout,
209
209
  ignore_mismatch: ignore_mismatch,
210
- retry_timeout: retry_timeout
210
+ retry_timeout: retry_timeout,
211
+ ignore: options[:ignore],
212
+ trim: options[:trim]
211
213
  )
212
214
  logger.info 'match_window done!'
213
215
 
@@ -19,7 +19,7 @@ module Applitools
19
19
  alias ignoreMismatch ignore_mismatch
20
20
 
21
21
  def to_hash
22
- ary = [:userInputs, :appOutput, :tag, :ignoreMismatch].map do |field|
22
+ ary = [:userInputs, :appOutput, :tag, :ignoreMismatch, :options].map do |field|
23
23
  result = send(field)
24
24
  result = result.to_hash if result.respond_to? :to_hash
25
25
  [field, result] if [String, Symbol, Hash, Array, FalseClass, TrueClass].include? result.class
@@ -6,6 +6,18 @@ module Applitools
6
6
 
7
7
  attr_reader :logger, :running_session, :default_retry_timeout, :app_output_provider
8
8
 
9
+ class << self
10
+ def convert_coordinates(regions, screenshot)
11
+ regions.map() do |r|
12
+ screenshot.convert_region_location(
13
+ Applitools::Region.from_location_size(r.location, r.size),
14
+ Applitools::EyesScreenshot::COORDINATE_TYPES[:context_relative],
15
+ Applitools::EyesScreenshot::COORDINATE_TYPES[:screenshot_as_is]
16
+ ).to_hash
17
+ end
18
+ end
19
+ end
20
+
9
21
  def initialize(logger, running_session, retry_timeout, app_output_provider)
10
22
  @logger = logger
11
23
  @running_session = running_session
@@ -31,6 +43,8 @@ module Applitools
31
43
  should_match_window_run_once_on_timeout = options[:should_match_window_run_once_on_timeout]
32
44
  ignore_mismatch = options[:ignore_mismatch]
33
45
  retry_timeout = options[:retry_timeout]
46
+ ignore = options[:ignore] || []
47
+ trim = options[:trim] || false
34
48
 
35
49
  retry_timeout = default_retry_timeout if retry_timeout < 0
36
50
 
@@ -41,24 +55,24 @@ module Applitools
41
55
  sleep retry_timeout if should_match_window_run_once_on_timeout
42
56
  app_output = app_output_provider.app_output region_provider, last_screenshot
43
57
  match_result = perform_match user_inputs: user_inputs, app_output: app_output, tag: tag,
44
- ignore_mismatch: ignore_mismatch
58
+ ignore_mismatch: ignore_mismatch, ignore: self.class.convert_coordinates(ignore, app_output.screenshot), trim: trim
45
59
  else
46
60
  app_output = app_output_provider.app_output region_provider, last_screenshot
47
61
  start = Time.now
48
- match_result = perform_match user_inputs: user_inputs, app_output: app_output, tag: tag, ignore_mismatch: true
62
+ match_result = perform_match user_inputs: user_inputs, app_output: app_output, tag: tag, ignore_mismatch: true, ignore: self.class.convert_coordinates(ignore, app_output.screenshot), trim: trim
49
63
  retry_time = Time.now - start
50
64
 
51
65
  while retry_time < retry_timeout && !match_result.as_expected?
52
66
  sleep MATCH_INTERVAL
53
67
  app_output = app_output_provider.app_output region_provider, last_screenshot
54
- match_result = perform_match user_inputs: user_inputs, app_output: app_output, tag: tag, ignore_mismatch: true
68
+ match_result = perform_match user_inputs: user_inputs, app_output: app_output, tag: tag, ignore_mismatch: true, ignore: self.class.convert_coordinates(ignore, app_output.screenshot), trim: trim
55
69
  retry_time = Time.now - start
56
70
  end
57
71
 
58
72
  unless match_result.as_expected?
59
73
  app_output = app_output_provider.app_output region_provider, last_screenshot
60
74
  match_result = perform_match user_inputs: user_inputs, app_output: app_output, tag: tag,
61
- ignore_mismatch: ignore_mismatch
75
+ ignore_mismatch: ignore_mismatch, ignore: self.class.convert_coordinates(ignore, app_output.screenshot), trim: trim
62
76
  end
63
77
  end
64
78
 
@@ -78,8 +92,14 @@ module Applitools
78
92
  tag = options[:tag]
79
93
  ignore_mismatch = options[:ignore_mismatch]
80
94
  data = Applitools::MatchWindowData.new user_inputs, app_output, tag, ignore_mismatch,
81
- tag: tag, user_inputs: user_inputs, ignore_mismatch: ignore_mismatch, ignore_match: false,
82
- force_mistmatch: false, force_match: false
95
+ tag: tag, user_inputs: user_inputs.to_hash, ignore_mismatch: ignore_mismatch, ignore_match: false,
96
+ force_mistmatch: false, force_match: false,
97
+ image_match_settings: {
98
+ ignore: options[:ignore]
99
+ },
100
+ trim: {
101
+ enabled: options[:trim]
102
+ }
83
103
  Applitools::Connectivity::ServerConnector.match_window running_session, data
84
104
  end
85
105
  end
@@ -1,3 +1,3 @@
1
1
  module Applitools
2
- VERSION = '3.2.2'.freeze
2
+ VERSION = '3.3.2'.freeze
3
3
  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.2.2
4
+ version: 3.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Applitools Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-24 00:00:00.000000000 Z
11
+ date: 2017-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oily_png