eyes_core 4.5.5 → 4.6.0

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: 2648f7486047fa1520639c3a2e84507709e3f2b562a2f7e3d8e9f98ea5632240
4
- data.tar.gz: dfcb438452a8e03b8de9b7134edf6b62c62e79efb92a86b1ab0d0fd6a2ce8c50
3
+ metadata.gz: 4259f81f87552a4729eee89d697e1d534ffae9c2e448251d2310dd05860f0df5
4
+ data.tar.gz: d241c44d26afd831d18b9c48c04fef94878a520198736b6e5ecfd58f9b65d0c7
5
5
  SHA512:
6
- metadata.gz: 043b6990d1b7efbea9d1c6ba440f8964ec5809d5b1cf58539ba6e733c1c883e644ac8db61db78f8ebbab02b827ff6fafef316d0f1d8be28724f660b367600122
7
- data.tar.gz: f45b7146e913fe8b2d7b6d84dde8927ef54d586e349772800535464c348357852d22da66f9846ecdbe9829fd5868b09288c03f575ef5bef51d94888506deb501
6
+ metadata.gz: 61ab67a89de0e6d138e2b9cfc9dfa9318b52a49d4cc292996da92489c1bb9ea81ef759ceecd80c167cf37098f324e976171de1d3a7a7c4c0a7bb63ce2150dac7
7
+ data.tar.gz: b487a9aa5139df95d5af1deeb8e3876d7db3ba8323e182da94a4f4155748b8f5b74793fce814e808ab458f7ee05d0359dceef677b003e2930a3653d967022e70
@@ -36,6 +36,8 @@ class Applitools::Appium::Eyes < Applitools::Selenium::SeleniumEyes
36
36
  self.tag_for_debug = name
37
37
  Applitools::ArgumentGuard.one_of? target, 'target', [Applitools::Selenium::Target, Applitools::Appium::Target]
38
38
 
39
+ # target.fully(false) if target.options[:stitch_content].nil?
40
+
39
41
  return universal_check(name, target)
40
42
  return check_native(name, target) if native_app?
41
43
  super
@@ -27,6 +27,13 @@ module Applitools
27
27
  reset_floating
28
28
  self
29
29
  end
30
+
31
+ def webview(value = true)
32
+ options[:webview] = value.is_a?(String) ? value : !!value
33
+ # options[:stitch_content] = false if options[:stitch_content].nil?
34
+ self
35
+ end
36
+
30
37
  # class Target
31
38
  # include Applitools::FluentInterface
32
39
  # attr_accessor :region_to_check, :options, :ignored_regions, :floating_regions, :layout_regions, :content_regions, :strict_regions, :accessibility_regions
@@ -37,7 +37,7 @@ module Applitools
37
37
  def one_of?(param, param_name, klasses)
38
38
  return true if klasses.detect { |a| param.is_a? a }
39
39
  raise Applitools::EyesIllegalArgument.new "Expected #{param_name} to be" \
40
- " instance of one of this classes: [#{klass}], but got #{param.class.name} instead"
40
+ " instance of one of this classes: [#{klasses}], but got #{param.class.name} instead"
41
41
  end
42
42
 
43
43
  def raise_argument_error(error)
@@ -57,6 +57,17 @@ module Applitools
57
57
  raise Applitools::EyesError.new 'Failed to set viewport size!'
58
58
  end
59
59
  end
60
+
61
+ def get_execution_cloud_url(*args)
62
+ options = Applitools::Utils.extract_options!(args)
63
+ default_configs = Applitools::EyesBaseConfiguration::DEFAULT_CONFIG
64
+ server_url = options[:server_url] || default_configs[:server_url]
65
+ api_key = options[:api_key] || default_configs[:api_key]
66
+ proxy = options[:proxy]
67
+ @universal_client = Applitools::Connectivity::UniversalClient.new
68
+ core_ec_client = @universal_client.core_make_ec_client(server_url, api_key, proxy)
69
+ core_ec_client[:url]
70
+ end
60
71
  end
61
72
 
62
73
  attr_accessor :config
@@ -451,7 +462,8 @@ module Applitools
451
462
  # logger.info "Automatically save test? #{save}"
452
463
 
