Module: Applitools::UniversalEyesChecks

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

Instance Method Summary collapse

Instance Method Details

#universal_check(name, target) ⇒ Applitools::MatchResult

Takes a snapshot and matches it with the expected output.

Parameters:

  • name (String)

    The name of the tag.

  • target (Applitools::Selenium::Target)

    which area of the window to check.

Returns:

Raises:

  • (Applitools::EyesNotOpenException)


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/applitools/core/universal_eyes_checks.rb', line 11

def universal_check(name, target)
  return disabled_result if respond_to?(:disabled?) && disabled?

  raise Applitools::EyesNotOpenException.new('Eyes not open!') if @universal_eyes.nil?
  Applitools::EyesLogger.logger.info "#{test_name} : check(#{name}) started  ..."
  # require 'pry'
  # binding.pry
  check_result = @universal_eyes.check(get_universal_check_settings(name, target))
  if server_error?(check_result)
    # require 'pry'
    # binding.pry
    raise Applitools::EyesError.new("Request failed: #{check_result[:message]}")
  end

  if check_result != {}
    result = Applitools::MatchResult.new(Applitools::Utils.deep_stringify_keys(check_result))

    check_fail_result_processing(name) unless result.as_expected?
  end

  logger.info 'Done!'
end