Module: Applitools::FluentInterface

Includes:
MatchLevelSetter
Included in:
Appium::Target, Calabash::Target
Defined in:
lib/applitools/core/fluent_interface.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from MatchLevelSetter

#match_level_with_exact

Class Method Details

.included(base) ⇒ Object



7
8
9
10
11
12
# File 'lib/applitools/core/fluent_interface.rb', line 7

def self.included(base)
  base.define_singleton_method(:===) do |other|
    return name == other if other.is_a? String
    super(other)
  end
end

Instance Method Details

#enable_patterns(value = true) ⇒ Object



53
54
55
56
# File 'lib/applitools/core/fluent_interface.rb', line 53

def enable_patterns(value = true)
  options[:enable_patterns] = value ? true : false
  self
end

#ignore_caret(value = true) ⇒ Object



14
15
16
17
# File 'lib/applitools/core/fluent_interface.rb', line 14

def ignore_caret(value = true)
  options[:ignore_caret] = value ? true : false
  self
end

#ignore_displacements(value = true) ⇒ Object



19
20
21
22
# File 'lib/applitools/core/fluent_interface.rb', line 19

def ignore_displacements(value = true)
  options[:ignore_displacements] = value ? true : false
  self
end

#ignore_mismatch(value) ⇒ Object



34
35
36
37
# File 'lib/applitools/core/fluent_interface.rb', line 34

def ignore_mismatch(value)
  options[:ignore_mismatch] = value ? true : false
  self
end

#match_level(value, exact_options = {}) ⇒ Target

Sets match_level for current test

Parameters:

  • value (Symbol)

    Can be one of allowed match levels - :none, :layout, :layout2, :content, :strict or :exact

  • exact_options (Hash) (defaults to: {})

    exact options are used only for :exact match level

Options Hash (exact_options):

  • :min_diff_intensity (Integer)
  • :min_diff_width (Integer)
  • :min_diff_height (Integer)
  • :match_threshold (Integer)

Returns:

  • (Target)

    Applitools::Selenium::Target or Applitools::Images::target



48
49
50
51
# File 'lib/applitools/core/fluent_interface.rb', line 48

def match_level(value, exact_options = {})
  options[:match_level], options[:exact] = match_level_with_exact(value, exact_options)
  self
end

#timeout(value) ⇒ Object



24
25
26
27
# File 'lib/applitools/core/fluent_interface.rb', line 24

def timeout(value)
  options[:timeout] = value.to_i
  self
end

#trim(value = true) ⇒ Object



29
30
31
32
# File 'lib/applitools/core/fluent_interface.rb', line 29

def trim(value = true)
  options[:trim] = value ? true : false
  self
end