Module: Honeydew::DeviceMatchers

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

Instance Method Summary collapse

Instance Method Details

#child_count_assertion(count_type, parent_description, child_description, child_count) ⇒ Object



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

def child_count_assertion count_type, parent_description, child_description, child_count
  assertion_type = "is_child_count_#{count_type}".to_sym
  perform_assertion assertion_type,
                    :parent_description => parent_description,
                    :child_description => child_description,
                    :child_count => child_count
end

#has_app_installed?(package_name) ⇒ Boolean

Returns:

  • (Boolean)


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

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_description, child_description, child_count) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/honeydew/device_matchers.rb', line 40

def has_child_count? parent_description, child_description, child_count
  child_count_assertion 'equal_to', parent_description, child_description, child_count
end

#has_child_count_greater_than?(parent_description, child_description, child_count) ⇒ Boolean

Returns:

  • (Boolean)


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

def has_child_count_greater_than? parent_description, child_description, child_count
  child_count_assertion 'greater_than', parent_description, child_description, 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)


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

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)


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

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)


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

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)


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

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