Module: Gametel
- Includes:
- Waiter
- Included in:
- Driver
- Defined in:
- lib/gametel.rb,
lib/gametel/driver.rb,
lib/gametel/waiter.rb,
lib/gametel/version.rb,
lib/gametel/accessors.rb,
lib/gametel/navigation.rb,
lib/gametel/views/text.rb,
lib/gametel/views/view.rb,
lib/gametel/views/image.rb,
lib/gametel/views/button.rb,
lib/gametel/views/spinner.rb,
lib/gametel/views/checkbox.rb,
lib/gametel/views/progress.rb,
lib/gametel/views/list_item.rb,
lib/gametel/views/radio_button.rb,
lib/gametel/platforms/brazenhead/text.rb,
lib/gametel/platforms/brazenhead/view.rb,
lib/gametel/platforms/brazenhead/basic.rb,
lib/gametel/platforms/brazenhead/button.rb,
lib/gametel/platforms/brazenhead/spinner.rb,
lib/gametel/platforms/brazenhead/progress.rb,
lib/gametel/platforms/brazenhead_platform.rb,
lib/gametel/platforms/brazenhead/list_item.rb
Defined Under Namespace
Modules: Accessors, Navigation, Platforms, Views, Waiter Classes: Driver
Constant Summary collapse
- ROBOTIUM_LEFT =
21
- ROBOTIUM_RIGHT =
22
- VERSION =
"0.6"
Instance Attribute Summary collapse
-
#platform ⇒ Object
readonly
Returns the value of attribute platform.
Class Method Summary collapse
- .apk_path=(path) ⇒ Object
- .default_driver ⇒ Object
- .default_server ⇒ Object
- .included(cls) ⇒ Object
- .keystore=(keystore) ⇒ Object
- .start(activity) ⇒ Object
- .stop ⇒ Object
Instance Method Summary collapse
-
#back ⇒ Object
Press the back button.
-
#back_to(activity) ⇒ Object
Go back to a specific activity.
- #current_activity ⇒ Object
-
#enabled?(locator) ⇒ Boolean
Returns true if the view is enabled.
-
#enter ⇒ Object
Press the enter key.
-
#has_text?(text) ⇒ Boolean
Returns true if the provided text is found on the screen.
-
#has_view?(locator) ⇒ Boolean
Returns true if a view exists.
- #initialize(pform = :brazenhead) ⇒ Object
-
#scroll_down ⇒ Object
scroll down.
-
#scroll_left ⇒ Object
scroll left.
-
#scroll_right ⇒ Object
scroll right.
-
#scroll_up ⇒ Object
scroll up.
-
#wait_for_text(text_to_find) ⇒ Object
Wait for the provided text to appear.
Methods included from Waiter
Instance Attribute Details
#platform ⇒ Object (readonly)
Returns the value of attribute platform.
13 14 15 |
# File 'lib/gametel.rb', line 13 def platform @platform end |
Class Method Details
.apk_path=(path) ⇒ Object
22 23 24 |
# File 'lib/gametel.rb', line 22 def self.apk_path=(path) @apk_path = path end |
.default_driver ⇒ Object
30 31 32 |
# File 'lib/gametel.rb', line 30 def self.default_driver @default_driver ||= Gametel::Driver.new end |
.default_server ⇒ Object
34 35 36 37 38 |
# File 'lib/gametel.rb', line 34 def self.default_server = [@apk_path] << @keystore if @keystore @default_server ||= Brazenhead::Server.new * end |
.included(cls) ⇒ Object
18 19 20 |
# File 'lib/gametel.rb', line 18 def self.included(cls) cls.extend Gametel::Accessors end |
.keystore=(keystore) ⇒ Object
26 27 28 |
# File 'lib/gametel.rb', line 26 def self.keystore=(keystore) @keystore = keystore end |
.start(activity) ⇒ Object
40 41 42 43 |
# File 'lib/gametel.rb', line 40 def self.start(activity) default_server.start(activity) default_driver end |
.stop ⇒ Object
45 46 47 |
# File 'lib/gametel.rb', line 45 def self.stop default_server.stop end |
Instance Method Details
#back ⇒ Object
Press the back button
77 78 79 |
# File 'lib/gametel.rb', line 77 def back platform.back end |
#back_to(activity) ⇒ Object
Go back to a specific activity
84 85 86 |
# File 'lib/gametel.rb', line 84 def back_to(activity) platform.go_back_to_activity activity end |
#current_activity ⇒ Object
88 89 90 91 92 93 94 95 96 |
# File 'lib/gametel.rb', line 88 def current_activity platform.chain_calls do |device| device.get_current_activity device.get_class device.get_simple_name end platform.last_response.body.gsub('"','') end |
#enabled?(locator) ⇒ Boolean
Returns true if the view is enabled
63 64 65 |
# File 'lib/gametel.rb', line 63 def enabled?(locator) platform.enabled?(locator) end |
#enter ⇒ Object
Press the enter key
101 102 103 |
# File 'lib/gametel.rb', line 101 def enter platform.enter end |
#has_text?(text) ⇒ Boolean
Returns true if the provided text is found on the screen
56 57 58 |
# File 'lib/gametel.rb', line 56 def has_text?(text) platform.has_text?(text) end |
#has_view?(locator) ⇒ Boolean
Returns true if a view exists
70 71 72 |
# File 'lib/gametel.rb', line 70 def has_view?(locator) platform.has_view?(locator) end |
#initialize(pform = :brazenhead) ⇒ Object
49 50 51 |
# File 'lib/gametel.rb', line 49 def initialize(pform = :brazenhead) @platform = Gametel::Platforms::BrazenheadPlatform.new if pform == :brazenhead end |
#scroll_down ⇒ Object
scroll down
108 109 110 |
# File 'lib/gametel.rb', line 108 def scroll_down platform.scroll_down end |
#scroll_left ⇒ Object
scroll left
122 123 124 |
# File 'lib/gametel.rb', line 122 def scroll_left platform.scroll_to_side ROBOTIUM_LEFT end |
#scroll_right ⇒ Object
scroll right
129 130 131 |
# File 'lib/gametel.rb', line 129 def scroll_right platform.scroll_to_side ROBOTIUM_RIGHT end |
#scroll_up ⇒ Object
scroll up
115 116 117 |
# File 'lib/gametel.rb', line 115 def scroll_up platform.scroll_up end |
#wait_for_text(text_to_find) ⇒ Object
Wait for the provided text to appear
136 137 138 139 |
# File 'lib/gametel.rb', line 136 def wait_for_text(text_to_find) platform.wait_for_text(text_to_find) raise "Timed out waiting for the text '#{text_to_find}'" unless platform.last_json end |