lib/gametel.rb in gametel-0.7 vs lib/gametel.rb in gametel-0.8
- old
+ new
@@ -4,19 +4,17 @@
require 'gametel/navigation'
require 'gametel/waiter'
require 'gametel/version'
require 'gametel/platforms/brazenhead_platform'
require 'gametel/views'
+require 'gametel/webview'
+require 'gametel/webviewable'
module Gametel
include Gametel::Waiter
+ include Gametel::Webviewable
- attr_reader :platform
-
- ROBOTIUM_LEFT = 21
- ROBOTIUM_RIGHT = 22
-
def self.included(cls)
cls.extend Gametel::Accessors
end
def self.apk_path=(path)
@@ -44,29 +42,11 @@
def self.stop
default_server.stop
end
- def initialize(pform = :brazenhead)
- @platform = Gametel::Platforms::BrazenheadPlatform.new if pform == :brazenhead
- end
-
#
- # click on the provided text
- #
- def click_on_text(text)
- platform.click_on_text text
- end
-
- #
- # Returns true if the provided text is found on the screen
- #
- def has_text?(text)
- platform.has_text?(text)
- end
-
- #
# Returns true if the view is enabled
#
def enabled?(locator)
platform.enabled?(locator)
end
@@ -107,43 +87,8 @@
#
def enter
platform.enter
end
- #
- # scroll down
- #
- def scroll_down
- platform.scroll_down
- end
-
- #
- # scroll up
- #
- def scroll_up
- platform.scroll_up
- end
-
- #
- # scroll left
- #
- def scroll_left
- platform.scroll_to_side ROBOTIUM_LEFT
- end
-
- #
- # scroll right
- #
- def scroll_right
- platform.scroll_to_side ROBOTIUM_RIGHT
- end
-
- #
- # Wait for the provided text to appear
- #
- 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
end