Class: Applitools::UniversalEyesManager

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/applitools/universal_sdk/universal_eyes_manager.rb

Instance Method Summary collapse

Constructor Details

#initialize(manager, universal_client) ⇒ UniversalEyesManager

Returns a new instance of UniversalEyesManager.



11
12
13
14
15
# File 'lib/applitools/universal_sdk/universal_eyes_manager.rb', line 11

def initialize(manager, universal_client)
  @manager = manager
  @universal_client = universal_client
  @opened_eyes = []
end

Instance Method Details

#close_all_eyes(remove_duplicate_tests) ⇒ Object



40
41
42
43
# File 'lib/applitools/universal_sdk/universal_eyes_manager.rb', line 40

def close_all_eyes(remove_duplicate_tests)
  @opened_eyes.each {|universal_eye| universal_eye.closed_or_aborted = true }
  @universal_client.eyes_manager_close_all_eyes(@manager, remove_duplicate_tests)
end

#open_eyes(driver_config_json, config) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/applitools/universal_sdk/universal_eyes_manager.rb', line 17

def open_eyes(driver_config_json, config)
  # Applitools::EyesLogger.logger.debug "Driver: #{driver_config_json}"
  # Applitools::EyesLogger.logger.debug "open config: #{config}"

  @eyes = @universal_client.eyes_manager_make_eyes(@manager, driver_config_json, config)

  if @eyes[:message] === 'socket hang up'
    Applitools::EyesLogger.logger.error "#{Applitools::Connectivity::UniversalClient::EYES_MANAGER_MAKE_EYES} : socket hang up ; retry"
    @eyes = @universal_client.eyes_manager_make_eyes(@manager, driver_config_json, config)
  end
  if @eyes[:message] && @eyes[:stack]
    Applitools::EyesLogger.logger.error "Eyes not opened: #{@eyes[:message]}"
    Applitools::EyesLogger.logger.debug "Stack for #{Applitools::Connectivity::UniversalClient::EYES_MANAGER_MAKE_EYES} : #{@eyes[:stack]}"
    return nil
  end

  Applitools::EyesLogger.logger.debug "Eyes applitools-ref-id: #{@eyes[:"applitools-ref-id"]}"
  # U-Notes : !!! Eyes.new
  universal_eyes = Applitools::UniversalEyes.new(@eyes, @universal_client)
  @opened_eyes.push(universal_eyes)
  universal_eyes
end