Class: Gametel::Platforms::BrazenheadPlatform

Inherits:
Object
  • Object
show all
Includes:
Brazenhead, Basic, Button, ListItem, Menu, Progress, Spinner, Text, View, Webview
Defined in:
lib/gametel/platforms/brazenhead_platform.rb

Constant Summary collapse

ENTER_KEY =
66

Constants included from Progress

Progress::PROGRESS_BAR_CLASS

Instance Method Summary collapse

Methods included from Webview

#clear_text_in_webview, #click_on_webview, #enter_text_in_webview, #find_web_element_by

Methods included from Menu

#click_menu_by_id, #click_menu_by_text

Methods included from ListItem

#get_class, #list_item, #list_item_has_image, #press_list_item, #text_from_list_item

Methods included from View

#click_on_view_by_class, #click_on_view_by_id, #get_view_by_id, #get_view_by_index

Methods included from Text

#clear_text_by_id, #enter_text_by_id, #enter_text_by_index, #get_text_by_id, #get_text_by_index, #get_text_description_by_id, #get_text_hint_by_id

Methods included from Spinner

#get_spinner_value_by_id, #get_spinner_value_by_index, #select_spinner_value_by_id

Methods included from Progress

#get_progress, #get_progress_max, #get_secondary_progress, #set_progress, #set_secondary_progress

Methods included from Button

#get_button_by_index, #get_button_by_text

Methods included from Basic

#is_enabled_by_id

Instance Method Details

#backObject

press the back button



184
185
186
# File 'lib/gametel/platforms/brazenhead_platform.rb', line 184

def back
  result = go_back
end

#clear_text(locator) ⇒ Object

clear the text in a text box



65
66
67
68
# File 'lib/gametel/platforms/brazenhead_platform.rb', line 65

def clear_text(locator)
  clear_edit_text(locator[:index]) if locator[:index]
  clear_text_by_id(locator[:id]) if locator[:id]
end

#click_checkbox(locator) ⇒ Object

click a checkbox



82
83
84
85
86
# File 'lib/gametel/platforms/brazenhead_platform.rb', line 82

def click_checkbox(locator)
  result = click_on_check_box(locator[:index]) if locator[:index]
  result = click_on_text(locator[:text]) if locator[:text]
  result = click_on_view_by_id(locator[:id]) if locator[:id]
end

#click_image(locator) ⇒ Object

click an image



100
101
102
103
# File 'lib/gametel/platforms/brazenhead_platform.rb', line 100

def click_image(locator)
  result = click_on_image(locator[:index]) if locator[:index]
  result = click_on_view_by_id(locator[:id]) if locator[:id]
end

#click_menu(locator) ⇒ Object

click a menu item



108
109
110
111
# File 'lib/gametel/platforms/brazenhead_platform.rb', line 108

def click_menu(locator)
  click_menu_by_id(locator[:id]) if locator[:id]
  click_menu_by_text(locator[:text]) if locator[:text]
end

#click_radio_button(locator) ⇒ Object

click a radio button



91
92
93
94
95
# File 'lib/gametel/platforms/brazenhead_platform.rb', line 91

def click_radio_button(locator)
  result = click_on_text(locator[:text]) if locator[:text]
  result = click_on_view_by_id(locator[:id]) if locator[:id]
  result = click_on_radio_button(locator[:index]) if locator[:index]
end

#click_view(locator) ⇒ Object

click a view



133
134
135
136
137
# File 'lib/gametel/platforms/brazenhead_platform.rb', line 133

def click_view(locator)
  result = click_on_text(locator[:text]) if locator[:text]
  result = click_on_view_by_id(locator[:id]) if locator[:id]
  result = click_on_view_by_class(locator[:class], locator[:index]) if locator[:class]
end

#enabled?(locator) ⇒ Boolean

determine if a view is enabled

Returns:

  • (Boolean)


