Module: Gametel::Accessors
- Defined in:
- lib/gametel/accessors.rb
Instance Method Summary collapse
-
#activity(activity_name) ⇒ Object
Generates a method named active? which will wait for the activity to become active.
-
#button(name, locator) ⇒ Object
Generates a method to click a button and determine if it is enabled.
-
#checkbox(name, locator) ⇒ Object
Generates one method to click a checkbox.
-
#image(name, locator) ⇒ Object
Generaes method to interact with an image.
-
#list_item(name, locator) ⇒ Object
Generates one method to click a list item.
-
#progress(name, locator) ⇒ Object
Generates methods to get an set the progress as well as the secondary progress The only valid keys are: * :id * :index.
-
#radio_button(name, locator) ⇒ Object
Generates one method to click a radio button.
-
#spinner(name, locator) ⇒ Object
The only valid keys are: * :id * :index.
-
#text(name, locator) ⇒ Object
Generates methods to enter text into a text field, clear the text field, get the hint as well as the description.
-
#view(name, locator) ⇒ Object
Generates one method to click a view.
Instance Method Details
#activity(activity_name) ⇒ Object
Generates a method named active? which will wait for the activity to become active
returns true when successful
10 11 12 13 14 15 |
# File 'lib/gametel/accessors.rb', line 10 def activity(activity_name) define_method("active?") do platform.wait_for_activity activity_name platform.last_json end end |
#button(name, locator) ⇒ Object
Generates a method to click a button and determine if it is enabled.
keys are:
* :text
* :index
* :id
60 61 62 63 64 65 66 67 |
# File 'lib/gametel/accessors.rb', line 60 def (name, locator) define_method(name) do platform.(locator) end define_method("#{name}_view") do Gametel::Views::Button.new(platform, locator) end end |
#checkbox(name, locator) ⇒ Object
Generates one method to click a checkbox.
keys are:
* :text
* :index
* :id
117 118 119 120 121 122 123 124 |
# File 'lib/gametel/accessors.rb', line 117 def checkbox(name, locator) define_method(name) do platform.click_checkbox(locator) end define_method("#{name}_view") do Gametel::Views::CheckBox.new(platform, locator) end end |
#image(name, locator) ⇒ Object
Generaes method to interact with an image.
The only valid keys are:
* :index
245 246 247 248 249 250 251 252 253 254 255 256 257 |
# File 'lib/gametel/accessors.rb', line 245 def image(name, locator) define_method("click_#{name}") do platform.click_image(locator) end define_method("wait_for_#{name}") do wait_until do platform.has_drawable?(locator) end end define_method("#{name}_view") do Gametel::Views::Image.new(platform, locator) end end |
#list_item(name, locator) ⇒ Object
Generates one method to click a list item.
keys are:
* :text
* :index
* :list - only us with :index to indicate which list to use on
the screen. Default is 0
94 95 96 97 98 99 100 101 |
# File 'lib/gametel/accessors.rb', line 94 def list_item(name, locator) define_method(name) do platform.press_list_item(locator) end define_method("#{name}_view") do Gametel::Views::ListItem.new(platform, locator) end end |
#progress(name, locator) ⇒ Object
Generates methods to get an set the progress as well as the secondary progress The only valid keys are:
* :id
* :index
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/gametel/accessors.rb', line 183 def progress(name, locator) define_method("#{name}") do platform.get_progress(locator) end define_method("#{name}_max") do platform.get_progress_max(locator) end define_method("#{name}_secondary") do platform.get_secondary_progress(locator) end define_method("#{name}=") do |value| platform.set_progress(locator, value) end define_method("#{name}_secondary=") do |value| platform.set_secondary_progress(locator, value) end define_method("#{name}_view") do Gametel::Views::Progress.new(platform, locator) end end |
#radio_button(name, locator) ⇒ Object
Generates one method to click a radio button.
keys are:
* :text
* :index
* :id
140 141 142 143 144 145 146 147 |
# File 'lib/gametel/accessors.rb', line 140 def (name, locator) define_method(name) do platform.(locator) end define_method("#{name}_view") do Gametel::Views::RadioButton.new(platform, locator) end end |
#spinner(name, locator) ⇒ Object
The only valid keys are:
* :id
* :index
219 220 221 222 223 224 225 226 227 228 229 |
# File 'lib/gametel/accessors.rb', line 219 def spinner(name, locator) define_method(name) do platform.get_spinner_value(locator) end define_method("select_#{name}") do |value| platform.select_spinner_value(locator, value) end define_method("#{name}_view") do Gametel::Views::Spinner.new(platform, locator) end end |
#text(name, locator) ⇒ Object
Generates methods to enter text into a text field, clear the text field, get the hint as well as the description
keys are:
* :id
* :index
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/gametel/accessors.rb', line 31 def text(name, locator) define_method("#{name}") do platform.get_text(locator) end define_method("#{name}=") do |value| platform.enter_text(value, locator) end define_method("clear_#{name}") do platform.clear_text(locator) end define_method("#{name}_view") do Gametel::Views::Text.new(platform, locator) end end |
#view(name, locator) ⇒ Object
Generates one method to click a view. The only valid keys are:
* :id
* :text
161 162 163 164 165 166 167 168 |
# File 'lib/gametel/accessors.rb', line 161 def view(name, locator) define_method(name) do platform.click_view(locator) end define_method("#{name}_view") do Gametel::Views::View.new(platform, locator) end end |