453
464
  # U-Notes : universal server returns Array ; keys as sym
454
- universal_results = universal_eyes.close # Array even for one test
465
+ universal_eyes.close # nil
466
+ universal_results = universal_eyes.eyes_get_results # Array even for one test
455
467
  # require 'pry'
456
468
  # binding.pry
457
469
  key_transformed_results = Applitools::Utils.deep_stringify_keys(universal_results)
@@ -19,6 +19,7 @@ module Applitools
19
19
  def old_style_results_array
20
20
  Applitools::Utils.deep_stringify_keys(results).map do |e|
21
21
  r = e['result'] ? e['result'] : {}
22
+ r['isAborted'] = true unless e['error'].nil? # fix for get_all_test_results
22
23
  Applitools::TestResults.new(r)
23
24
  end
24
25
  end
@@ -61,7 +61,9 @@ 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
- result = @universal_eyes.abort
64
+ @universal_eyes.abort
65
+ result = @universal_eyes.eyes_get_results
66
+ result = result[0] if result.is_a?(Array)
65
67
 
66
68
  if result.is_a? Hash
67
69
  logger.info "---Test aborted" if !result[:message] && !result[:stack]
@@ -24,18 +24,18 @@ module Applitools::Connectivity
24
24
  end
25
25
 
26
26
  def filename
27
- return 'eyes-universal-win.exe' if Gem.win_platform?
27
+ return 'core-win.exe' if Gem.win_platform?
28
28
  case RUBY_PLATFORM
29
29
  when /darwin/i
30
- 'eyes-universal-macos'
30
+ 'core-macos'
31
31
  when /arm/i
32
- 'eyes-universal-linux-arm64'
32
+ 'core-linux-arm64'
33
33
  when /mswin|windows|mingw/i
34
- 'eyes-universal-win.exe'
34
+ 'core-win.exe'
35
35
  when /musl/i
36
- 'eyes-universal-alpine'
36
+ 'core-alpine'
37
37
  when /linux|arch/i
38
- 'eyes-universal-linux'
38
+ 'core-linux'
39
39
  else
40
40
  raise 'Unsupported platform'
41
41
  end
@@ -18,6 +18,7 @@ module Applitools
18
18
  # waitBeforeCapture?: number,
19
19
  # lazyLoad?: boolean | LazyLoadOptions
20
20
  # }
21
+ # webview?: boolean | string
21
22
  json_fields :name,
22
23
  :disableBrowserFetching,
23
24
  :layoutBreakpoints,
@@ -28,7 +29,8 @@ module Applitools
28
29
  :variationGroupId,
29
30
  :timeout,
30
31
  :waitBeforeCapture,
31
- :lazyLoad
32
+ :lazyLoad,
33
+ :webview
32
34
 
33
35
  # export type MatchSettings<TRegion> = {
34
36
  # exact?: {
@@ -161,6 +163,7 @@ module Applitools
161
163
  self.variation_group_id = target.options[:variation_group_id]
162
164
  self.wait_before_capture = target.options[:wait_before_capture]
163
165
  self.lazy_load = target.options[:lazy_load]
166
+ self.webview = target.options[:webview]
164
167
  self.page_id = target.options[:page_id]
165
168
 
166
169
  self.scroll_root_element = target.options[:scroll_root_element] || eyes.scroll_root_element
@@ -16,6 +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
20
  SESSION_INIT = 'Core.makeCore'
20
21
 
21
22
  CORE_MAKE_MANAGER = 'Core.makeManager'
@@ -25,14 +26,17 @@ module Applitools::Connectivity
25
26
  CORE_DELETE_TEST = 'Core.deleteTest'
26
27
 
27
28
  EYES_MANAGER_MAKE_EYES = 'EyesManager.openEyes'
28
- EYES_MANAGER_CLOSE_ALL_EYES = 'EyesManager.closeManager'
29
+ EYES_MANAGER_CLOSE_ALL_EYES = 'EyesManager.getResults'
29
30
  EYES_CHECK = 'Eyes.check'
30
31
  EYES_CHECK_AND_CLOSE = 'Eyes.checkAndClose' # ...
31
32
  EYES_LOCATE = 'Core.locate'
