eyes_core 4.6.2 → 5.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d81e1db8334cf38806b35937b27a6934f3515de5086621cc5db07d7d340a416
4
- data.tar.gz: 588013b897e6812e3c00ef27de1efae4955dddb49c3b414891611e20262754d3
3
+ metadata.gz: 427cc6b949eee41b5d27bd6035ab8f45f3e07ab9a223135610abb6686b0dc033
4
+ data.tar.gz: dbfea6d80382744eb6b11d73c3af6efaae394c548cd5f40ad1d881496dcb2783
5
5
  SHA512:
6
- metadata.gz: 704e8432ccb8b928b9d1c4993adcb33403064cc83212e4422e7d58a1e749817013fd981091752e7d3c689314e4c2fee926a3e103f090fb98f1d11963ff6b7fc7
7
- data.tar.gz: e8f4dd78f0737dda84bab00239dc7c29d8837338bfcffea7c990cd7faf1b307b0fd3cef8515d67ee5b14f3dea8312c0d12782f4fe3f2881fb909a01f4030ddd8
6
+ metadata.gz: b95422b1a161eac1d25d3d5a6832f7c0adfb5a6c486f677ce846e8b892834f5b6cfbb65343eeaaebb9de6bfb04bd30772a5f5aa3bc058232049defdad1091ed4
7
+ data.tar.gz: 30f0a30d3828167b092b9139382232be8e75ca27df58a4942da49a2c64f93efe65a6fdd42b3b145c7b081113f432866fe3d73e5031ba9e4a6c3893c058708127
@@ -120,6 +120,41 @@ class Applitools::Appium::Eyes < Applitools::Selenium::SeleniumEyes
120
120
  check(options[:tag], target)
121
121
  end
122
122
 
123
+ def set_mobile_capabilities(nmg_caps, nml_api_key, eyes_server_url, proxy_settings)
124
+ new_caps = {}
125
+
126
+ if nml_api_key.nil? || nml_api_key.empty?
127
+ nml_api_key = ENV['APPLITOOLS_API_KEY']
128
+ if nml_api_key.nil? || nml_api_key.empty?
129
+ raise Applitools::EyesError.new('No API key was given, or is an empty string.')
130
+ end
131
+ end
132
+ new_caps[:NML_API_KEY] = nml_api_key
133
+
134
+ if eyes_server_url.nil? || eyes_server_url.empty?
135
+ eyes_server_url = ENV['APPLITOOLS_SERVER_URL']
136
+ end
137
+ new_caps[:NML_SERVER_URL] = eyes_server_url if eyes_server_url
138
+
139
+ if proxy_settings.nil? || proxy_settings.empty?
140
+ proxy_settings = ENV['APPLITOOLS_HTTP_PROXY']
141
+ end
142
+ new_caps[:NML_PROXY_URL] = proxy_settings if proxy_settings
143
+
144
+ nmg_caps[:optionalIntentArguments] = "--es APPLITOOLS '" + new_caps.to_json + "'"
145
+ nmg_caps[:processArguments] = {
146
+ args: [],
147
+ env: new_caps.merge(DYLD_INSERT_LIBRARIES: "@executable_path/Frameworks/UFG_lib.xcframework/ios-arm64/UFG_lib.framework/UFG_lib:@executable_path/Frameworks/UFG_lib.xcframework/ios-arm64_x86_64-simulator/UFG_lib.framework/UFG_lib")
148
+ }
149
+ end
150
+
151
+ alias set_nmg_capabilities set_mobile_capabilities
152
+
153
+ def use_system_screenshot(value = true)
154
+ self.screenshot_mode = !value ? 'applitools-lib' : 'default'
155
+ self
156
+ end
157
+
123
158
  private
124
159
 
125
160
  def viewport_screenshot
@@ -31,9 +31,7 @@ module Applitools
31
31
  end
32
32
  # return all_test_results unless all_test_results.empty?
33
33
  all_universal_results = close_all_eyes
34
- test_result_summary = Applitools::TestResultSummary.new(all_universal_results).old_style_results_array
35
- return [] if test_result_summary.reject { |tr| tr.aborted? }.empty?
36
- test_result_summary
34
+ Applitools::TestResultSummary.new(all_universal_results)
37
35
  end
38
36
 
39
37
  def rendering_info(connector)
@@ -213,10 +213,10 @@ module Applitools
213
213
  end
214
214
 
215
215
 
