Class: Acouchi::Solo
- Inherits:
-
Object
- Object
- Acouchi::Solo
- Defined in:
- lib/acouchi/solo.rb
Constant Summary collapse
- MENU =
82
- LEFT =
21
- RIGHT =
22
Instance Method Summary collapse
- #all_content ⇒ Object
- #buttons ⇒ Object
- #clear_text(index = 0) ⇒ Object
- #click_image(index) ⇒ Object
- #click_menu_item(text, options = {}) ⇒ Object
- #click_text(text, options = {}) ⇒ Object
- #click_view(id) ⇒ Object
- #content ⇒ Object
- #enter_text(text, index = 0) ⇒ Object
- #go_back ⇒ Object
- #has_button?(text) ⇒ Boolean
- #has_text?(text, options = {}) ⇒ Boolean
-
#initialize(configuration) ⇒ Solo
constructor
A new instance of Solo.
- #scroll_down ⇒ Object
- #scroll_down_list(index = 0) ⇒ Object
- #scroll_to_left ⇒ Object
- #scroll_to_right ⇒ Object
- #scroll_up ⇒ Object
- #scroll_up_list(index = 0) ⇒ Object
- #send_key(key) ⇒ Object
- #text_views ⇒ Object
- #views ⇒ Object
- #wait_for_text(text, options = {}) ⇒ Object
Constructor Details
#initialize(configuration) ⇒ Solo
Returns a new instance of Solo.
10 11 12 |
# File 'lib/acouchi/solo.rb', line 10 def initialize(configuration) @configuration = configuration end |
Instance Method Details
#all_content ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'lib/acouchi/solo.rb', line 56 def all_content all_content = [] until scroll_up == false; end begin all_content << text_views.map {|t| t["text"]} end while scroll_down all_content << text_views.map {|t| t["text"]} all_content.flatten.uniq end |
#buttons ⇒ Object
40 41 42 |
# File 'lib/acouchi/solo.rb', line 40 def call_method("getCurrentButtons") end |
#clear_text(index = 0) ⇒ Object
22 23 24 |
# File 'lib/acouchi/solo.rb', line 22 def clear_text index=0 call_method("clearEditText", [index]) end |
#click_image(index) ⇒ Object
96 97 98 |
# File 'lib/acouchi/solo.rb', line 96 def click_image index call_method("clickOnImage", [index]) end |
#click_menu_item(text, options = {}) ⇒ Object
78 79 80 81 82 83 84 85 86 |
# File 'lib/acouchi/solo.rb', line 78 def text, ={} = { :sub_menu => true }.merge() call_method("clickOnMenuItem", [ text, [:sub_menu] ]) end |
#click_text(text, options = {}) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/acouchi/solo.rb', line 66 def click_text text, ={} = { :match => 1, :auto_scroll => true }.merge() call_method("clickOnText", [ text, [:match], [:auto_scroll] ]) end |
#click_view(id) ⇒ Object
92 93 94 |
# File 'lib/acouchi/solo.rb', line 92 def click_view id call_method("clickOnViewById", [id]) end |
#content ⇒ Object
52 53 54 |
# File 'lib/acouchi/solo.rb', line 52 def content call_method("getCurrentContent") end |
#enter_text(text, index = 0) ⇒ Object
18 19 20 |
# File 'lib/acouchi/solo.rb', line 18 def enter_text text, index=0 call_method("enterText", [index, text]) end |
#go_back ⇒ Object
124 125 126 |
# File 'lib/acouchi/solo.rb', line 124 def go_back call_method("goBack") end |
#has_button?(text) ⇒ Boolean
44 45 46 |
# File 'lib/acouchi/solo.rb', line 44 def text .any? { |b| b["text"] == text } end |
#has_text?(text, options = {}) ⇒ Boolean
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/acouchi/solo.rb', line 26 def has_text? text, ={} = { :scroll => true, :minimum_matches => 0, :must_be_visible => true }.merge() call_method("searchText", [ text, [:minimum_matches], [:scroll], [:must_be_visible] ]) end |
#scroll_down ⇒ Object
104 105 106 |
# File 'lib/acouchi/solo.rb', line 104 def scroll_down call_method("scrollDown") end |
#scroll_down_list(index = 0) ⇒ Object
112 113 114 |
# File 'lib/acouchi/solo.rb', line 112 def scroll_down_list index=0 call_method("scrollDownList", [index]) end |
#scroll_to_left ⇒ Object
116 117 118 |
# File 'lib/acouchi/solo.rb', line 116 def scroll_to_left call_method("scrollToSide", [LEFT]) end |
#scroll_to_right ⇒ Object
120 121 122 |
# File 'lib/acouchi/solo.rb', line 120 def scroll_to_right call_method("scrollToSide", [RIGHT]) end |
#scroll_up ⇒ Object
100 101 102 |
# File 'lib/acouchi/solo.rb', line 100 def scroll_up call_method("scrollUp") end |
#scroll_up_list(index = 0) ⇒ Object
108 109 110 |
# File 'lib/acouchi/solo.rb', line 108 def scroll_up_list index=0 call_method("scrollUpList", [index]) end |
#send_key(key) ⇒ Object
14 15 16 |
# File 'lib/acouchi/solo.rb', line 14 def send_key key call_method("sendKey", [key]) end |
#text_views ⇒ Object
48 49 50 |
# File 'lib/acouchi/solo.rb', line 48 def text_views call_method("getTextViews") end |
#views ⇒ Object
88 89 90 |
# File 'lib/acouchi/solo.rb', line 88 def views call_method("getViews") end |
#wait_for_text(text, options = {}) ⇒ Object
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/acouchi/solo.rb', line 128 def wait_for_text text, = {} = { :minimum_number_of_matches => 0, :timeout => 20, :scroll => true, :must_be_visible => true }.merge() call_method("waitForText", [ text, [:minimum_number_of_matches], [:timeout], [:scroll], [:must_be_visible] ]) end |