eyes_core 4.1.2 → 4.1.4

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: 0de07c4333f2eb419422f6701bd0b853777072aa408f59390088f644bc8ccc21
4
- data.tar.gz: 1f67f9079dde416580f1726473b491fa0094ecb10a0dc2bdb7f4fce6c2fb29a8
3
+ metadata.gz: cbf1994a6f05889f55ab95ff3af3a02caa1abdd64edb53c303d9cc92a3c0bb02
4
+ data.tar.gz: 6f973ccd0f7c868912b34b8fa78cb1e7cd7d86ae13a6b6459f07da41d3044e1a
5
5
  SHA512:
6
- metadata.gz: c0b840e04ecb9ba7c933ba861bc20967f854a2efa9549ab8a827b6a12d9de10508dcc1b6e07453da3c6fdb2655d9ab7726037ad4a98595dc2eabe4a622451555
7
- data.tar.gz: e2ba459ea74622bd29ae5b9142636097c322e1fd319fcf6c1be4add444dc5104292f34b9dc8acec8f5c739c5fa122869c5267f5964f4ed861d64d23ca51937aa
6
+ metadata.gz: 00e3f79dd9ddd4d1095d48dff3eb87d97075e4e848d34bb86b35dc6fa515b03c4027b73afe179fafad3f83bc05f848d809b214dccd1bd5559c0ff3106d99a0ac
7
+ data.tar.gz: e41402ca4efae7a05b584050c86a0a3c6bdbddaa1b72a9ec1f56c84fb5f98b991e143af42be807fc55aabdd311c8c199e9718068f7aed30d2d8c910065653d2a
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Applitools::Connectivity
4
+ module UniversalServerGemFinder
5
+ extend self
6
+
7
+ SERVER_GEM_NAME = 'eyes_universal'
8
+
9
+ def filepath
10
+ server_lib ? File.join(server_lib.gem_dir, 'ext', 'eyes-universal', filename) : ''
11
+ end
12
+
13
+ def executable_filepath
14
+ raise 'Universal server unrecognized' unless File.exist?(filepath) && File.executable?(filepath)
15
+ filepath
16
+ end
17
+
18
+ private
19
+
20
+ def server_lib
21
+ Gem::Specification.find_by_name(SERVER_GEM_NAME)
22
+ rescue Gem::MissingSpecError
23
+ nil
24
+ end
25
+
26
+ def filename
27
+ return 'eyes-universal-win.exe' if Gem.win_platform?
28
+ case RUBY_PLATFORM
29
+ when /mswin|windows|mingw/i
30
+ 'eyes-universal-win.exe'
31
+ when /musl/i
32
+ 'eyes-universal-alpine'
33
+ when /linux|arch/i
34
+ 'eyes-universal-linux'
35
+ when /darwin/i
36
+ 'eyes-universal-macos'
37
+ else
38
+ raise 'Unsupported platform'
39
+ end
40
+ end
41
+
42
+ end
43
+ end
@@ -132,7 +132,8 @@ module Applitools::Connectivity
132
132
 
133
133
 
134
134
  def prepare_socket
135
- @web_socket = ::Applitools::Connectivity::UniversalServer.check_or_run
135
+ @universal_server_control = Applitools::Connectivity::UniversalServerControl.instance
136
+ @web_socket = @universal_server_control.new_server_socket_connection
136
137
  socket_handshake
137
138
  session_init
138
139
  # connect_and_configure_socket(socket_uri)
@@ -165,9 +166,7 @@ module Applitools::Connectivity
165
166
 
166
167
 
167
168
  def socket_handshake
168
- ip = @web_socket.remote_address.ip_address
169
- port = @web_socket.remote_address.ip_port
170
- socket_uri = "ws://#{ip}:#{port}/eyes"
169
+ socket_uri = "ws://#{@web_socket.remote_address.inspect_sockaddr}/eyes"
171
170
  handshake = WebSocket::Handshake::Client.new(url: socket_uri)
172
171
  @web_socket.write(handshake)
173
172
  web_socket_result = receive_result('handshake')
