gametel 0.5.9.3 → 0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,6 +22,12 @@ Feature: Interacting with the list item control
22
22
  Then I should know that it has the text "Tom"
23
23
  And I should know that it has the text "This is Tom, he likes long walks in the park."
24
24
 
25
+ Scenario: Determining text inside a list item by index
26
+ Given I am on the custom list screen
27
+ When I ask for the first item by the first index
28
+ Then I should know that it has the text "Tom"
29
+ And I should know that it has the text "This is Tom, he likes long walks in the park."
30
+
25
31
  Scenario: Determining if a list item has an image
26
32
  Given I am on the efficient adapter screen
27
33
  When I ask for the list item for "Abertam"
@@ -1,6 +1,5 @@
1
1
  When /^I click the first list item by "(.+)"$/ do |type|
2
- on(MainMenuScreen).send "first_list_item_#{type}"
3
- end
2
+ on(MainMenuScreen).send "first_list_item_#{type}" end
4
3
 
5
4
  When /^I click the list item "(.*?)" from the main menu$/ do |list_item|
6
5
  on(MainMenuScreen).send "#{list_item.downcase}"
@@ -30,6 +29,10 @@ When /^I ask for the first item in the list$/ do
30
29
  @list_item = on(CustomItemsScreen).tom_view
31
30
  end
32
31
 
32
+ When(/^I ask for the first item by the first index$/) do
33
+ @list_item = on(CustomItemsScreen).first_index_view
34
+ end
35
+
33
36
  Then /^I should know that it has the text "(.*?)"$/ do |expected_text|
34
37
  @list_item.text.should include expected_text
35
38
  @list_item.should have_text expected_text
@@ -1,6 +1,7 @@
1
1
  class CustomItemsScreen
2
2
  include Gametel
3
3
 
4
+ list_item(:first_index, :index => 0)
4
5
  list_item(:tom, :text => 'Tom')
5
6
  list_item(:dick, :text => 'Dick')
6
7
  list_item(:harry, :text => 'Harry')
@@ -64,3 +64,14 @@ Feature: Interacting with the standard text field
64
64
  | focused | true |
65
65
  | selected | false |
66
66
  | shown | true |
67
+
68
+ Scenario: Determining properties of a text view by index
69
+ When I'm on the controls screen
70
+ Then the "text" field identified by "index" can determine the following properties:
71
+ | property | value |
72
+ | clickable | true |
73
+ | enabled | true |
74
+ | focusable | true |
75
+ | focused | true |
76
+ | selected | false |
77
+ | shown | true |
@@ -28,8 +28,8 @@ module Gametel
28
28
 
29
29
  def list_item(locator, &block)
30
30
  chain_calls do |device|
31
- device.list_item_by_text(locator[:text], :target => 'Brazenhead',
32
- :variable => '@@the_view@@')
31
+ device.list_item_by_text(locator[:text], :target => 'Brazenhead', :variable => '@@the_view@@') if locator[:text]
32
+ device.list_item_by_index(locator[:index], :target => 'Brazenhead', :variable => '@@the_view@@') if locator[:index]
33
33
  block.call device if block
34
34
  end
35
35
  end
@@ -1,3 +1,3 @@
1
1
  module Gametel
2
- VERSION = "0.5.9.3"
2
+ VERSION = "0.6"
3
3
  end
@@ -1,6 +1,10 @@
1
1
  module Gametel
2
2
  module Views
3
3
  class Text < View
4
+
5
+ def view_class
6
+ 'android.widget.EditText'
7
+ end
4
8
 
5
9
  def hint
6
10
  platform.get_text_hint(locator)
@@ -9,6 +9,10 @@ module Gametel
9
9
  build_property_methods
10
10
  end
11
11
 
12
+ def view_class
13
+ 'android.view.View'
14
+ end
15
+
12
16
  protected
13
17
 
14
18
  def properties
@@ -19,9 +23,9 @@ module Gametel
19
23
  metaclass = class << self; self; end
20
24
  properties.each do |property|
21
25
  metaclass.send(:define_method, "#{property}?".to_sym) do
22
- platform.get_view_by_id(locator[:id]) do |device|
23
- device.send "is_#{property}"
24
- end
26
+ query_property = lambda {|device| device.send "is_#{property}" }
27
+ platform.get_view_by_id(locator[:id], &query_property) if locator[:id]
28
+ platform.get_view_by_index(view_class, locator[:index], &query_property) if locator[:index]
25
29
  platform.last_response.body == "true"
26
30
  end
27
31
  end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gametel::Views::Text do
4
+ let(:platform) { double('Gametel platform') }
5
+ let(:locator) { {:id => 'abc'} }
6
+ subject { Gametel::Views::Text.new(platform, locator) }
7
+
8
+ it 'should know what its type is' do
9
+ subject.view_class.should eq('android.widget.EditText')
10
+ end
11
+ 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.9.3
4
+ version: '0.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-04-26 00:00:00.000000000 Z
13
+ date: 2013-05-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: brazenhead
@@ -187,6 +187,7 @@ files:
187
187
  - lib/gametel/views/text.rb
188
188
  - lib/gametel/views/view.rb
189
189
  - lib/gametel/waiter.rb
190
+ - spec/lib/gametel/accessors/text_spec.rb
190
191
  - spec/lib/gametel/accessors_spec.rb
191
192
  - spec/lib/gametel/navigation_spec.rb
192
193
  - spec/lib/gametel/waiter_spec.rb
@@ -204,18 +205,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
204
205
  - - ! '>='
205
206
  - !ruby/object:Gem::Version
206
207
  version: '0'
207
- segments:
208
- - 0
209
- hash: 4520710427909593083
210
208
  required_rubygems_version: !ruby/object:Gem::Requirement
211
209
  none: false
212
210
  requirements:
213
211
  - - ! '>='
214
212
  - !ruby/object:Gem::Version
215
213
  version: '0'
216
- segments:
217
- - 0
218
- hash: 4520710427909593083
219
214
  requirements: []
220
215
  rubyforge_project:
221
216
  rubygems_version: 1.8.25
@@ -270,6 +265,7 @@ test_files:
270
265
  - features/support/screens/views_menu_screen.rb
271
266
  - features/text.feature
272
267
  - features/view.feature
268
+ - spec/lib/gametel/accessors/text_spec.rb
273
269
  - spec/lib/gametel/accessors_spec.rb
274
270
  - spec/lib/gametel/navigation_spec.rb
275
271
  - spec/lib/gametel/waiter_spec.rb