216
- if running_session.nil?
217
- logger.info 'Closed'
218
- return false
219
- end
216
+ # if running_session.nil?
217
+ # logger.info 'Closed'
218
+ # return false
219
+ # end
220
220
 
221
221
  logger.info 'Aborting server session...'
222
222
  universal_sdk_abort
@@ -126,6 +126,7 @@ module Applitools
126
126
  boolean_field :enable_cross_origin_rendering
127
127
  boolean_field :dont_use_cookies
128
128
  boolean_field :dont_close_batches
129
+ string_field :screenshot_mode
129
130
 
130
131
  methods_to_delegate.delete(:batch_info)
131
132
  methods_to_delegate.delete(:batch_info=)
@@ -206,7 +207,9 @@ module Applitools
206
207
 
207
208
  # layoutBreakpoints?: boolean | number[]
208
209
  def layout_breakpoints=(value)
209
- config_hash[:layout_breakpoints] = (value.is_a?(Array) && value.all? {|v| v.is_a?(Numeric)}) ? value : !!value
210
+ config_hash[:layout_breakpoints] = value if value === true || value === false
211
+ config_hash[:layout_breakpoints] = value if value.is_a?(Array) && value.all? {|v| v.is_a?(Numeric)}
212
+ config_hash[:layout_breakpoints] = value if value.is_a?(Hash)
210
213
  end
211
214
  def layout_breakpoints
212
215
  config_hash[:layout_breakpoints]
@@ -2,11 +2,14 @@
2
2
 
3
3
  module Applitools
4
4
  class TestResultSummary
5
+ extend Forwardable
5
6
  attr_accessor :results, :passed, :unresolved, :failed, :exceptions, :mismatches, :missing, :matches
6
7
  attr_accessor :original_test_results
8
+ def_delegators :results, :[], :length
9
+
7
10
  def initialize(all_test_results)
8
11
  @original_test_results = all_test_results
9
- @results = all_test_results[:results]
12
+ @results = all_test_results[:results].map {|r| Applitools::TestResults.new(r) }
10
13
  @passed = all_test_results[:passed]
11
14
  @unresolved = all_test_results[:unresolved]
12
15
  @failed = all_test_results[:failed]
@@ -16,12 +19,9 @@ module Applitools
16
19
  @matches = all_test_results[:matches]
17
20
  end
18
21
 
19
- def old_style_results_array
20
- Applitools::Utils.deep_stringify_keys(results).map do |e|
21
- r = e['result'] ? e['result'] : {}
22
- r['isAborted'] = true unless e['error'].nil? # fix for get_all_test_results
23
- Applitools::TestResults.new(r)
24
- end
22
+ def to_a
23
+ @results
25
24
  end
25
+
26
26
  end
27
27
  end
@@ -17,9 +17,12 @@ module Applitools
17
17
  end
18
18
  end
19
19
  attr_accessor :is_new, :url, :screenshot
20
- attr_reader :status, :steps, :matches, :mismatches, :missing, :original_results
20
+ attr_reader :status, :steps, :matches, :mismatches, :missing, :original_results, :browser_info, :renderer
21
21
 
22
- def initialize(results = {})
22
+ def initialize(init_results = {})
23
+ @renderer = Applitools::Utils.deep_stringify_keys(Applitools::Utils.underscore_hash_keys(init_results[:renderer]))
24
+ @browser_info = JSON.parse(@renderer.to_json, object_class: OpenStruct)
25
+ results = Applitools::Utils.deep_stringify_keys(init_results[:result] ? init_results[:result] : init_results)
23
26
  @original_results = results
24
27
  @steps = results.fetch('steps', 0)
25
28
  @matches = results.fetch('matches', 0)
@@ -30,6 +33,10 @@ module Applitools
30
33
  @url = results.fetch('url', nil)
31
34
  end
32
35
 
36
+ def test_results
37
+ self
38
+ end
39
+
33
40
  def passed?
34
41
  status == 'Passed'
35
42
  end
@@ -51,7 +58,7 @@ module Applitools
51
58
  end
52
59
 
53
60
  def aborted?
54
- original_results['isAborted']
61
+ original_results['isAborted'] || !errors.nil?
55
62
  end
56
63
 
57
64
  def api_session_url
@@ -66,6 +73,10 @@ module Applitools
66
73
  original_results['name']
67
74
  end
68
75
 
76
+ def errors
77
+ original_results['error']
78
+ end
79
+
69
80
  def session_accessibility_status
70
81
  @accessibility_status ||= original_results['accessibilityStatus'] && AccessibilityStatus.new(original_results['accessibilityStatus'] || {})
