Module: Honeydew::DeviceMatchers

Included in:
Device
Defined in:
lib/honeydew/device_matchers.rb

Instance Method Summary collapse

Instance Method Details

#has_app_installed?(package_name) ⇒ Boolean

Returns:

  • (Boolean)


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

def has_app_installed?(package_name)
  installed_packages.include?(package_name)
end

#has_app_installed_in_data?(package_name) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/honeydew/device_matchers.rb', line 4

def has_app_installed_in_data?(package_name)
  packages_in_data.grep(/#{package_name}/).count > 0
end

#has_button?(button_text) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/honeydew/device_matchers.rb', line 36

def has_button?(button_text)
  perform_assertion :is_button_present, :text => button_text
end

#has_child_count?(parent_element_description, child_element_description, child_count) ⇒ Boolean

TODO: Look for a better way to express these similar looking matchers

Returns:

  • (Boolean)


41
42
43
44
45
46
# File 'lib/honeydew/device_matchers.rb', line 41

def has_child_count?(parent_element_description, child_element_description, child_count)
  perform_assertion :is_child_count_equal_to,
    :parent_description => parent_element_description,
     :child_description => child_element_description,
     :child_count => child_count
end

#has_child_count_greater_than?(parent_element_description, child_element_description, child_count) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
51
52
53
# File 'lib/honeydew/device_matchers.rb', line 48

def has_child_count_greater_than?(parent_element_description, child_element_description, child_count)
  perform_assertion :is_child_count_greater_than,
    :parent_description => parent_element_description,
     :child_description => child_element_description,
     :child_count => child_count
end

#has_edit_text?(text) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/honeydew/device_matchers.rb', line 20

def has_edit_text?(text)
  perform_assertion :is_text_present, :text => text, :type => 'EditText'
end

#has_element_with_description?(description) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/honeydew/device_matchers.rb', line 16

def has_element_with_description?(description)
  perform_assertion :is_text_present, :description => description
end

#has_element_with_nested_text?(parent_description, child_text) ⇒ Boolean

Returns:

  • (Boolean)


55
56
57
58
59
# File 'lib/honeydew/device_matchers.rb', line 55

def has_element_with_nested_text?(parent_description, child_text)
  perform_assertion :is_element_with_nested_text_present,
    :parent_description => parent_description,
     :child_text => child_text
end

#has_regex_match?(regex) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/honeydew/device_matchers.rb', line 12

def has_regex_match?(regex)
  perform_assertion :is_regex_match_present, :regex => regex
end

#has_settings_menu_item?(item_name) ⇒ Boolean

Returns:

  • (Boolean)


75
76
77
78
# File 'lib/honeydew/device_matchers.rb', line 75

def has_settings_menu_item?(item_name)
  perform_assertion :has_settings_menu_item,
    :menuName => item_name
end

#has_text?(text) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/honeydew/device_matchers.rb', line 8

def has_text?(text)
  perform_assertion :is_text_present, :text => text
end

#has_text_disappear?(text) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/honeydew/device_matchers.rb', line 28

def has_text_disappear?(text)
  perform_assertion :is_text_gone, :text => text, :type => 'TextView'
end

#has_textview_text?(text) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/honeydew/device_matchers.rb', line 24

def has_textview_text?(text)
  perform_assertion :is_text_present, :text => text, :type => 'TextView'
end

#has_textview_with_text_and_description?(text, description) ⇒ Boolean

Returns:

  • (Boolean)


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

def has_textview_with_text_and_description?(text, description)
  perform_assertion :is_text_present, :text => text, :description => description, :type => 'TextView'
end

#is_option_in_setting_disabled?(item_name, option_names) ⇒ Boolean

Returns:

  • (Boolean)


70
71
72
73
# File 'lib/honeydew/device_matchers.rb', line 70

def is_option_in_setting_disabled?(item_name, option_names)
  perform_assertion :is_option_in_settings_menu_disabled,
    :menuName => item_name, :optionNames => option_names
end

#is_option_in_setting_enabled?(item_name, option_names) ⇒ Boolean

Returns:

  • (Boolean)


65
66
67
68
# File 'lib/honeydew/device_matchers.rb', line 65

def is_option_in_setting_enabled?(item_name, option_names)
  perform_assertion :is_option_in_settings_menu_enabled,
    :menuName => item_name, :optionNames => option_names
end