176
177
178
179
# File 'lib/gametel/platforms/brazenhead_platform.rb', line 176

def enabled?(locator)
  result = is_enabled_by_id(locator)
  result.body == 'true'
end

#enterObject

press the enter key



191
192
193
# File 'lib/gametel/platforms/brazenhead_platform.rb', line 191

def enter
  result = send_key ENTER_KEY
end

#enter_text(text, locator) ⇒ Object

enter text in a text box



57
58
59
60
# File 'lib/gametel/platforms/brazenhead_platform.rb', line 57

def enter_text(text, locator)
  enter_text_by_index(locator[:index], text) if locator[:index]
  enter_text_by_id(locator[:id], text) if locator[:id]
end

#get_spinner_value(locator) ⇒ Object

get the selected spinner value



116
117
118
119
120
# File 'lib/gametel/platforms/brazenhead_platform.rb', line 116

def get_spinner_value(locator)
  result = get_spinner_value_by_id(locator[:id]) if locator[:id]
  result = get_spinner_value_by_index(locator[:index]) if locator[:index]
  last_json
end

#get_text(locator) ⇒ Object

get text



32
33
34
35
36
# File 'lib/gametel/platforms/brazenhead_platform.rb', line 32

def get_text(locator)
  result = get_text_by_id(locator[:id]) if locator[:id]
  result = get_text_by_index(locator[:index]) if locator[:index]
  last_json
end

#get_text_description(locator) ⇒ Object

get the content description



49
50
51
52
# File 'lib/gametel/platforms/brazenhead_platform.rb', line 49

def get_text_description(locator)
  result = get_text_description_by_id(locator[:id])
  last_json
end

#get_text_hint(locator) ⇒ Object

get the hint text



41
42
43
44
# File 'lib/gametel/platforms/brazenhead_platform.rb', line 41

def get_text_hint(locator)
  result = get_text_hint_by_id(locator[:id])
  last_json
end

#has_drawable?(locator) ⇒ Boolean

return if a view has a drawable

Returns:

  • (Boolean)


163
164
165
166
167
168
169
170
171
# File 'lib/gametel/platforms/brazenhead_platform.rb', line 163

def has_drawable?(locator)
  begin
    view = get_view_by_id(locator[:id]) if locator[:id]
    view = get_image(locator[:index]) if locator[:index]
    last_json['hasDrawable']
  rescue Exception
    false
  end
end

#has_text?(text) ⇒ Boolean

determine if text exists on the screen and visible

Returns:

  • (Boolean)


142
143
144
145
# File 'lib/gametel/platforms/brazenhead_platform.rb', line 142

def has_text?(text)
  result = search_text(text, true)
  result.body == 'true'
end

#has_view?(locator) ⇒ Boolean

determine if a view exists

Returns:

  • (Boolean)


150
151
152
153
154
155
156
157
158
# File 'lib/gametel/platforms/brazenhead_platform.rb', line 150

def has_view?(locator)
  begin
    result = get_view_by_id(locator[:id]) if locator[:id]
    result = get_view_by_index(locator[:class], locator[:index]) if locator[:class]
    result.body.include? 'windowLocation'
  rescue Exception
    false
  end
end

#press_button(locator) ⇒ Object

press a button



73
74
75
76
77
# File 'lib/gametel/platforms/brazenhead_platform.rb', line 73

def press_button(locator)
  result = click_on_button(locator[:text]) if locator[:text]
  result = click_on_button(locator[:index]) if locator[:index]
  result = click_on_view_by_id(locator[:id]) if locator[:id]
end

#select_spinner_value(locator, index) ⇒ Object

select the spinner value using the item’s index



125
126
127
128
# File 'lib/gametel/platforms/brazenhead_platform.rb', line 125

def select_spinner_value(locator, index)
  result = select_spinner_value_by_id(locator[:id], index) if locator[:id]
  result = press_spinner_item(locator[:index], index) if locator[:index]
end