71
82
  end
@@ -61,6 +61,7 @@ module Applitools
61
61
  end
62
62
  # raise Applitools::EyesNotOpenException.new('Eyes not open!') if @eyes.nil?
63
63
  return if @universal_eyes.nil?
64
+ closed_or_aborted = @universal_eyes.closed_or_aborted
64
65
  @universal_eyes.abort
65
66
  result = @universal_eyes.eyes_get_results
66
67
  result = result[0] if result.is_a?(Array)
@@ -72,6 +73,8 @@ module Applitools
72
73
  # require('pry')
73
74
  # binding.pry
74
75
  end
76
+ return nil if closed_or_aborted
77
+ Applitools::Utils.deep_stringify_keys(result)
75
78
  end
76
79
 
77
80
  private
@@ -95,6 +95,8 @@ module Applitools
95
95
  # :locationInView,
96
96
  # :fullViewSize
97
97
 
98
+ json_fields :screenshotMode
99
+
98
100
  def initialize(*args)
99
101
  options = Applitools::Utils.extract_options! args
100
102
  options.keys.select {|k| options[k] && respond_to?("#{k}=") }.each {|k| send("#{k}=", options[k]) }
@@ -119,6 +121,7 @@ module Applitools
119
121
 
120
122
  self.accessibility_settings = eyes.accessibility_validation
121
123
  self.disable_browser_fetching = eyes.dont_fetch_resources
124
+ self.screenshot_mode = eyes.screenshot_mode
122
125
 
123
126
  self.accessibility_regions = target.accessibility_regions
124
127
  self.content_regions = target.content_regions
@@ -16,7 +16,7 @@ module Applitools::Connectivity
16
16
  extend Forwardable
17
17
  def_delegators 'Applitools::EyesLogger', :logger
18
18
 
19
- CORE_MAKE_EC_CLIENT = 'Core.makeECClient'
19
+ CORE_GET_EC_CLIENT = 'Core.getECClient'
20
20
  SESSION_INIT = 'Core.makeCore'
21
21
 
22
22
  CORE_MAKE_MANAGER = 'Core.makeManager'
@@ -57,7 +57,7 @@ module Applitools::Connectivity
57
57
  # ECClientSettings
58
58
  #
59
59
  # {
60
- # "capabilities": { // default capabilities that will be used if user do not provide `applitools:` caps
60
+ # "options": { // default options that will be used if user do not provide `applitools:` caps
61
61
  # "serverUrl": "https://eyesapi.applitools.com/",
62
62
  # "apiKey": "DFH$HJD%77333J355",
63
63
  # },
@@ -71,17 +71,17 @@ module Applitools::Connectivity
71
71
  ec_client_capabilities[:serverUrl] = server_url unless server_url.nil?
72
72
  ec_client_capabilities[:apiKey] = api_key unless api_key.nil?
73
73
  ec_client_settings = {}
74
- ec_client_settings[:capabilities] = ec_client_capabilities unless ec_client_capabilities.empty?
74
+ ec_client_settings[:options] = ec_client_capabilities unless ec_client_capabilities.empty?
75
75
  ec_client_settings[:proxy] = proxy unless proxy.nil?
76
76
  make_ec_client_request_payload = {settings: ec_client_settings}
77
- # interface MakeECClientRequestPayload {
77
+ # interface GetECClientRequestPayload {
78
78
  # settings?: ECClientSettings
79
79
  # }
80
80
  #
81
- # interface MakeECClientResponsePayload {
81
+ # interface GetECClientResponsePayload {
82
82
  # url: string
83
83
  # }
84
- command_with_result(CORE_MAKE_EC_CLIENT, make_ec_client_request_payload)
84
+ command_with_result(CORE_GET_EC_CLIENT, make_ec_client_request_payload)
85
85
  end
86
86
 
87
87
  def make_manager(eyes_manager_config)
@@ -95,9 +95,13 @@ module Applitools::Connectivity
95
95
  def core_make_manager(eyes_manager_config)
96
96
  # interface MakeManagerRequestPayload {
97
97
  # type: 'ufg' | 'classic'
98
- # concurrency?: number
99
- # legacyConcurrency?: number
100
- # agentId?: string
98
+ # settings?: EyesManagerSettings
99
+ # }
100
+ # ### EyesManagerSettings
101
+ # {
102
+ # "concurrency": 10,
103
+ # "legacyConcurrency": 50,
104
+ # "agentId": "js/eyes/1.0.0"
101
105
  # }
102
106
  #
