eyes_core 5.0.0 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +504 -0
  3. data/Rakefile +35 -0
  4. data/eyes_core.gemspec +60 -0
  5. data/lib/applitools/core/batch_info.rb +2 -0
  6. data/lib/applitools/core/eyes_base.rb +106 -18
  7. data/lib/applitools/core/eyes_base_configuration.rb +9 -3
  8. data/lib/applitools/core/eyes_runner.rb +3 -2
  9. data/lib/applitools/core/test_results.rb +6 -1
  10. data/lib/applitools/core/universal_eyes_checks.rb +2 -1
  11. data/lib/applitools/core/universal_eyes_open.rb +2 -1
  12. data/lib/applitools/eyes_core/version.rb +10 -0
  13. data/lib/applitools/universal_sdk/universal_client.rb +26 -10
  14. data/lib/applitools/universal_sdk/universal_eyes_config.rb +10 -9
  15. data/lib/eyes_core.rb +1 -3
  16. metadata +14 -58
  17. data/ext/eyes_core/extconf.rb +0 -5
  18. data/ext/eyes_core/eyes_core.c +0 -252
  19. data/ext/eyes_core/eyes_core.h +0 -28
  20. data/lib/applitools/appium/android_region_provider.rb +0 -32
  21. data/lib/applitools/appium/android_screenshot.rb +0 -21
  22. data/lib/applitools/appium/driver.rb +0 -12
  23. data/lib/applitools/appium/eyes.rb +0 -189
  24. data/lib/applitools/appium/ios_region_provider.rb +0 -25
  25. data/lib/applitools/appium/ios_screenshot.rb +0 -10
  26. data/lib/applitools/appium/region_provider.rb +0 -51
  27. data/lib/applitools/appium/screenshot.rb +0 -30
  28. data/lib/applitools/appium/target.rb +0 -240
  29. data/lib/applitools/appium/utils.rb +0 -64
  30. data/lib/applitools/calabash/calabash_element.rb +0 -64
  31. data/lib/applitools/calabash/calabash_screenshot_provider.rb +0 -83
  32. data/lib/applitools/calabash/environment_detector.rb +0 -25
  33. data/lib/applitools/calabash/eyes.rb +0 -194
  34. data/lib/applitools/calabash/eyes_calabash_android_screenshot.rb +0 -68
  35. data/lib/applitools/calabash/eyes_calabash_ios_screenshot.rb +0 -30
  36. data/lib/applitools/calabash/eyes_calabash_screenshot.rb +0 -80
  37. data/lib/applitools/calabash/eyes_hooks.rb +0 -51
  38. data/lib/applitools/calabash/eyes_settings.rb +0 -45
  39. data/lib/applitools/calabash/full_page_capture_algorithm/android_scroll_view.rb +0 -95
  40. data/lib/applitools/calabash/full_page_capture_algorithm/base.rb +0 -51
  41. data/lib/applitools/calabash/full_page_capture_algorithm/ios_ui_table_view.rb +0 -150
  42. data/lib/applitools/calabash/full_page_capture_algorithm.rb +0 -26
  43. data/lib/applitools/calabash/os_versions.rb +0 -25
  44. data/lib/applitools/calabash/rspec_matchers.rb +0 -25
  45. data/lib/applitools/calabash/steps/android_eyes_session.rb +0 -37
  46. data/lib/applitools/calabash/steps/android_matchers.rb +0 -36
  47. data/lib/applitools/calabash/steps/eyes_session.rb +0 -42
  48. data/lib/applitools/calabash/steps/eyes_settings.rb +0 -59
  49. data/lib/applitools/calabash/steps/ios_eyes_session.rb +0 -15
  50. data/lib/applitools/calabash/steps/ios_matchers.rb +0 -17
  51. data/lib/applitools/calabash/steps/matchers.rb +0 -71
  52. data/lib/applitools/calabash/target.rb +0 -69
  53. data/lib/applitools/calabash/utils.rb +0 -74
  54. data/lib/applitools/calabash_steps.rb +0 -16
  55. data/lib/applitools/capybara/capybara_settings.rb +0 -25
  56. data/lib/applitools/capybara/driver.rb +0 -39
  57. data/lib/applitools/rspec/target_matcher.rb +0 -25
  58. data/lib/applitools/universal_sdk/executable_finder.rb +0 -57
  59. data/lib/applitools/universal_sdk/universal_server_control.rb +0 -79
  60. data/lib/applitools/version.rb +0 -8
  61. data/lib/eyes_consts.rb +0 -4
  62. data/lib/eyes_rspec.rb +0 -4
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Then(/^ignore status bar$/) do
4
- raise Applitools::EyesError, '@target is not set' unless @target
5
- step %(query element "view id:'statusBarBackground'")
6
- @target.ignore @current_element if @current_element
7
- end
8
-
9
- Then(/^remove status bar$/) do
10
- raise Applitools::EyesError, '@target is not set' unless @target
11
- step %(query element "view id:'statusBarBackground'")
12
- if @current_element
13
- viewport_size = Applitools::RectangleSize.from_any_argument(
14
- Applitools::Calabash::EyesSettings.instance.viewport_size
15
- )
16
- region_location = Applitools::Location.new(0, @current_element.size.height)
17
- @target.region(Applitools::Region.from_location_size(region_location, viewport_size))
18
- end
19
- end
20
-
21
- Then(/^the whole screen should match a baseline/) do
22
- step %(create target)
23
- step %(remove status bar)
24
- step %(target should match a baseline)
25
- end
26
-
27
- Then(/^query element "([^"]*)" and take (\d+)$/) do |query, index|
28
- @current_element = nil
29
- @current_element = Applitools::Calabash::Utils.get_android_element(self, query, index)
30
- end
31
-
32
- Then(/^check for scrollable$/) do
33
- unless query('ScrollView').empty?
34
- @present_scrollable = Applitools::Calabash::Utils.get_android_element(self, 'ScrollView', 0)
35
- end
36
- end
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Then(/^create eyes$/) do
4
- eyes_settings = Applitools::Calabash::EyesSettings.instance
5
- eyes_settings.eyes ||= Applitools::Calabash::Eyes.new.tap do |eyes|
6
- eyes.api_key = eyes_settings.applitools_api_key
7
- log_file_path = File.join(eyes_settings.log_prefix, eyes_settings.log_file)
8
- eyes.log_handler = Logger.new(File.new(log_file_path, 'w+'))
9
- end
10
-
11
- unless eyes_settings.eyes.open?
12
- step %(set batch "#{@before_hook_scenario.feature.name}")
13
- step %(set OS)
14
- step %(set device pixel ratio)
15
- step %(set device size)
16
- end
17
- end
18
-
19
- Then(/^open eyes$/) do
20
- eyes_settings = Applitools::Calabash::EyesSettings.instance
21
- eyes_settings.eyes.open eyes_settings.options_for_open unless eyes_settings.eyes.open?
22
- end
23
-
24
- When(/^I close eyes session$/) do
25
- @test_result = Applitools::Calabash::EyesSettings.instance.eyes.close(false)
26
- end
27
-
28
- Then(/^test result should be positive$/) do
29
- raise Applitools::EyesError, 'Test result are not present!' unless @test_result
30
- expect(@test_result).to be_success
31
- end
32
-
33
- Then(/^applitools link should be reported$/) do
34
- puts @test_result
35
- end
36
-
37
- Then(/^terminate eyes session$/) do
38
- step %(I close eyes session)
39
- step %(test result should be positive)
40
- step %(applitools link should be reported)
41
- @test_results = nil
42
- end
@@ -1,59 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Given(/^eyes application name is "([^"]*)"$/) do |name|
4
- Applitools::Calabash::EyesSettings.instance.app_name = name
5
- end
6
-
7
- Given(/^eyes test name is "([^"]*)"$/) do |name|
8
- Applitools::Calabash::EyesSettings.instance.test_name = name
9
- end
10
-
11
- Given(/^eyes viewport size is "([^"]*)"$/) do |size|
12
- Applitools::Calabash::EyesSettings.instance.viewport_size = Applitools::RectangleSize.from_any_argument(size)
13
- end
14
-
15
- Given(/^eyes API key "([^"]*)"$/) do |key|
16
- Applitools::Calabash::EyesSettings.instance.applitools_api_key = key
17
- end
18
-
19
- Given(/^eyes tag is "([^"]*)"$/) do |tag|
20
- @tag = tag
21
- end
22
-
23
- Given(/^set batch "([^"]*)"/) do |name|
24
- @current_batch ||= Applitools::Calabash::EyesSettings.instance.eyes.batch.tap do |batch|
25
- batch.name = name
26
- end
27
-
28
- Applitools::Calabash::EyesSettings.instance.eyes.batch = @current_batch
29
- end
30
-
31
- Given(/^calabash screenshot dir is "([^"]*)"$/) do |path|
32
- Applitools::Calabash::EyesSettings.instance.screenshot_dir = path
33
- end
34
-
35
- Given(/^calabash temp dir is "([^"]*)"$/) do |path|
36
- Applitools::Calabash::EyesSettings.instance.tmp_dir = path
37
- end
38
-
39
- Given(/^calabash log path is "([^"]*)"$/) do |path|
40
- Applitools::Calabash::EyesSettings.instance.log_dir = path
41
- end
42
-
43
- Given(/^eyes logfile is "([^"]*)"$/) do |logfile_path|
44
- Applitools::Calabash::EyesSettings.instance.log_file = logfile_path
45
- end
46
-
47
- Given(/^clear directories$/) do
48
- Applitools::Calabash::Utils.clear_directories(Applitools::Calabash::EyesSettings.instance)
49
- end
50
-
51
- Given(/^create directories$/) do
52
- Applitools::Calabash::Utils.create_directories(Applitools::Calabash::EyesSettings.instance)
53
- end
54
-
55
- Given(/^set it up$/) do
56
- step %(clear directories)
57
- step %(create directories)
58
- Applitools::Calabash::EyesSettings.instance.needs_setting_up = false
59
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Then(/^set OS$/) do
4
- Applitools::Calabash::EyesSettings.instance.eyes.host_os = "iOS #{default_device.ios_major_version}"
5
- end
6
-
7
- Then(/^set device pixel ratio$/) do
8
- dimensions = default_device.screen_dimensions
9
- Applitools::Calabash::EyesSettings.instance.eyes.device_pixel_ratio = dimensions[:scale] #:native_scale?
10
- end
11
-
12
- Then(/^set device size$/) do
13
- dimensions = default_device.screen_dimensions
14
- step %(eyes viewport size is "#{dimensions[:width].to_i}x#{dimensions[:height].to_i}")
15
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Then(/^the whole screen should match a baseline/) do
4
- step %(create target)
5
- step %(target should match a baseline)
6
- end
7
-
8
- Then(/^query element "([^"]*)" and take (\d+)$/) do |query, index|
9
- @current_element = nil
10
- @current_element = Applitools::Calabash::Utils.get_ios_element(self, query, index)
11
- end
12
-
13
- Then(/^check for scrollable$/) do
14
- unless query('UIScrollView').empty?
15
- @present_scrollable = Applitools::Calabash::Utils.get_ios_element(self, 'UIScrollView', 0)
16
- end
17
- end
@@ -1,71 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Then(/^create target$/) do
4
- @target = nil
5
- @target = Applitools::Calabash::Target.new
6
- end
7
-
8
- Then(/^target should match a baseline$/) do
9
- raise Applitools::EyesError, '@target is not set' unless @target
10
- @tag ||= ''
11
- expect(@target).to match_baseline(@tag)
12
- end
13
-
14
- Then(/^the element "([^"]*)" should match a baseline$/) do |query|
15
- step %(create target)
16
- step %(query element "#{query}")
17
- @target.region(@current_element) if @current_element
18
- step %(target should match a baseline)
19
- end
20
-
21
- Then(/^the entire element "([^"]*)" should match a baseline$/) do |query|
22
- step %(create target)
23
- step %(query element "#{query}")
24
- @target.region(@current_element).fully if @current_element
25
- step %(target should match a baseline)
26
- end
27
-
28
- Then(/^query element "([^"]*)"$/) do |query|
29
- step %(query element "#{query}" and take 0)
30
- end
31
-
32
- Then(/^I check viewport window$/) do
33
- step %(the whole screen should match a baseline)
34
- end
35
-
36
- Then(/^I check viewport window with description "([^"]*)"$/) do |description|
37
- step %(eyes tag is "#{description}")
38
- step %(I check viewport window)
39
- end
40
-
41
- Then(/^I check window$/) do
42
- step %(check for scrollable)
43
- if @present_scrollable
44
- step %(the entire element "#{@present_scrollable.element_query}" should match a baseline)
45
- else
46
- step %(I check viewport window)
47
- end
48
- end
49
-
50
- Then(/^I check window with description "([^"]*)"$/) do |description|
51
- step %(eyes tag is "#{description}")
52
- step %(I check window)
53
- end
54
-
55
- Then(/^I check viewport element "([^"]*)"$/) do |selector|
56
- step %(the element "#{selector}" should match a baseline)
57
- end
58
-
59
- Then(/^I check viewport element "([^"]*)" with description "([^"]*)"$/) do |selector, description|
60
- step %(eyes tag is "#{description}")
61
- step %(I check viewport element "#{selector}")
62
- end
63
-
64
- Then(/^I check element "([^"]*)"$/) do |selector|
65
- step %(the entire element "#{selector}" should match a baseline)
66
- end
67
-
68
- Then(/^I check element "([^"]*)" with description "([^"]*)"$/) do |selector, description|
69
- step %(eyes tag is "#{description}")
70
- step %(I check element "#{selector}")
71
- end
@@ -1,69 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Applitools
4
- module Calabash
5
- class Target
6
- include Applitools::FluentInterface
7
-
8
- attr_accessor :options, :ignored_regions, :region_to_check, :floating_regions
9
-
10
- def initialize
11
- self.ignored_regions = []
12
- self.floating_regions = []
13
- self.options = {
14
- trim: false
15
- }
16
- end
17
-
18
- def fully
19
- options[:stitch_content] = true
20
- self
21
- end
22
-
23
- def ignore(region = nil)
24
- if region
25
- Applitools::ArgumentGuard.is_a? region, 'region', Applitools::Calabash::CalabashElement
26
- ignored_regions << region.region
27
- else
28
- self.ignored_regions = []
29
- end
30
- self
31
- end
32
-
33
- def region(region = nil)
34
- if region
35
- case region
36
- when Applitools::Calabash::CalabashElement, Applitools::Region
37
- self.region_to_check = region
38
- else
39
- self.region_to_check = nil
40
- raise(
41
- Applitools::EyesIllegalArgument,
42
- 'Expected region to be instance of Applitools::Calabash::CalabashElement or Applitools::Region'
43
- )
44
- end
45
- else
46
- self.region_to_check = nil
47
- end
48
- self
49
- end
50
-
51
- # def floating(*args)
52
- # value = case args.first
53
- # when Applitools::FloatingRegion
54
- # proc { args.first.scale_it!(scale_factor) }
55
- # when Applitools::Region
56
- # proc do
57
- # region = args.shift
58
- # region.scale_it!(scale_factor)
59
- # Applitools::FloatingRegion.new region.left, region.top, region.width, region.height, *args
60
- # end
61
- # else
62
- # self.floating_regions = []
63
- # end
64
- # floating_regions << value
65
- # self
66
- # end
67
- end
68
- end
69
- end
@@ -1,74 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Applitools
4
- module Calabash
5
- module Utils
6
- extend self
7
-
8
- def create_directories(eyes_settings)
9
- FileUtils.mkpath(
10
- File.join(Dir.getwd, eyes_settings.tmp_dir, eyes_settings.screenshot_dir)
11
- )
12
- FileUtils.mkpath(
13
- File.join(Dir.getwd, eyes_settings.log_dir)
14
- )
15
- end
16
-
17
- def clear_directories(eyes_settings)
18
- tmp_dir = File.join Dir.getwd, eyes_settings.tmp_dir
19
- log_dir = File.join Dir.getwd, eyes_settings.log_dir
20
-
21
- FileUtils.remove_dir(tmp_dir) if File.exist?(tmp_dir)
22
- FileUtils.remove_dir(log_dir) if File.exist?(log_dir)
23
- end
24
-
25
- def using_screenshot(context)
26
- return unless block_given?
27
- screenshot_options = Applitools::Calabash::EyesSettings.instance.screenshot_names.next
28
- yield context.screenshot(screenshot_options)
29
- end
30
-
31
- def region_from_element(element)
32
- region = Applitools::Region.new(
33
- element['rect']['x'],
34
- element['rect']['y'],
35
- element['rect']['width'],
36
- element['rect']['height']
37
- )
38
- return region if Applitools::Calabash::EnvironmentDetector.android?
39
- region.scale_it!(Applitools::Calabash::EyesSettings.instance.eyes.density)
40
- end
41
-
42
- def request_element(context, element, method)
43
- Applitools::ArgumentGuard.is_a?(element, 'element', Applitools::Calabash::CalabashElement)
44
- context.query(element.element_query, method)
45
- end
46
-
47
- def grub_android_class_name(context, element)
48
- request_element(context, element, :class)
49
- end
50
-
51
- def grub_ios_class_name(context, element)
52
- request_element(context, element, :className)
53
- end
54
-
55
- def get_android_element(context, query, index)
56
- element_query = if (id = context.query(query, :getId)[index.to_i]) && id > 0
57
- "* id:#{id}"
58
- else
59
- query + " index:#{index.to_i}"
60
- end
61
- element = context.query(element_query).first
62
- Applitools::Calabash::CalabashElement.new(element, element_query)
63
- end
64
-
65
- def get_ios_element(context, query, index)
66
- hash = context.query(query, :hash)[index.to_i]
67
- return unless hash
68
- element_query = "* hash:#{hash}"
69
- element = context.query(element_query).first
70
- Applitools::Calabash::CalabashElement.new(element, element_query)
71
- end
72
- end
73
- end
74
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Applitools::Calabash.require_environment(
4
- 'applitools/calabash/steps/matchers',
5
- Applitools::Calabash::EnvironmentDetector.current_environment
6
- )
7
-
8
- Applitools::Calabash.require_environment(
9
- 'applitools/calabash/steps/eyes_settings',
10
- Applitools::Calabash::EnvironmentDetector.current_environment
11
- )
12
-
13
- Applitools::Calabash.require_environment(
14
- 'applitools/calabash/steps/eyes_session',
15
- Applitools::Calabash::EnvironmentDetector.current_environment
16
- )
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Applitools
4
- module Selenium
5
- module Capybara
6
- module CapybaraSettings
7
- # Registers Capybara driver which will be used by eyes and sets it as default Capybara driver.
8
- # The name of the driver is :eyes, and the driver is a descendant of class Capybara::Selenium::Driver.
9
- # Options are eventually passed to drivers constructor
10
- # @param [Hash] options
11
- # @example
12
- # Applitools.register_capybara_driver :browser => :chrome
13
- # @example
14
- # Applitools.register_capybara_driver :browser => :remote, :url => 'remote_url', :desired_capabilities => {}
15
- def register_capybara_driver(options = {})
16
- ::Capybara.register_driver :eyes do |app|
17
- Applitools::Selenium::Capybara::Driver.new app, options
18
- end
19
- ::Capybara.default_driver = :eyes
20
- ::Capybara.javascript_driver = :eyes
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- if defined? Capybara::Selenium::Driver
4
- module Applitools::Selenium::Capybara
5
- # @!visibility private
6
- class Driver < Capybara::Selenium::Driver
7
- def driver_for_eyes(eyes)
8
- browser eyes: eyes
9
- end
10
-
11
- def browser(options = {})
12
- eyes = options.delete(:eyes)
13
- @native_browser ||= super()
14
- unless eyes.nil?
15
- is_mobile_device = @browser.capabilities['platformName'] ? true : false
16
- @browser = Applitools::Selenium::Driver.new eyes,
17
- options.merge(driver: @browser, is_mobile_device: is_mobile_device)
18
- end
19
- @browser
20
- end
21
-
22
- def use_native_browser
23
- @browser = @native_browser
24
- end
25
- end
26
- end
27
- end
28
-
29
- if defined? ::Capybara::Session
30
- ::Capybara::Session.class_eval do
31
- def driver_for_eyes(eyes)
32
- driver.driver_for_eyes eyes
33
- end
34
-
35
- def use_native_browser
36
- driver.use_native_browser if driver.respond_to? :use_native_browser
37
- end
38
- end
39
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rspec/expectations'
4
-
5
- RSpec::Matchers.define :match_baseline do |expected, tag|
6
- match do |actual|
7
- unless expected.is_a? Applitools::EyesBase
8
- raise Applitools::EyesIllegalArgument.new(
9
- "Expected #{expected} to be a Applitools::EyesBase instance, but got #{expected.class.name}."
10
- )
11
- end
12
-
13
- eyes_selenium_target = Applitools::ClassName.new('Applitools::Selenium::Target')
14
- eyes_images_target = Applitools::ClassName.new('Applitools::Images::Target')
15
-
16
- case actual
17
- when eyes_selenium_target, eyes_images_target
18
- result = expected.check(tag, actual)
19
- return result if [TrueClass, FalseClass].include?(result.class)
20
- return result.as_expected? if result.respond_to? :as_expected?
21
- else
22
- false
23
- end
24
- end
25
- end
@@ -1,57 +0,0 @@
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 other_filepaths
14
- in_gem_path = File.join('gems', server_lib.full_name, 'ext', 'eyes-universal', filename)
15
- Gem.path.map {|path| File.expand_path(in_gem_path, path) }
16
- end
17
-
18
- def executable_filepath
19
- raise 'Universal server not Found' if server_lib.nil?
20
- return filepath if valid_file?(filepath)
21
- core_path = other_filepaths.find {|path| valid_file?(path) }
22
- return core_path if core_path
23
- raise 'Universal server unrecognized'
24
- end
25
-
26
- private
27
-
28
- def server_lib
29
- Gem::Specification.find_by_name(SERVER_GEM_NAME)
30
- rescue Gem::MissingSpecError
31
- nil
32
- end
33
-
34
- def filename
35
- return 'core-win.exe' if Gem.win_platform?
36
- case RUBY_PLATFORM
37
- when /darwin/i
38
- 'core-macos'
39
- when /arm/i
40
- 'core-linux-arm64'
41
- when /mswin|windows|mingw/i
42
- 'core-win.exe'
43
- when /musl/i
44
- 'core-alpine'
45
- when /linux|arch/i
46
- 'core-linux'
47
- else
48
- raise 'Unsupported platform'
49
- end
50
- end
51
-
52
- def valid_file?(path)
53
- File.exist?(path) && File.executable?(path)
54
- end
55
-
56
- end
57
- end
@@ -1,79 +0,0 @@
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, 'universal', '--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,8 +0,0 @@
1
- # frozen_string_literal: false
2
-
3
- module Applitools
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
- end
data/lib/eyes_consts.rb DELETED
@@ -1,4 +0,0 @@
1
- module Applitools
2
- JS_PATH = 'lib/applitools/selenium/scripts/node_modules'.freeze
3
- SCRIPT_TEMPLATES_PATH = 'lib/applitools/selenium/scripts'.freeze
4
- end
data/lib/eyes_rspec.rb DELETED
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
- #
3
-
4
- Applitools.require_dir('rspec') if defined? RSpec