Module: Gametel::Webviewable

Included in:
Gametel, Webview
Defined in:
lib/gametel/webviewable.rb

Constant Summary collapse

ROBOTIUM_LEFT =
21
ROBOTIUM_RIGHT =
22

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#platformObject (readonly)

Returns the value of attribute platform.



4
5
6
# File 'lib/gametel/webviewable.rb', line 4

def platform
  @platform
end

Instance Method Details

#click_on_text(text) ⇒ Object

click on the provided text



17
18
19
# File 'lib/gametel/webviewable.rb', line 17

def click_on_text(text)
  platform.click_on_text text
end

#has_text?(text) ⇒ Boolean

Returns true if the provided text is found on the screen

Returns:

  • (Boolean)


25
26
27
# File 'lib/gametel/webviewable.rb', line 25

def has_text?(text)
  platform.has_text?(text)
end

#initialize(pform = :brazenhead) ⇒ Object



10
11
12
# File 'lib/gametel/webviewable.rb', line 10

def initialize(pform = :brazenhead)
  @platform = Gametel::Platforms::BrazenheadPlatform.new if pform == :brazenhead
end

#scroll_downObject

scroll down



41
42
43
# File 'lib/gametel/webviewable.rb', line 41

def scroll_down
  platform.scroll_down
end

#scroll_leftObject

scroll left



55
56
57
# File 'lib/gametel/webviewable.rb', line 55

def scroll_left
  platform.scroll_to_side ROBOTIUM_LEFT
end

#scroll_rightObject

scroll right



62
63
64
# File 'lib/gametel/webviewable.rb', line 62

def scroll_right
  platform.scroll_to_side ROBOTIUM_RIGHT
end

#scroll_upObject

scroll up



48
49
50
# File 'lib/gametel/webviewable.rb', line 48

def scroll_up
  platform.scroll_up
end

#wait_for_text(text_to_find) ⇒ Object

Wait for the provided text to appear



33
34
35
36
# File 'lib/gametel/webviewable.rb', line 33

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