103
107
  # type MakeManagerResponsePayload = Ref<EyesManager>
@@ -6,9 +6,12 @@ module Applitools
6
6
  extend Forwardable
7
7
  def_delegators 'Applitools::EyesLogger', :logger
8
8
 
9
+ attr_accessor :closed_or_aborted
10
+
9
11
  def initialize(eyes, universal_client)
10
12
  @eyes = eyes
11
13
  @universal_client = universal_client
14
+ @closed_or_aborted = false
12
15
  end
13
16
 
14
17
  def check(settings, image_target = {})
@@ -21,10 +24,12 @@ module Applitools
21
24
  end
22
25
 
23
26
  def close
27
+ @closed_or_aborted = true
24
28
  @universal_client.eyes_close(@eyes)
25
29
  end
26
30
 
27
31
  def abort
32
+ @closed_or_aborted = true
28
33
  @universal_client.eyes_abort(@eyes)
29
34
  end
30
35
 
@@ -38,7 +38,7 @@ module Applitools
38
38
  end
39
39
 
40
40
  def close_all_eyes(remove_duplicate_tests)
41
- @opened_eyes.each {|universal_eye| universal_eye.close }
41
+ @opened_eyes.each {|universal_eye| universal_eye.closed_or_aborted = true }
42
42
  @universal_client.eyes_manager_close_all_eyes(@manager, remove_duplicate_tests)
43
43
  end
44
44
 
@@ -4,11 +4,11 @@ module Applitools
4
4
  class UniversalEyesManagerConfig
5
5
 
6
6
  def self.classic
7
- new(type: CLASSIC)
7
+ new(type: CLASSIC, runner_agent_id: "eyes.classic.ruby/#{Applitools::VERSION}")
8
8
  end
9
9
 
10
10
  def self.vg(concurrent_open_sessions=1)
11
- new(type: VG, concurrency: concurrent_open_sessions, legacy: false)
11
+ new(type: VG, concurrency: concurrent_open_sessions, legacy: false, runner_agent_id: "eyes.visualgrid.ruby/#{Applitools::VERSION}")
12
12
  end
13
13
 
14
14
  # export type EyesManagerConfig<TType extends 'vg' | 'classic' = 'vg' | 'classic'> = {
@@ -16,7 +16,7 @@ module Applitools
16
16
  # concurrency?: TType extends 'vg' ? number : never
17
17
  # legacy?: TType extends 'vg' ? boolean : never
18
18
  # }
19
- attr_reader :type, :concurrency, :legacy
19
+ attr_reader :type, :concurrency, :legacy, :runner_agent_id
20
20
 
21
21
  VG = 'ufg'.freeze
22
22
  CLASSIC = 'classic'.freeze
@@ -29,6 +29,7 @@ module Applitools
29
29
  self.type = options[:type].to_s
30
30
  self.concurrency = options[:concurrency]
31
31
  self.legacy = options[:legacy]
32
+ @runner_agent_id = options[:runner_agent_id]
32
33
  end
33
34
 
34
35
  # enum_field :type, Applitools::UniversalEyesManagerConfig.type_enum_values
@@ -52,8 +53,10 @@ module Applitools
52
53
  def to_hash
53
54
  result = {}
54
55
  result[:type] = type
55
- result[:concurrency] = concurrency if concurrency
56
- result[:legacy] = legacy if legacy
56
+ result[:settings] = {}
57
+ result[:settings][:concurrency] = concurrency if concurrency
58
+ result[:settings][:legacyConcurrency] = legacy if legacy
59
+ result[:settings][:agentId] = runner_agent_id
57
60
  result.compact
58
61
  end
59
62
 
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Applitools
4
- VERSION = '4.6.2'.freeze
5
- IMAGES_VERSION = '4.2.2'.freeze
6
- UNIVERSAL_VERSION = '3.3.2'.freeze
7
- UNIVERSAL_CORE_VERSION = '2.5.8'.freeze
4
+ VERSION = '5.0.0'.freeze
5
+ IMAGES_VERSION = '5.0.0'.freeze
6
+ UNIVERSAL_VERSION = '3.6.0'.freeze
7
+ UNIVERSAL_CORE_VERSION = '3.6.0'.freeze
8
8
  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: 4.6.2
4
+ version: 5.0.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: 2023-05-10 00:00:00.000000000 Z
11
+ date: 2023-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 3.3.2
117
+ version: 3.6.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 3.3.2
124
+ version: 3.6.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: bundler
127
127
  requirement: !ruby/object:Gem::Requirement