Module: DotDiff

Defined in:
lib/dotdiff.rb,
lib/dotdiff/version.rb,
lib/dotdiff/comparer.rb,
lib/dotdiff/snapshot.rb,
lib/dotdiff/element_meta.rb,
lib/dotdiff/image/cropper.rb,
lib/dotdiff/command_wrapper.rb,
lib/dotdiff/comparible/base.rb,
lib/dotdiff/element_handler.rb,
lib/dotdiff/image/container.rb,
lib/dotdiff/threshold_calculator.rb,
lib/dotdiff/comparible/page_comparer.rb,
lib/dotdiff/comparible/element_comparer.rb

Defined Under Namespace

Modules: Comparible, Image Classes: CommandWrapper, Comparer, ElementHandler, ElementMeta, InvalidValueError, Snapshot, ThresholdCalculator, UnknownTypeError

Constant Summary collapse

SUPPORTED_THRESHOLD_TYPES =
%w[pixel percent].freeze
VERSION =
'4.0.0'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.failure_image_pathObject

Returns the value of attribute failure_image_path.



32
33
34
# File 'lib/dotdiff.rb', line 32

def failure_image_path
  @failure_image_path
end

.hide_elements_on_non_full_screen_screenshotObject



49
50
51
# File 'lib/dotdiff.rb', line 49

def hide_elements_on_non_full_screen_screenshot
  @hide_elements_on_non_full_screen_screenshot ||= false
end

.image_magick_diff_binObject



57
58
59
# File 'lib/dotdiff.rb', line 57

def image_magick_diff_bin
  @image_magick_diff_bin.to_s.strip
end

.image_magick_optionsObject



53
54
55
# File 'lib/dotdiff.rb', line 53

def image_magick_options
  @image_magick_options ||= '-fuzz 5% -metric AE'
end

.image_store_pathObject

Returns the value of attribute image_store_path.



32
33
34
# File 'lib/dotdiff.rb', line 32

def image_store_path
  @image_store_path
end

.overwrite_on_resaveObject

Returns the value of attribute overwrite_on_resave.



32
33
34
# File 'lib/dotdiff.rb', line 32

def overwrite_on_resave
  @overwrite_on_resave
end

.resave_base_imageObject



41
42
43
# File 'lib/dotdiff.rb', line 41

def resave_base_image
  @resave_base_image ||= false
end

.xpath_elements_to_hideObject



45
46
47
# File 'lib/dotdiff.rb', line 45

def xpath_elements_to_hide
  @xpath_elements_to_hide ||= []
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (DotDiff)

    the object that the method was called on



37
38
39
# File 'lib/dotdiff.rb', line 37

def configure
  yield self
end

.pixel_thresholdObject



61
62
63
# File 'lib/dotdiff.rb', line 61

def pixel_threshold
  @pixel_threshold ||= { type: 'pixel', value: 100 }
end

.pixel_threshold=(config) ⇒ Object



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/dotdiff.rb', line 65

def pixel_threshold=(config)
  unless config.class == Hash
    Kernel.warn '[Dotdiff deprecation] Pass a hash options instead of integer to support pixel/percentage threshold'
    @pixel_threshold = config
    return
  end

  unless SUPPORTED_THRESHOLD_TYPES.include?(config.fetch(:type))
    raise UnknownTypeError, "Unknown threshold type supports only: #{SUPPORTED_THRESHOLD_TYPES.join(',')}"
  end

  if config.fetch(:type) == 'percent' && config.fetch(:value) > 1
    raise InvalidValueError, 'Percent value should be a float between 0 and 1'
  end

  @pixel_threshold = config
end