@@ -0,0 +1,79 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'singleton'
4
+
5
+ module Applitools::Connectivity
6
+ class UniversalServerControl
7
+
8
+ include Singleton
9
+
10
+ DEFAULT_SERVER_IP = '127.0.0.1'
11
+ EXECUTABLE_FILEPATH = Applitools::Connectivity::UniversalServerGemFinder.executable_filepath
12
+
13
+ def initialize
14
+ @control_pipe = nil
15
+ @port_pipe = nil
16
+ @usdk_pid = nil
17
+ @monitoring_thread = nil
18
+ @port = nil
19
+ start_server_with_pipe
20
+ @sockets = []
21
+ end
22
+
23
+ def server_port
24
+ @port
25
+ end
26
+
27
+ def new_server_socket_connection
28
+ begin
29
+ socket = TCPSocket.new(DEFAULT_SERVER_IP, @port)
30
+ @sockets.push(socket)
31
+ socket
32
+ rescue Errno::ECONNREFUSED
33
+ nil
34
+ end
35
+ end
36
+
37
+ def server_running?
38
+ return false if @monitoring_thread.nil?
39
+ monitoring_result = @monitoring_thread.join(1)
40
+ monitoring_result.nil?
41
+ end
42
+
43
+ def stop_server
44
+ return if @control_pipe.nil?
45
+ @control_pipe.close_write
46
+ @sockets.each {|socket| socket.close unless socket.closed? }
47
+ sleep(1)
48
+ end
49
+
50
+ def to_s # for test & debug
51
+ "SDKServer(port=#{@port}; pid=#{@usdk_pid})"
52
+ end
53
+
54
+ private
55
+
56
+ def start_server_with_pipe
57
+ in_pipe, @control_pipe = IO.pipe
58
+ @port_pipe, port_w = IO.pipe
59
+
60
+ @usdk_pid = spawn(
61
+ EXECUTABLE_FILEPATH, '--no-singleton', '--shutdown-mode', 'stdin',
62
+ in: in_pipe, out: port_w, err: port_w,
63
+ # close_others: true
64
+ )
65
+ in_pipe.close_read
66
+ port_w.close_write
67
+
68
+ @monitoring_thread = Process.detach(@usdk_pid)
69
+
70
+ @port = @port_pipe.readline.strip.to_i
71
+ @port_pipe.close_read
72
+
73
+ if ENV['APPLITOOLS_SHOW_LOGS']
74
+ Applitools::EyesLogger.logger.debug("Started Universal SDK server at #{@port} pid = #{@usdk_pid}")
75
+ end
76
+ end
77
+
78
+ end
79
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Applitools
4
- VERSION = '4.1.2'.freeze
5
- UNIVERSAL_VERSION = '2.9.5'.freeze
4
+ VERSION = '4.1.4'.freeze
5
+ UNIVERSAL_VERSION = '2.10.8'.freeze
6
6
  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.1.2
4
+ version: 4.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Applitools Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-07 00:00:00.000000000 Z
11
+ date: 2022-09-02 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: 2.9.5
117
+ version: 2.10.8
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: 2.9.5
124
+ version: 2.10.8
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: bundler
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -386,6 +386,7 @@ files:
386
386
  - lib/applitools/method_tracer.rb
387
387
  - lib/applitools/rspec/target_matcher.rb
388
388
  - lib/applitools/sauce.rb
389
+ - lib/applitools/universal_sdk/executable_finder.rb
389
390
  - lib/applitools/universal_sdk/universal_check_settings.rb
390
391
  - lib/applitools/universal_sdk/universal_client.rb
391
392
  - lib/applitools/universal_sdk/universal_client_socket.rb
@@ -394,6 +395,7 @@ files:
394
395
  - lib/applitools/universal_sdk/universal_eyes_manager.rb
395
396
  - lib/applitools/universal_sdk/universal_eyes_manager_config.rb
396
397
  - lib/applitools/universal_sdk/universal_server.rb
398
+ - lib/applitools/universal_sdk/universal_server_control.rb
397
399
  - lib/applitools/utils/eyes_selenium_utils.rb
398
400
  - lib/applitools/utils/image_delta_compressor.rb
399
401
  - lib/applitools/utils/image_utils.rb