32
- EYES_EXTRACT_TEXT_REGIONS = 'Eyes.locateText'
33
- EYES_EXTRACT_TEXT = 'Eyes.extractText'
33
+ EYES_EXTRACT_TEXT_REGIONS = 'Core.locateText'
34
+ EYES_EXTRACT_TEXT = 'Core.extractText'
34
35
  EYES_CLOSE = 'Eyes.close'
35
36
  EYES_ABORT = 'Eyes.abort'
37
+ EYES_GET_RESULTS = 'Eyes.getResults'
38
+
39
+ SERVER_LOG_EVENT_NAME = 'Logger.log'
36
40
 
37
41
  attr_accessor :commands_config
38
42
 
@@ -49,6 +53,37 @@ module Applitools::Connectivity
49
53
  }
50
54
  end
51
55
 
56
+ def core_make_ec_client(server_url, api_key, proxy)
57
+ # ECClientSettings
58
+ #
59
+ # {
60
+ # "capabilities": { // default capabilities that will be used if user do not provide `applitools:` caps
61
+ # "serverUrl": "https://eyesapi.applitools.com/",
62
+ # "apiKey": "DFH$HJD%77333J355",
63
+ # },
64
+ # "proxy": {
65
+ # "url": "http://localhost:8080",
66
+ # "username": "username",
67
+ # "password": "Pa$$w0rD"
68
+ # },
69
+ # }
70
+ ec_client_capabilities = {}
71
+ ec_client_capabilities[:serverUrl] = server_url unless server_url.nil?
72
+ ec_client_capabilities[:apiKey] = api_key unless api_key.nil?
73
+ ec_client_settings = {}
74
+ ec_client_settings[:capabilities] = ec_client_capabilities unless ec_client_capabilities.empty?
75
+ ec_client_settings[:proxy] = proxy unless proxy.nil?
76
+ make_ec_client_request_payload = {settings: ec_client_settings}
77
+ # interface MakeECClientRequestPayload {
78
+ # settings?: ECClientSettings
79
+ # }
80
+ #
81
+ # interface MakeECClientResponsePayload {
82
+ # url: string
83
+ # }
84
+ command_with_result(CORE_MAKE_EC_CLIENT, make_ec_client_request_payload)
85
+ end
86
+
52
87
  def make_manager(eyes_manager_config)
53
88
  Applitools::EyesLogger.logger.debug "EyesManager config: #{eyes_manager_config}"
54
89
  eyes_manager = core_make_manager(eyes_manager_config)
@@ -134,18 +169,18 @@ module Applitools::Connectivity
134
169
  end
135
170
 
136
171
  def eyes_manager_close_all_eyes(manager)
137
- # interface CloseManagerRequestPayload {
172
+ # interface GetManagerResultsRequestPayload {
138
173
  # manager: Ref<EyesManager>
139
174
  # settings?: {throwErr?: boolean}
140
175
  # }
141
176
  #
142
- # interface CloseManagerResponsePayload {
143
- # results: Array<{
177
+ # interface GetManagerResultsResponsePayload {
178
+ # results: {
144
179
  # error?: Error
145
180
  # result?: TestResult
146
181
  # renderer?: TType extends 'ufg' ? Renderer : never
147
182
  # userTestId: string
148
- # }>
183
+ # }[]
149
184
  # passed: number
150
185
  # unresolved: number
151
186
  # failed: number
@@ -154,7 +189,19 @@ module Applitools::Connectivity
154
189
  # missing: number
155
190
  # matches: number
156
191
  # }
157
- command_with_result(EYES_MANAGER_CLOSE_ALL_EYES, {manager: manager, config: commands_config})
192
+ settings = {throwErr: false}
193
+ command_with_result(EYES_MANAGER_CLOSE_ALL_EYES, {manager: manager, settings: settings})
194
+ end
195
+
196
+ def eyes_get_results(eyes)
197
+ # interface GetEyesResultsPayload {
198
+ # eyes: Ref<Eyes>
199
+ # settings?: GetResultsSettings
200
+ # }
201
+ #
202
+ # type GetEyesResultsResponsePayload = TestResult[]
203
+ settings = {throwErr: false}
204
+ command_with_result(EYES_GET_RESULTS, {eyes: eyes, settings: settings})
158
205
  end
