gametel 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- data/features/button.feature +1 -1
- data/lib/gametel.rb +1 -0
- data/lib/gametel/navigation.rb +1 -0
- data/lib/gametel/platforms/brazenhead/list_item.rb +9 -2
- data/lib/gametel/version.rb +1 -1
- data/lib/gametel/waiter.rb +16 -0
- data/spec/lib/gametel/navigation_spec.rb +30 -0
- data/spec/lib/gametel/waiter_spec.rb +21 -0
- metadata +20 -9
data/features/button.feature
CHANGED
@@ -52,7 +52,7 @@ Feature: Interacting with buttons
|
|
52
52
|
Then the "button" field identified by "text" can determine the following properties:
|
53
53
|
| property | value |
|
54
54
|
| clickable | true |
|
55
|
-
| enabled |
|
55
|
+
| enabled | true |
|
56
56
|
| focusable | true |
|
57
57
|
| focused | false |
|
58
58
|
| selected | false |
|
data/lib/gametel.rb
CHANGED
data/lib/gametel/navigation.rb
CHANGED
@@ -12,14 +12,16 @@ module Gametel
|
|
12
12
|
|
13
13
|
def text_from_list_item(locator)
|
14
14
|
list_item(locator) do |device|
|
15
|
-
device
|
15
|
+
get_class(device, 'android.widget.TextView')
|
16
|
+
device.get_current_views('@@the_class@@', '@@the_view@@', :target => 'Robotium')
|
16
17
|
end
|
17
18
|
last_json.map { |text_view| text_view['text'] }
|
18
19
|
end
|
19
20
|
|
20
21
|
def list_item_has_image(locator)
|
21
22
|
list_item(locator) do |device|
|
22
|
-
device
|
23
|
+
get_class(device, 'android.widget.ImageView')
|
24
|
+
device.get_current_views('@@the_class@@', '@@the_view@@', :target => 'Robotium')
|
23
25
|
end
|
24
26
|
last_json[0]['hasDrawable'] if last_json[0]
|
25
27
|
end
|
@@ -31,6 +33,11 @@ module Gametel
|
|
31
33
|
block.call device if block
|
32
34
|
end
|
33
35
|
end
|
36
|
+
|
37
|
+
def get_class(device, class_name)
|
38
|
+
device.get_class
|
39
|
+
device.for_name class_name, :variable => '@@the_class@@'
|
40
|
+
end
|
34
41
|
end
|
35
42
|
end
|
36
43
|
end
|
data/lib/gametel/version.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
module Gametel
|
2
|
+
module Waiter
|
3
|
+
class Timeout < StandardError; end
|
4
|
+
|
5
|
+
def wait_until(timeout=10, &block)
|
6
|
+
last_call = ::Time.now + timeout
|
7
|
+
while ::Time.now < last_call
|
8
|
+
stoppit = block.call if block
|
9
|
+
return if stoppit
|
10
|
+
sleep 0.1
|
11
|
+
end
|
12
|
+
|
13
|
+
raise Timeout
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Gametel::Navigation
|
4
|
+
|
5
|
+
class NavigationScreen
|
6
|
+
end
|
7
|
+
|
8
|
+
describe Gametel::Navigation do
|
9
|
+
let(:screen) { double 'gametel screen' }
|
10
|
+
|
11
|
+
before(:each) do
|
12
|
+
::Time.stub(:now).and_return(0)
|
13
|
+
NavigationScreen.should_receive(:new).and_return(screen)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "is cool, if you don't care about :active?" do
|
17
|
+
on(NavigationScreen)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "cares about :active? if you do" do
|
21
|
+
screen.should_receive(:active?).and_return(true)
|
22
|
+
on(NavigationScreen)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "will still wait on you, though" do
|
26
|
+
screen.stub(:active?).and_return(true)
|
27
|
+
self.should_receive(:wait_until)
|
28
|
+
on(NavigationScreen)
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Gametel::Waiter
|
4
|
+
|
5
|
+
describe Gametel::Waiter do
|
6
|
+
before(:each) do
|
7
|
+
::Time.stub(:now).and_return(100)
|
8
|
+
self.stub(:sleep)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should wait for your condition" do
|
12
|
+
screen = double("fake screen")
|
13
|
+
screen.should_receive(:predicate?).and_return(false, false, true)
|
14
|
+
self.should_receive(:sleep).exactly(2)
|
15
|
+
wait_until(2) { screen.predicate? }
|
16
|
+
end
|
17
|
+
|
18
|
+
it "is not as forgiving if you make it wait" do
|
19
|
+
lambda { wait_until(0) }.should raise_error
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gametel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-03-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: brazenhead
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.4.
|
22
|
+
version: 0.4.6
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -27,7 +27,7 @@ dependencies:
|
|
27
27
|
requirements:
|
28
28
|
- - ! '>='
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version: 0.4.
|
30
|
+
version: 0.4.6
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
32
|
name: ADB
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
@@ -35,7 +35,7 @@ dependencies:
|
|
35
35
|
requirements:
|
36
36
|
- - ! '>='
|
37
37
|
- !ruby/object:Gem::Version
|
38
|
-
version: 0.5.
|
38
|
+
version: 0.5.5
|
39
39
|
type: :runtime
|
40
40
|
prerelease: false
|
41
41
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - ! '>='
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.5.
|
46
|
+
version: 0.5.5
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: page_navigation
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -51,7 +51,7 @@ dependencies:
|
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
54
|
+
version: '0.7'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
57
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -59,7 +59,7 @@ dependencies:
|
|
59
59
|
requirements:
|
60
60
|
- - ! '>='
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '0.
|
62
|
+
version: '0.7'
|
63
63
|
- !ruby/object:Gem::Dependency
|
64
64
|
name: rspec
|
65
65
|
requirement: !ruby/object:Gem::Requirement
|
@@ -179,7 +179,10 @@ files:
|
|
179
179
|
- lib/gametel/views/spinner.rb
|
180
180
|
- lib/gametel/views/text.rb
|
181
181
|
- lib/gametel/views/view.rb
|
182
|
+
- lib/gametel/waiter.rb
|
182
183
|
- spec/lib/gametel/accessors_spec.rb
|
184
|
+
- spec/lib/gametel/navigation_spec.rb
|
185
|
+
- spec/lib/gametel/waiter_spec.rb
|
183
186
|
- spec/lib/gametel_spec.rb
|
184
187
|
- spec/spec_helper.rb
|
185
188
|
homepage: http://github.com/leandog/gametel
|
@@ -194,15 +197,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
194
197
|
- - ! '>='
|
195
198
|
- !ruby/object:Gem::Version
|
196
199
|
version: '0'
|
200
|
+
segments:
|
201
|
+
- 0
|
202
|
+
hash: 2214503716202349439
|
197
203
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
198
204
|
none: false
|
199
205
|
requirements:
|
200
206
|
- - ! '>='
|
201
207
|
- !ruby/object:Gem::Version
|
202
208
|
version: '0'
|
209
|
+
segments:
|
210
|
+
- 0
|
211
|
+
hash: 2214503716202349439
|
203
212
|
requirements: []
|
204
213
|
rubyforge_project:
|
205
|
-
rubygems_version: 1.8.
|
214
|
+
rubygems_version: 1.8.25
|
206
215
|
signing_key:
|
207
216
|
specification_version: 3
|
208
217
|
summary: High level wrapper around android drivers
|
@@ -250,5 +259,7 @@ test_files:
|
|
250
259
|
- features/text.feature
|
251
260
|
- features/view.feature
|
252
261
|
- spec/lib/gametel/accessors_spec.rb
|
262
|
+
- spec/lib/gametel/navigation_spec.rb
|
263
|
+
- spec/lib/gametel/waiter_spec.rb
|
253
264
|
- spec/lib/gametel_spec.rb
|
254
265
|
- spec/spec_helper.rb
|