Module: Applitools::UniversalEyesOpen

Included in:
EyesBase
Defined in:
lib/applitools/core/universal_eyes_open.rb

Instance Method Summary collapse

Instance Method Details

#universal_open(options = {}) ⇒ Applitools::Selenium::Driver

Starts a test

Options Hash (options):

  • :driver (Object)

    The driver that controls the browser hosting the application under the test. (Required option)

  • :app_name (String)

    The name of the application under the test. (Required option)

  • :test_name (String)

    The test name (Required option)

  • :viewport_size (String | Hash)

    The required browser’s viewport size (i.e., the visible part of the document’s body) or nil to use the current window’s viewport.

  • :session_type (Object)

    The type of the test (e.g., standard test / visual performance test). Default value is ‘SEQUENTAL’



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/applitools/core/universal_eyes_open.rb', line 19

def universal_open(options = {})
  original_driver = options.delete(:driver)
  Applitools::ArgumentGuard.not_nil original_driver, 'options[:driver]'

  if respond_to?(:disabled?) && disabled?
    logger.info('Ignored')
    return original_driver
  end

  self.driver = Applitools::Selenium::SeleniumEyes.eyes_driver(original_driver, self)

  update_config_from_options(options)
  universal_driver_config = driver.universal_driver_config
  universal_eyes_manager = runner.get_universal_eyes_manager

  universal_eyes_config = Applitools::UniversalEyesConfig.new
  universal_eyes_config.from_original_sdk(self)

  # require('pry')
  # binding.pry

  @universal_eyes = universal_eyes_manager.open_eyes(universal_driver_config, universal_eyes_config.to_hash)
  raise Applitools::EyesNotOpenException.new('Eyes not open!') if @universal_eyes.nil?

  self.open = true if respond_to?(:open=, true)
  self.running_session = true if respond_to?(:running_session=, true)
  driver
rescue Applitools::EyesError => e
  logger.error e.message
  raise e
end

#universal_sdk_abortObject



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/applitools/core/universal_eyes_open.rb', line 51

def universal_sdk_abort
  if respond_to?(:disabled?) && disabled?
    logger.info "#{__method__} Ignore disabled"
    return false
  end
  # raise Applitools::EyesNotOpenException.new('Eyes not open!') if @eyes.nil?
  return if @universal_eyes.nil?
  result = @universal_eyes.abort

  if result.is_a? Hash
    logger.info "---Test aborted" if !result[:message] && !result[:stack]
  else
    # TestCheckFrameInFrame_Fully_Fluent_VG     # require('pry')
    # binding.pry
  end
end