gametel 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/features/progress.feature +22 -0
- data/features/spinners.feature +21 -0
- data/features/step_definitions/progress_steps.rb +10 -0
- data/features/step_definitions/spinners_steps.rb +9 -0
- data/features/support/env.rb +0 -2
- data/lib/gametel/accessors.rb +9 -0
- data/lib/gametel/version.rb +1 -1
- data/lib/gametel/views/progress.rb +30 -0
- data/lib/gametel/views/spinner.rb +30 -0
- data/lib/gametel/views.rb +2 -0
- data/spec/lib/gametel/accessors_spec.rb +119 -5
- metadata +8 -6
data/features/progress.feature
CHANGED
@@ -23,3 +23,25 @@ Feature: Interacting with progress bars
|
|
23
23
|
Scenario: Getting the progress max by index
|
24
24
|
When I am looking at the progress of a seek bar
|
25
25
|
Then the retrieved progress max indicated by "index" should be "100"
|
26
|
+
|
27
|
+
Scenario: Getting the progress bar's view by id
|
28
|
+
When I am looking at the progress of a seek bar
|
29
|
+
Then the progress bar indicated by "id" can determine the following properties:
|
30
|
+
| property | value |
|
31
|
+
| clickable | false |
|
32
|
+
| enabled | true |
|
33
|
+
| focusable | true |
|
34
|
+
| focused | false |
|
35
|
+
| selected | false |
|
36
|
+
| shown | true |
|
37
|
+
|
38
|
+
Scenario: Getting the progress bar's view by index
|
39
|
+
When I am looking at the progress of a seek bar
|
40
|
+
Then the progress bar indicated by "index" can determine the following properties:
|
41
|
+
| property | value |
|
42
|
+
| clickable | false |
|
43
|
+
| enabled | true |
|
44
|
+
| focusable | true |
|
45
|
+
| focused | false |
|
46
|
+
| selected | false |
|
47
|
+
| shown | true |
|
data/features/spinners.feature
CHANGED
@@ -18,3 +18,24 @@ Feature: Working with Spinners
|
|
18
18
|
And I select item number "3" from the spinner using "index"
|
19
19
|
Then I can see the spinner value referenced by "index" is "Mars"
|
20
20
|
|
21
|
+
Scenario: Getting the Spinner's view by id
|
22
|
+
When I'm on the controls screen
|
23
|
+
Then the spinner indicated by "id" can determine the following properties:
|
24
|
+
| property | value |
|
25
|
+
| clickable | true |
|
26
|
+
| enabled | true |
|
27
|
+
| focusable | true |
|
28
|
+
| focused | false |
|
29
|
+
| selected | false |
|
30
|
+
| shown | true |
|
31
|
+
|
32
|
+
Scenario: Getting the Spinner's view by index
|
33
|
+
When I'm on the controls screen
|
34
|
+
Then the spinner indicated by "index" can determine the following properties:
|
35
|
+
| property | value |
|
36
|
+
| clickable | true |
|
37
|
+
| enabled | true |
|
38
|
+
| focusable | true |
|
39
|
+
| focused | false |
|
40
|
+
| selected | false |
|
41
|
+
| shown | true |
|
@@ -32,3 +32,13 @@ Then /^the retrieved progress max indicated by "(.*?)" should be "(.*?)"$/ do |h
|
|
32
32
|
screen.send("progress_#{how}_max").should eq(value.to_i)
|
33
33
|
end
|
34
34
|
end
|
35
|
+
|
36
|
+
Then /^the progress bar indicated by "(.*?)" can determine the following properties:$/ do |how, properties|
|
37
|
+
on(SeekBarScreen) do |screen|
|
38
|
+
view = screen.send("progress_#{how}_view")
|
39
|
+
properties.hashes.each do |property|
|
40
|
+
result = view.send("#{property["property"]}?")
|
41
|
+
result.to_s.should eq(property["value"]), "for field #{property["property"]}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -8,3 +8,12 @@ When /^I select item number "(.*?)" from the spinner using "(.*?)"$/ do |num, ho
|
|
8
8
|
on(ControlsScreen).send "select_spinner_#{how}", num.to_i
|
9
9
|
end
|
10
10
|
|
11
|
+
Then /^the spinner indicated by "(.*?)" can determine the following properties:$/ do |how, properties|
|
12
|
+
on(ControlsScreen) do |screen|
|
13
|
+
view = screen.send("spinner_#{how}_view")
|
14
|
+
properties.hashes.each do |property|
|
15
|
+
result = view.send("#{property["property"]}?")
|
16
|
+
result.to_s.should eq(property["value"]), "for field #{property["property"]}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/features/support/env.rb
CHANGED
data/lib/gametel/accessors.rb
CHANGED
@@ -139,6 +139,7 @@ module Gametel
|
|
139
139
|
# @param [Hash] locator indicating an id for how the view is found.
|
140
140
|
# The only valid keys are:
|
141
141
|
# * :id
|
142
|
+
# * :text
|
142
143
|
#
|
143
144
|
def view(name, locator)
|
144
145
|
define_method(name) do
|
@@ -160,6 +161,7 @@ module Gametel
|
|
160
161
|
# @param [Hash] locator indicating an id for how the progress bar is found.
|
161
162
|
# The only valid keys are:
|
162
163
|
# * :id
|
164
|
+
# * :index
|
163
165
|
#
|
164
166
|
def progress(name, locator)
|
165
167
|
define_method("#{name}") do
|
@@ -177,6 +179,9 @@ module Gametel
|
|
177
179
|
define_method("#{name}_secondary=") do |value|
|
178
180
|
platform.set_secondary_progress(locator, value)
|
179
181
|
end
|
182
|
+
define_method("#{name}_view") do
|
183
|
+
Gametel::Views::Progress.new(platform, locator)
|
184
|
+
end
|
180
185
|
end
|
181
186
|
|
182
187
|
#
|
@@ -189,6 +194,7 @@ module Gametel
|
|
189
194
|
# @param [Hash] locator indicating an id for how the spinner is found.
|
190
195
|
# The only valid keys are:
|
191
196
|
# * :id
|
197
|
+
# * :index
|
192
198
|
#
|
193
199
|
def spinner(name, locator)
|
194
200
|
define_method(name) do
|
@@ -197,6 +203,9 @@ module Gametel
|
|
197
203
|
define_method("select_#{name}") do |value|
|
198
204
|
platform.select_spinner_value(locator, value)
|
199
205
|
end
|
206
|
+
define_method("#{name}_view") do
|
207
|
+
Gametel::Views::Spinner.new(platform, locator)
|
208
|
+
end
|
200
209
|
end
|
201
210
|
end
|
202
211
|
end
|
data/lib/gametel/version.rb
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
module Gametel
|
2
|
+
module Views
|
3
|
+
class Progress < View
|
4
|
+
|
5
|
+
PROGRESS_BAR_CLASS = 'android.widget.ProgressBar'
|
6
|
+
|
7
|
+
protected
|
8
|
+
|
9
|
+
def build_property_methods
|
10
|
+
metaclass = class << self; self; end
|
11
|
+
properties.each do |property|
|
12
|
+
metaclass.send(:define_method, "#{property}?".to_sym) do
|
13
|
+
|
14
|
+
platform.get_view_by_id(locator[:id]) do |device|
|
15
|
+
device.send "is_#{property}"
|
16
|
+
end if locator[:id]
|
17
|
+
|
18
|
+
platform.get_view_by_index(PROGRESS_BAR_CLASS, locator[:index]) do |device|
|
19
|
+
device.send "is_#{property}"
|
20
|
+
end if locator[:index]
|
21
|
+
|
22
|
+
platform.last_response.body == "true"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Gametel
|
2
|
+
module Views
|
3
|
+
class Spinner < View
|
4
|
+
|
5
|
+
SPINNER_CLASS = 'android.widget.Spinner'
|
6
|
+
|
7
|
+
protected
|
8
|
+
|
9
|
+
def build_property_methods
|
10
|
+
metaclass = class << self; self; end
|
11
|
+
properties.each do |property|
|
12
|
+
metaclass.send(:define_method, "#{property}?".to_sym) do
|
13
|
+
|
14
|
+
platform.get_view_by_id(locator[:id]) do |device|
|
15
|
+
device.send "is_#{property}"
|
16
|
+
end if locator[:id]
|
17
|
+
|
18
|
+
platform.get_view_by_index(SPINNER_CLASS, locator[:index]) do |device|
|
19
|
+
device.send "is_#{property}"
|
20
|
+
end if locator[:index]
|
21
|
+
|
22
|
+
platform.last_response.body == "true"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/gametel/views.rb
CHANGED
@@ -92,7 +92,7 @@ describe Gametel::Accessors do
|
|
92
92
|
accumulator.should_receive(:get_view)
|
93
93
|
accumulator.should_receive(:get_text)
|
94
94
|
accumulator.should_receive(:to_string)
|
95
|
-
|
95
|
+
device.should_receive(:last_json).and_return('the value')
|
96
96
|
screen.first_name_id.should eq('the value')
|
97
97
|
end
|
98
98
|
|
@@ -100,7 +100,7 @@ describe Gametel::Accessors do
|
|
100
100
|
accumulator.should_receive(:id_from_name)
|
101
101
|
accumulator.should_receive(:get_view)
|
102
102
|
accumulator.should_receive(:get_hint)
|
103
|
-
|
103
|
+
device.should_receive(:last_json).and_return('the hint')
|
104
104
|
view = screen.first_name_id_view
|
105
105
|
view.hint.should eq('the hint')
|
106
106
|
end
|
@@ -109,7 +109,7 @@ describe Gametel::Accessors do
|
|
109
109
|
accumulator.should_receive(:id_from_name)
|
110
110
|
accumulator.should_receive(:get_view)
|
111
111
|
accumulator.should_receive(:get_content_description)
|
112
|
-
|
112
|
+
device.should_receive(:last_json).and_return('the content description')
|
113
113
|
view = screen.first_name_id_view
|
114
114
|
view.description.should eq('the content description')
|
115
115
|
end
|
@@ -508,7 +508,7 @@ describe Gametel::Accessors do
|
|
508
508
|
accumulator.should_receive(:get_view)
|
509
509
|
accumulator.should_receive(:get_selected_item)
|
510
510
|
accumulator.should_receive(:to_string)
|
511
|
-
|
511
|
+
device.should_receive(:last_json).and_return('the text value')
|
512
512
|
screen.spinner_id.should eq('the text value')
|
513
513
|
end
|
514
514
|
|
@@ -526,7 +526,7 @@ describe Gametel::Accessors do
|
|
526
526
|
accumulator.should_receive(:get_view).with('@@the_type@@', 1, anything)
|
527
527
|
accumulator.should_receive(:get_selected_item)
|
528
528
|
accumulator.should_receive(:to_string)
|
529
|
-
|
529
|
+
device.should_receive(:last_json).and_return('the text value')
|
530
530
|
screen.spinner_index.should eq('the text value')
|
531
531
|
end
|
532
532
|
|
@@ -535,6 +535,63 @@ describe Gametel::Accessors do
|
|
535
535
|
screen.select_spinner_index 4
|
536
536
|
end
|
537
537
|
end
|
538
|
+
|
539
|
+
context "when looking at properties" do
|
540
|
+
|
541
|
+
it "should know if they are enabled" do
|
542
|
+
accumulator.should_receive(:id_from_name)
|
543
|
+
accumulator.should_receive(:get_view)
|
544
|
+
accumulator.should_receive(:is_enabled)
|
545
|
+
result.should_receive(:body).and_return("false")
|
546
|
+
view = screen.spinner_id_view
|
547
|
+
view.should_not be_enabled
|
548
|
+
end
|
549
|
+
|
550
|
+
it "should know if they are clickable" do
|
551
|
+
accumulator.should_receive(:id_from_name)
|
552
|
+
accumulator.should_receive(:get_view)
|
553
|
+
accumulator.should_receive(:is_clickable)
|
554
|
+
result.should_receive(:body).and_return("true")
|
555
|
+
view = screen.spinner_id_view
|
556
|
+
view.should be_clickable
|
557
|
+
end
|
558
|
+
|
559
|
+
it "should know if they are focusable" do
|
560
|
+
accumulator.should_receive(:id_from_name)
|
561
|
+
accumulator.should_receive(:get_view)
|
562
|
+
accumulator.should_receive(:is_focusable)
|
563
|
+
result.should_receive(:body).and_return("true")
|
564
|
+
view = screen.spinner_id_view
|
565
|
+
view.should be_focusable
|
566
|
+
end
|
567
|
+
|
568
|
+
it "should know if they are focused" do
|
569
|
+
accumulator.should_receive(:id_from_name)
|
570
|
+
accumulator.should_receive(:get_view)
|
571
|
+
accumulator.should_receive(:is_focused)
|
572
|
+
result.should_receive(:body).and_return("true")
|
573
|
+
view = screen.spinner_id_view
|
574
|
+
view.should be_focused
|
575
|
+
end
|
576
|
+
|
577
|
+
it "should know if they are selected" do
|
578
|
+
accumulator.should_receive(:id_from_name)
|
579
|
+
accumulator.should_receive(:get_view)
|
580
|
+
accumulator.should_receive(:is_selected)
|
581
|
+
result.should_receive(:body).and_return("true")
|
582
|
+
view = screen.spinner_id_view
|
583
|
+
view.should be_selected
|
584
|
+
end
|
585
|
+
|
586
|
+
it "should know if they are shown" do
|
587
|
+
accumulator.should_receive(:id_from_name)
|
588
|
+
accumulator.should_receive(:get_view)
|
589
|
+
accumulator.should_receive(:is_shown)
|
590
|
+
result.should_receive(:body).and_return("true")
|
591
|
+
view = screen.spinner_id_view
|
592
|
+
view.should be_shown
|
593
|
+
end
|
594
|
+
end
|
538
595
|
end
|
539
596
|
|
540
597
|
context "progress bars" do
|
@@ -623,6 +680,63 @@ describe Gametel::Accessors do
|
|
623
680
|
screen.progress_index_max.should eq(100)
|
624
681
|
end
|
625
682
|
end
|
683
|
+
|
684
|
+
context "when looking at properties" do
|
685
|
+
|
686
|
+
it "should know if they are enabled" do
|
687
|
+
accumulator.should_receive(:id_from_name)
|
688
|
+
accumulator.should_receive(:get_view)
|
689
|
+
accumulator.should_receive(:is_enabled)
|
690
|
+
result.should_receive(:body).and_return("false")
|
691
|
+
view = screen.progress_id_view
|
692
|
+
view.should_not be_enabled
|
693
|
+
end
|
694
|
+
|
695
|
+
it "should know if they are clickable" do
|
696
|
+
accumulator.should_receive(:id_from_name)
|
697
|
+
accumulator.should_receive(:get_view)
|
698
|
+
accumulator.should_receive(:is_clickable)
|
699
|
+
result.should_receive(:body).and_return("true")
|
700
|
+
view = screen.progress_id_view
|
701
|
+
view.should be_clickable
|
702
|
+
end
|
703
|
+
|
704
|
+
it "should know if they are focusable" do
|
705
|
+
accumulator.should_receive(:id_from_name)
|
706
|
+
accumulator.should_receive(:get_view)
|
707
|
+
accumulator.should_receive(:is_focusable)
|
708
|
+
result.should_receive(:body).and_return("true")
|
709
|
+
view = screen.progress_id_view
|
710
|
+
view.should be_focusable
|
711
|
+
end
|
712
|
+
|
713
|
+
it "should know if they are focused" do
|
714
|
+
accumulator.should_receive(:id_from_name)
|
715
|
+
accumulator.should_receive(:get_view)
|
716
|
+
accumulator.should_receive(:is_focused)
|
717
|
+
result.should_receive(:body).and_return("true")
|
718
|
+
view = screen.progress_id_view
|
719
|
+
view.should be_focused
|
720
|
+
end
|
721
|
+
|
722
|
+
it "should know if they are selected" do
|
723
|
+
accumulator.should_receive(:id_from_name)
|
724
|
+
accumulator.should_receive(:get_view)
|
725
|
+
accumulator.should_receive(:is_selected)
|
726
|
+
result.should_receive(:body).and_return("true")
|
727
|
+
view = screen.progress_id_view
|
728
|
+
view.should be_selected
|
729
|
+
end
|
730
|
+
|
731
|
+
it "should know if they are shown" do
|
732
|
+
accumulator.should_receive(:id_from_name)
|
733
|
+
accumulator.should_receive(:get_view)
|
734
|
+
accumulator.should_receive(:is_shown)
|
735
|
+
result.should_receive(:body).and_return("true")
|
736
|
+
view = screen.progress_id_view
|
737
|
+
view.should be_shown
|
738
|
+
end
|
739
|
+
end
|
626
740
|
end
|
627
741
|
end
|
628
742
|
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.3
|
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: 2012-
|
13
|
+
date: 2012-10-12 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.3
|
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.3
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
32
|
name: ADB
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
@@ -153,7 +153,9 @@ files:
|
|
153
153
|
- lib/gametel/views.rb
|
154
154
|
- lib/gametel/views/button.rb
|
155
155
|
- lib/gametel/views/checkbox.rb
|
156
|
+
- lib/gametel/views/progress.rb
|
156
157
|
- lib/gametel/views/radio_button.rb
|
158
|
+
- lib/gametel/views/spinner.rb
|
157
159
|
- lib/gametel/views/text.rb
|
158
160
|
- lib/gametel/views/view.rb
|
159
161
|
- spec/lib/gametel/accessors_spec.rb
|
@@ -173,7 +175,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
173
175
|
version: '0'
|
174
176
|
segments:
|
175
177
|
- 0
|
176
|
-
hash: -
|
178
|
+
hash: -3608907023518404738
|
177
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
180
|
none: false
|
179
181
|
requirements:
|
@@ -182,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
184
|
version: '0'
|
183
185
|
segments:
|
184
186
|
- 0
|
185
|
-
hash: -
|
187
|
+
hash: -3608907023518404738
|
186
188
|
requirements: []
|
187
189
|
rubyforge_project:
|
188
190
|
rubygems_version: 1.8.24
|