159
206
 
160
207
  def eyes_check(eyes, settings, image_target = {})
@@ -187,28 +234,26 @@ module Applitools::Connectivity
187
234
 
188
235
  def eyes_extract_text_regions(eyes, settings, driver_target)
189
236
  # interface LocateTextRequestPayload {
190
- # eyes: Ref<Eyes>
191
237
  # target?: ImageTarget | DriverTarget
192
238
  # settings?: LocateTextSettings
193
239
  # config?: Config
194
240
  # }
195
241
  #
196
- # type LocateTextResponcePayload = Record<string, Array<{text: string, x: number, y: number, width: number, hieght: number}>>
197
- payload = {eyes: eyes, target: driver_target, settings: settings, config: commands_config}
242
+ # type LocateTextResponsePayload = Record<string, {text: string, x: number, y: number, width: number, height: number}[]>
243
+ payload = {target: driver_target, settings: settings, config: commands_config}
198
244
  payload.delete(:target) if driver_target.nil? || driver_target.empty?
199
245
  command_with_result(EYES_EXTRACT_TEXT_REGIONS, payload)
200
246
  end
201
247
 
202
248
  def eyes_extract_text(eyes, regions, driver_target)
203
249
  # interface ExtractTextRequestPayload {
204
- # eyes: Ref<Eyes>
205
250
  # target?: ImageTarget | DriverTarget
206
251
  # settings?: ExtractTextSettings | ExtractTextSettings[]
207
252
  # config?: Config
208
253
  # }
209
254
  #
210
- # type ExtractTextResponcePayload = string[]
211
- payload = {eyes: eyes, target: driver_target, settings: regions, config: commands_config}
255
+ # type ExtractTextResponsePayload = string[]
256
+ payload = {target: driver_target, settings: regions, config: commands_config}
212
257
  payload.delete(:settings) if regions.empty?
213
258
  command_with_result(EYES_EXTRACT_TEXT, payload)
214
259
  end
@@ -220,19 +265,32 @@ module Applitools::Connectivity
220
265
  # config?: Config
221
266
  # }
222
267
  #
223
- # type CloseResponsePayload = TestResult[]
224
- settings = {throwErr: false}
225
-
268
+ # type CloseResponsePayload = void
269
+ settings = commands_config[:close]
270
+ # CloseSettings
271
+ #
272
+ # {
273
+ # "updateBaselineIfNew": true,
274
+ # "updateBaselineIfDifferent": true
275
+ # }
226
276
  command_with_result(EYES_CLOSE, {eyes: eyes, settings: settings, config: commands_config})
227
277
  end
228
278
 
229
279
  def eyes_abort(eyes)
230
280
  # interface AbortPayload {
231
281
  # eyes: Ref<Eyes>
282
+ # settings?: CloseSettings
232
283
  # }
233
284
  #
234
- # type AbortResponsePayload = TestResult[]
235
- command_with_result(EYES_ABORT, {eyes: eyes})
285
+ # type AbortResponsePayload = void
286
+ settings = commands_config[:close]
287
+ # CloseSettings
288
+ #
289
+ # {
290
+ # "updateBaselineIfNew": true,
291
+ # "updateBaselineIfDifferent": true
292
+ # }
293
+ command_with_result(EYES_ABORT, {eyes: eyes, settings: settings})
236
294
  end
237
295
 
238
296
  def core_get_viewport_size(driver)
@@ -324,12 +382,17 @@ module Applitools::Connectivity
324
382
  end
325
383
 
326
384
  def session_init
385
+ init_agent_id = "eyes.ruby-sdk/#{Applitools::VERSION}".freeze
327
386
  make_core_payload = {
328
- name: :rb,
329
- version: Applitools::VERSION,
330
- protocol: :webdriver,
331
- cwd: Dir.pwd
387
+ agentId: init_agent_id,
388
+ cwd: Dir.pwd,
389
+ spec: :webdriver
332
390
  }
391
+ # interface MakeCorePayload {
392
+ # agentId: string
393
+ # cwd: string
394
+ # spec: 'webdriver' | string[]
395
+ # }
333
396
  command(SESSION_INIT, make_core_payload)
