acouchi 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +143 -0
- data/examples/AcouchiSample/features/step_definitions/steps.rb +2 -2
- data/lib/acouchi/project_builder.rb +1 -1
- data/lib/acouchi/solo.rb +18 -2
- data/lib/acouchi/version.rb +1 -1
- data/lib/acouchi/which.rb +11 -5
- data/src/com/acouchi/MethodExecutor.java +3 -0
- metadata +2 -2
data/README.md
CHANGED
@@ -74,6 +74,149 @@ Cucumber
|
|
74
74
|
t.cucumber_opts = "features --format pretty"
|
75
75
|
end
|
76
76
|
|
77
|
+
Pressing Keys
|
78
|
+
-------------
|
79
|
+
|
80
|
+
```
|
81
|
+
page.send_key Acouchi::Solo::MENU
|
82
|
+
page.send_key Acouchi::Solo::LEFT
|
83
|
+
page.send_key Acouchi::Solo::RIGHT
|
84
|
+
```
|
85
|
+
|
86
|
+
Modifying Text
|
87
|
+
--------------
|
88
|
+
|
89
|
+
```
|
90
|
+
# Enter text into the only text area on the page
|
91
|
+
page.enter_text "Hello"
|
92
|
+
|
93
|
+
# This enters text into the fifth text area
|
94
|
+
page.enter_text "Hello", 5
|
95
|
+
|
96
|
+
# Clear text from the only edit text area on the page
|
97
|
+
page.clear_text
|
98
|
+
|
99
|
+
# Clear text from the fourth edit text area
|
100
|
+
page.clear_text 4
|
101
|
+
```
|
102
|
+
|
103
|
+
Searching Text
|
104
|
+
--------------
|
105
|
+
|
106
|
+
```
|
107
|
+
# Check if page has_text
|
108
|
+
page.has_text? "Bla"
|
109
|
+
|
110
|
+
# has_text? default options
|
111
|
+
page.has_text?("Text", {
|
112
|
+
:scroll => true, # Scroll down the page searching for text
|
113
|
+
:minimum_matches => 0, # Zero means you don't care how many matches there are.
|
114
|
+
:must_be_visible => true # Whether you care if the text is visible or not.
|
115
|
+
})
|
116
|
+
|
117
|
+
# List all content currently on the page
|
118
|
+
page.content
|
119
|
+
|
120
|
+
# List all content currently on the page and scroll up and down
|
121
|
+
# to find any content which may have been missed
|
122
|
+
page.all_content
|
123
|
+
```
|
124
|
+
|
125
|
+
Clicking Things
|
126
|
+
---------------
|
127
|
+
|
128
|
+
```
|
129
|
+
# Check if button with text exists
|
130
|
+
page.has_button? "Clicky"
|
131
|
+
|
132
|
+
# Click on some text
|
133
|
+
page.click_text "Hello"
|
134
|
+
|
135
|
+
# click_text default options
|
136
|
+
page.click_text("Text", {
|
137
|
+
:match => 1, # The match of the text that should be clicked
|
138
|
+
:auto_scroll => true # Auto scroll to find text to click on
|
139
|
+
})
|
140
|
+
|
141
|
+
# Click on a view by id
|
142
|
+
page.click_view 123
|
143
|
+
|
144
|
+
# Click on an image by index
|
145
|
+
page.click_image 5
|
146
|
+
```
|
147
|
+
|
148
|
+
Finding Views
|
149
|
+
-------------
|
150
|
+
|
151
|
+
```
|
152
|
+
# List the buttons currently on the page
|
153
|
+
page.buttons
|
154
|
+
|
155
|
+
# List the text views currently on the page
|
156
|
+
page.text_views
|
157
|
+
```
|
158
|
+
|
159
|
+
Scrolling
|
160
|
+
---------
|
161
|
+
|
162
|
+
```
|
163
|
+
page.scroll_up
|
164
|
+
page.scroll_down
|
165
|
+
|
166
|
+
# Scroll up or down the only list on the page
|
167
|
+
page.scroll_up_list
|
168
|
+
page.scroll_down_list
|
169
|
+
|
170
|
+
# Scroll up or down a list by its index
|
171
|
+
page.scroll_up_list 4
|
172
|
+
page.scroll_down_list 4
|
173
|
+
|
174
|
+
# Scroll to left or right
|
175
|
+
page.scroll_to_left
|
176
|
+
page.scroll_to_right
|
177
|
+
```
|
178
|
+
|
179
|
+
Navigating
|
180
|
+
----------
|
181
|
+
|
182
|
+
```
|
183
|
+
# Press the back button
|
184
|
+
page.go_back
|
185
|
+
```
|
186
|
+
|
187
|
+
Waiting
|
188
|
+
-------
|
189
|
+
|
190
|
+
Most methods in acouchi will wait for a while until an element is available.
|
191
|
+
|
192
|
+
```
|
193
|
+
# Wait for the text "Bla Bla" to appear. Returns true if the text appears.
|
194
|
+
page.wait_for_text "Bla Bla"
|
195
|
+
|
196
|
+
# wait_for_text default options
|
197
|
+
page.wait_for_text "Bla Bla", {
|
198
|
+
# The minimum amount of matches you want to appear
|
199
|
+
:minimum_number_of_matches => 0,
|
200
|
+
# How long to wait for, in seconds
|
201
|
+
:timeout => 20,
|
202
|
+
# Scroll the page in search of text
|
203
|
+
:scroll => true,
|
204
|
+
# Only take into account visible text
|
205
|
+
:must_be_visible => true
|
206
|
+
}
|
207
|
+
```
|
208
|
+
|
209
|
+
RSpec
|
210
|
+
-----
|
211
|
+
|
212
|
+
```
|
213
|
+
require "acouchi/rspec/matchers"
|
214
|
+
|
215
|
+
# The have_text matcher will now output all page content
|
216
|
+
# if the assertion fails
|
217
|
+
page.should have_text "Bla"
|
218
|
+
```
|
219
|
+
|
77
220
|
Troubleshooting
|
78
221
|
---------------
|
79
222
|
|
data/lib/acouchi/solo.rb
CHANGED
@@ -11,11 +11,11 @@ module Acouchi
|
|
11
11
|
call_method("sendKey", [key])
|
12
12
|
end
|
13
13
|
|
14
|
-
def enter_text
|
14
|
+
def enter_text text, index=0
|
15
15
|
call_method("enterText", [index, text])
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
18
|
+
def clear_text index=0
|
19
19
|
call_method("clearEditText", [index])
|
20
20
|
end
|
21
21
|
|
@@ -111,6 +111,22 @@ module Acouchi
|
|
111
111
|
call_method("goBack")
|
112
112
|
end
|
113
113
|
|
114
|
+
def wait_for_text text, options = {}
|
115
|
+
options = {
|
116
|
+
:minimum_number_of_matches => 0,
|
117
|
+
:timeout => 20,
|
118
|
+
:scroll => true,
|
119
|
+
:must_be_visible => true
|
120
|
+
}.merge(options)
|
121
|
+
call_method("waitForText", [
|
122
|
+
text,
|
123
|
+
options[:minimum_number_of_matches],
|
124
|
+
options[:timeout],
|
125
|
+
options[:scroll],
|
126
|
+
options[:must_be_visible]
|
127
|
+
])
|
128
|
+
end
|
129
|
+
|
114
130
|
private
|
115
131
|
def call_method name, arguments = []
|
116
132
|
arguments = arguments.map {|a| a.to_s}
|
data/lib/acouchi/version.rb
CHANGED
data/lib/acouchi/which.rb
CHANGED
@@ -10,14 +10,20 @@ module Acouchi
|
|
10
10
|
|
11
11
|
private
|
12
12
|
def self.which? command
|
13
|
-
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
14
13
|
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
15
|
-
|
16
|
-
|
17
|
-
return exe if File.executable? exe
|
18
|
-
}
|
14
|
+
exe = File.join(path, "#{command}")
|
15
|
+
return exe if executable? exe
|
19
16
|
end
|
20
17
|
return nil
|
21
18
|
end
|
19
|
+
|
20
|
+
def self.executable? file
|
21
|
+
return true if File.executable?(file)
|
22
|
+
extensions = ENV["PATHEXT"] ? ENV["PATHEXT"].split(";") : []
|
23
|
+
File.exist?(file) &&
|
24
|
+
File.file?(file) &&
|
25
|
+
extensions.any? &&
|
26
|
+
extensions.any? {|e| file.downcase.end_with?(e.downcase)}
|
27
|
+
end
|
22
28
|
end
|
23
29
|
end
|
@@ -86,6 +86,9 @@ public class MethodExecutor
|
|
86
86
|
if (methodName.equals("goBack"))
|
87
87
|
solo.goBack();
|
88
88
|
|
89
|
+
if (methodName.equals("waitForText"))
|
90
|
+
result = solo.waitForText(parameters[0], Integer.parseInt(parameters[1]), Long.parseLong(parameters[2]), Boolean.parseBoolean(parameters[3]), Boolean.parseBoolean(parameters[4]));
|
91
|
+
|
89
92
|
return methodResultAsJson(result);
|
90
93
|
}
|
91
94
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acouchi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|