334
397
  # no response
335
398
  end
@@ -364,7 +427,7 @@ module Applitools::Connectivity
364
427
  encoded_frame << web_socket_result
365
428
  decoded_frame = encoded_frame.next
366
429
  incoming_json = JSON.parse(decoded_frame.to_s)
367
- if incoming_json['name'] === 'Server.log'
430
+ if incoming_json['name'] === SERVER_LOG_EVENT_NAME
368
431
  incoming_payload = incoming_json['payload']
369
432
  # incoming_payload['level']
370
433
  puts incoming_payload['message']
@@ -411,9 +474,9 @@ module Applitools::Connectivity
411
474
 
412
475
  def process_other_responses(other_responses)
413
476
  other_responses.each do |incoming_json|
414
- if incoming_json['name'] === 'Server.log'
477
+ if incoming_json['name'] === SERVER_LOG_EVENT_NAME
415
478
  if ENV['APPLITOOLS_SHOW_UNIVERSAL_LOGS']
416
- Applitools::EyesLogger.logger.debug "[Server.log] #{incoming_json['payload']['message']}"
479
+ Applitools::EyesLogger.logger.debug "[#{SERVER_LOG_EVENT_NAME}] #{incoming_json['payload']['message']}"
417
480
  end
418
481
  else
419
482
  Applitools::EyesLogger.logger.info "[Server.info] #{incoming_json}"
@@ -28,6 +28,10 @@ module Applitools
28
28
  @universal_client.eyes_abort(@eyes)
29
29
  end
30
30
 
31
+ def eyes_get_results
32
+ @universal_client.eyes_get_results(@eyes)
33
+ end
34
+
31
35
  def locate(settings, driver_target)
32
36
  @universal_client.eyes_locate(@eyes, settings, driver_target)
33
37
  end
@@ -11,6 +11,7 @@ module Applitools
11
11
  def initialize(manager, universal_client)
12
12
  @manager = manager
13
13
  @universal_client = universal_client
14
+ @opened_eyes = []
14
15
  end
15
16
 
16
17
  def open_eyes(driver_config_json, config)
@@ -31,10 +32,13 @@ module Applitools
31
32
 
32
33
  Applitools::EyesLogger.logger.debug "Eyes applitools-ref-id: #{@eyes[:"applitools-ref-id"]}"
33
34
  # U-Notes : !!! Eyes.new
34
- Applitools::UniversalEyes.new(@eyes, @universal_client)
35
+ universal_eyes = Applitools::UniversalEyes.new(@eyes, @universal_client)
36
+ @opened_eyes.push(universal_eyes)
37
+ universal_eyes
35
38
  end
36
39
 
37
40
  def close_all_eyes
41
+ @opened_eyes.each {|universal_eye| universal_eye.close }
38
42
  @universal_client.eyes_manager_close_all_eyes(@manager)
39
43
  end
40
44
 
@@ -58,7 +58,7 @@ module Applitools::Connectivity
58
58
  @port_pipe, port_w = IO.pipe
59
59
 
60
60
  @usdk_pid = spawn(
61
- EXECUTABLE_FILEPATH, '--no-singleton', '--shutdown-mode', 'stdin',
61
+ EXECUTABLE_FILEPATH, 'universal', '--no-singleton', '--shutdown-mode', 'stdin',
62
62
  in: in_pipe, out: port_w, err: port_w,
63
63
  # close_others: true
64
64
  )
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Applitools
4
- VERSION = '4.5.5'.freeze
5
- IMAGES_VERSION = '4.1.2'.freeze
6
- UNIVERSAL_VERSION = '3.2.2'.freeze
4
+ VERSION = '4.6.0'.freeze
5
+ IMAGES_VERSION = '4.2.0'.freeze
6
+ UNIVERSAL_VERSION = '3.3.0'.freeze
7
+ UNIVERSAL_CORE_VERSION = '2.3.10'.freeze
7
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.5.5
4
+ version: 4.6.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-01-10 00:00:00.000000000 Z
11
+ date: 2023-03-06 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.2.2
117
+ version: 3.3.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.2.2
124
+ version: 3.3.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: bundler
127
127
  requirement: !ruby/object:Gem::Requirement