gametel 0.6 → 0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NjEzOWQ4NTk3NWFmMDY3NmViMWY2NGI0YmUyZGNiNmEwMjRlNDI5Mg==
5
+ data.tar.gz: !binary |-
6
+ MDBhMDBhZjQ5MzZhODQyNzYzNmI2NzdiMGNmMjU5MTk4YTE1NGE3Yg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ NDhhZjlmY2NlYTQ3MDJiMDFlM2I0MGQwODdjNWE0MWE5NDhlNTRjZjNhY2Mx
10
+ OTFmZGY2NTVkZjcyODUwZDQ3YzQ5ODRhNjI3MTUwODdjMDk2ZDhkZjA4NzE2
11
+ ZDRkNTg3NDg2M2RjOWRiM2IxY2VhNGNlMTJkNzdlMTFmYzJmMjQ=
12
+ data.tar.gz: !binary |-
13
+ OTM4YTMzMjNjODhmNzdkMDEwOThmODIxM2QyYjJiMTk4ZWY5MTdkNWUwMTNl
14
+ NjUwY2Q5Y2UwNzU2YTBhMTQ5ZGRiNDJjNmU1YzY3NGM2OWNhZjc5NjQ0MmU4
15
+ NjY0ODZmOTk4Y2FmMGQxOTkzMTU2OTRhYTBlOGExZWNlZmYyODE=
@@ -0,0 +1,9 @@
1
+ Feature: Working with menus
2
+
3
+ Scenario: Selecting menu items by their id
4
+ When I am on the action bar usage screen
5
+ Then I can select the menu item by id
6
+
7
+ Scenario: Selecting menu items by their text
8
+ When I am on the action bar usage screen
9
+ Then I can select the menu item by text
@@ -0,0 +1,17 @@
1
+ When(/^I am on the action bar usage screen$/) do
2
+ navigate_to(ActionBar, :using => :action_bar).action_bar_usage
3
+ end
4
+
5
+ Then(/^I can select the menu item by id$/) do
6
+ on(ActionBarUsage) do |screen|
7
+ screen.menu_by_id
8
+ screen.should have_text('Selected Item: Edit')
9
+ end
10
+ end
11
+
12
+ Then(/^I can select the menu item by text$/) do
13
+ on(ActionBarUsage) do |screen|
14
+ screen.menu_by_text
15
+ screen.should have_text('Selected Item: Add')
16
+ end
17
+ end
@@ -0,0 +1,14 @@
1
+ Given(/^I have navigated to the webview screen$/) do
2
+ on(WebviewMainScreen).goto_webview
3
+ end
4
+
5
+ When(/^I click the text "(.*?)" in a webview$/) do |text|
6
+ on(WebviewScreen).click_on_text text
7
+ end
8
+
9
+ Then(/^I should see the text "(.*?)" in a webview$/) do |text|
10
+ on(WebviewScreen) do |screen|
11
+ screen.wait_for_text text
12
+ screen.has_text? text
13
+ end
14
+ end
@@ -15,7 +15,10 @@ Gametel::Navigation.routes = {
15
15
  [ControlsScreen, :button_field_id]],
16
16
  :button_route => [[MainMenuScreen, :views],
17
17
  [ViewsMenuScreen, :buttons],
18
- [ButtonScreen, :normal_id]]
18
+ [ButtonScreen, :normal_id]],
19
+ :action_bar => [[MainMenuScreen, :app],
20
+ [AppScreen, :action_bar],
21
+ [ActionBar]]
19
22
  }
20
23
 
21
24
  Gametel.keystore = {
@@ -25,12 +28,17 @@ Gametel.keystore = {
25
28
  :keystore_password => 'android'
26
29
  }
27
30
 
28
- Gametel.apk_path = 'features/support/ApiDemos.apk'
29
31
 
30
- Before do
32
+ Before('~@webview') do
33
+ Gametel.apk_path = 'features/support/ApiDemos.apk'
31
34
  @driver = Gametel.start('ApiDemos')
32
35
  end
33
36
 
37
+ Before('@webview') do
38
+ Gametel.apk_path = 'webview_sample/bin/webview_sample-debug.apk'
39
+ driver = Gametel.start('MainActivity')
40
+ end
41
+
34
42
  After do
35
43
  Gametel.stop
36
44
  end
@@ -0,0 +1,5 @@
1
+ class ActionBar
2
+ include Gametel
3
+
4
+ list_item(:action_bar_usage, :text => 'Action Bar Usage')
5
+ end
@@ -0,0 +1,6 @@
1
+ class ActionBarUsage
2
+ include Gametel
3
+
4
+ action_item(:menu_by_id, :id => :action_edit)
5
+ menu_item(:menu_by_text, :text => 'Add')
6
+ end
@@ -2,5 +2,6 @@ class AppScreen
2
2
  include Gametel
3
3
 
4
4
  list_item(:alert_dialogs, :text => 'Alert Dialogs')
5
+ list_item(:action_bar, :text => 'Action Bar')
5
6
  view(:list_dialog, :id => 'select_button')
6
7
  end
@@ -0,0 +1,8 @@
1
+ class WebviewMainScreen
2
+ include Gametel
3
+
4
+ activity 'MainActivity'
5
+
6
+ button(:goto_webview, :text => 'Go to http://www.google.com')
7
+
8
+ end
@@ -0,0 +1,6 @@
1
+ class WebviewScreen
2
+ include Gametel
3
+
4
+ webview(:web, :id => 'webView1')
5
+
6
+ end
@@ -0,0 +1,14 @@
1
+ @webview
2
+ Feature: Adding support for webviews
3
+
4
+ Background:
5
+ Given I have navigated to the webview screen
6
+
7
+ @focus
8
+ Scenario: Clicking a link in a WebView
9
+ When I click the text "Coffee" in a webview
10
+ Then I should see the text "Starbucks" in a webview
11
+
12
+
13
+
14
+
@@ -50,6 +50,13 @@ module Gametel
50
50
  @platform = Gametel::Platforms::BrazenheadPlatform.new if pform == :brazenhead
51
51
  end
52
52
 
53
+ #
54
+ # click on the provided text
55
+ #
56
+ def click_on_text(text)
57
+ platform.click_on_text text
58
+ end
59
+
53
60
  #
54
61
  # Returns true if the provided text is found on the screen
55
62
  #
@@ -255,6 +255,18 @@ module Gametel
255
255
  Gametel::Views::Image.new(platform, locator)
256
256
  end
257
257
  end
258
+
259
+ def webview(name, locator)
260
+
261
+ end
262
+
263
+ def action_item(name, locator)
264
+ define_method(name) do
265
+ platform.click_menu(locator)
266
+ end
267
+ end
268
+
269
+ alias_method :menu_item, :action_item
258
270
  end
259
271
  end
260
272
 
@@ -0,0 +1,18 @@
1
+ require 'brazenhead'
2
+
3
+ module Gametel
4
+ module Platforms
5
+ module Menu
6
+ def click_menu_by_id(id)
7
+ chain_calls do |device|
8
+ device.id_from_name id, :target => 'Brazenhead', :variable => '@@id@@'
9
+ device.click_on_action_bar_item '@@id@@', :target => 'Robotium'
10
+ end
11
+ end
12
+
13
+ def click_menu_by_text(text)
14
+ click_on_menu_item text
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,6 +1,7 @@
1
1
  require 'brazenhead'
2
2
  require File.join(File.dirname(__FILE__), 'brazenhead', 'basic')
3
3
  require File.join(File.dirname(__FILE__), 'brazenhead', 'button')
4
+ require File.join(File.dirname(__FILE__), 'brazenhead', 'menu')
4
5
  require File.join(File.dirname(__FILE__), 'brazenhead', 'progress')
5
6
  require File.join(File.dirname(__FILE__), 'brazenhead', 'spinner')
6
7
  require File.join(File.dirname(__FILE__), 'brazenhead', 'text')
@@ -19,6 +20,7 @@ module Gametel
19
20
  include Gametel::Platforms::Text
20
21
  include Gametel::Platforms::View
21
22
  include Gametel::Platforms::ListItem
23
+ include Gametel::Platforms::Menu
22
24
 
23
25
  ENTER_KEY = 66
24
26
 
@@ -98,6 +100,14 @@ module Gametel
98
100
  result = click_on_view_by_id(locator[:id]) if locator[:id]
99
101
  end
100
102
 
103
+ #
104
+ # click a menu item
105
+ #
106
+ def click_menu(locator)
107
+ click_menu_by_id(locator[:id]) if locator[:id]
108
+ click_menu_by_text(locator[:text]) if locator[:text]
109
+ end
110
+
101
111
  #
102
112
  # get the selected spinner value
103
113
  #
@@ -135,17 +145,25 @@ module Gametel
135
145
  # determine if a view exists
136
146
  #
137
147
  def has_view?(locator)
138
- result = get_view_by_id(locator)
139
- result.body.include? 'windowLocation'
148
+ begin
149
+ result = get_view_by_id(locator)
150
+ result.body.include? 'windowLocation'
151
+ rescue Exception
152
+ false
153
+ end
140
154
  end
141
155
 
142
156
  #
143
157
  # return if a view has a drawable
144
158
  #
145
159
  def has_drawable?(locator)
146
- view = get_view_by_id(locator[:id]) if locator[:id]
147
- view = get_image(locator[:index]) if locator[:index]
148
- last_json['hasDrawable']
160
+ begin
161
+ view = get_view_by_id(locator[:id]) if locator[:id]
162
+ view = get_image(locator[:index]) if locator[:index]
163
+ last_json['hasDrawable']
164
+ rescue Exception
165
+ false
166
+ end
149
167
  end
150
168
 
151
169
  #
@@ -1,3 +1,3 @@
1
1
  module Gametel
2
- VERSION = "0.6"
2
+ VERSION = "0.7"
3
3
  end
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ class MenuScreen
4
+ include Gametel
5
+
6
+ action_item(:action_by_id, :id => 'action_item_id')
7
+ menu_item(:menu_by_text, :text => 'Ze Text')
8
+ end
9
+
10
+ describe Gametel::Platforms::Menu do
11
+ let(:screen) { MenuScreen.new }
12
+ let(:platform) { brazenhead_platform(screen) }
13
+ let(:accumulator) { double('accumulator') }
14
+ let(:device) { double('device') }
15
+ let(:result) { double('result') }
16
+
17
+ before(:each) do
18
+ platform.stub(:accumulator).and_return(accumulator)
19
+ platform.stub(:device).and_return(device)
20
+ accumulator.stub(:clear)
21
+ accumulator.stub(:message)
22
+ device.stub(:send).and_return(result)
23
+ end
24
+
25
+ it 'can select menus by their id' do
26
+ accumulator.should_receive(:id_from_name).with('action_item_id', :target => 'Brazenhead', :variable => '@@id@@')
27
+ accumulator.should_receive(:click_on_action_bar_item).with('@@id@@', :target => 'Robotium')
28
+ screen.action_by_id
29
+ end
30
+
31
+ it 'can select menus by text' do
32
+ platform.should_receive(:click_on_menu_item).with('Ze Text')
33
+ screen.menu_by_text
34
+ end
35
+ end
@@ -11,6 +11,8 @@ end
11
11
 
12
12
  require 'rspec'
13
13
  require 'gametel'
14
+ require 'coveralls'
15
+ Coveralls.wear!
14
16
 
15
17
  def brazenhead_platform(gametel)
16
18
  platform = Gametel::Platforms::BrazenheadPlatform.new
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gametel
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.6'
5
- prerelease:
4
+ version: '0.7'
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jeffrey S. Morgan
@@ -10,28 +9,25 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-05-03 00:00:00.000000000 Z
12
+ date: 2013-06-08 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: brazenhead
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
18
  - - ! '>='
21
19
  - !ruby/object:Gem::Version
22
- version: 0.4.6
20
+ version: 0.4.7
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
25
  - - ! '>='
29
26
  - !ruby/object:Gem::Version
30
- version: 0.4.6
27
+ version: 0.4.7
31
28
  - !ruby/object:Gem::Dependency
32
29
  name: ADB
33
30
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
31
  requirements:
36
32
  - - ! '>='
37
33
  - !ruby/object:Gem::Version
@@ -39,7 +35,6 @@ dependencies:
39
35
  type: :runtime
40
36
  prerelease: false
41
37
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
38
  requirements:
44
39
  - - ! '>='
45
40
  - !ruby/object:Gem::Version
@@ -47,7 +42,6 @@ dependencies:
47
42
  - !ruby/object:Gem::Dependency
48
43
  name: page_navigation
49
44
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
45
  requirements:
52
46
  - - ! '>='
53
47
  - !ruby/object:Gem::Version
@@ -55,7 +49,6 @@ dependencies:
55
49
  type: :runtime
56
50
  prerelease: false
57
51
  version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
52
  requirements:
60
53
  - - ! '>='
61
54
  - !ruby/object:Gem::Version
@@ -63,7 +56,6 @@ dependencies:
63
56
  - !ruby/object:Gem::Dependency
64
57
  name: rspec
65
58
  requirement: !ruby/object:Gem::Requirement
66
- none: false
67
59
  requirements:
68
60
  - - ! '>='
69
61
  - !ruby/object:Gem::Version
@@ -71,7 +63,6 @@ dependencies:
71
63
  type: :development
72
64
  prerelease: false
73
65
  version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
66
  requirements:
76
67
  - - ! '>='
77
68
  - !ruby/object:Gem::Version
@@ -79,7 +70,6 @@ dependencies:
79
70
  - !ruby/object:Gem::Dependency
80
71
  name: cucumber
81
72
  requirement: !ruby/object:Gem::Requirement
82
- none: false
83
73
  requirements:
84
74
  - - ! '>='
85
75
  - !ruby/object:Gem::Version
@@ -87,7 +77,6 @@ dependencies:
87
77
  type: :development
88
78
  prerelease: false
89
79
  version_requirements: !ruby/object:Gem::Requirement
90
- none: false
91
80
  requirements:
92
81
  - - ! '>='
93
82
  - !ruby/object:Gem::Version
@@ -95,7 +84,6 @@ dependencies:
95
84
  - !ruby/object:Gem::Dependency
96
85
  name: require_all
97
86
  requirement: !ruby/object:Gem::Requirement
98
- none: false
99
87
  requirements:
100
88
  - - ! '>='
101
89
  - !ruby/object:Gem::Version
@@ -103,7 +91,6 @@ dependencies:
103
91
  type: :development
104
92
  prerelease: false
105
93
  version_requirements: !ruby/object:Gem::Requirement
106
- none: false
107
94
  requirements:
108
95
  - - ! '>='
109
96
  - !ruby/object:Gem::Version
@@ -123,6 +110,7 @@ files:
123
110
  - features/is_enabled.feature
124
111
  - features/list_item.feature
125
112
  - features/main_screen.feature
113
+ - features/menu.feature
126
114
  - features/navigation.feature
127
115
  - features/progress.feature
128
116
  - features/radio_button.feature
@@ -135,17 +123,21 @@ files:
135
123
  - features/step_definitions/is_enabled_steps.rb
136
124
  - features/step_definitions/list_item_steps.rb
137
125
  - features/step_definitions/main_screen_steps.rb
126
+ - features/step_definitions/menu_steps.rb
138
127
  - features/step_definitions/navigation_steps.rb
139
128
  - features/step_definitions/progress_steps.rb
140
129
  - features/step_definitions/radio_button_steps.rb
141
130
  - features/step_definitions/spinners_steps.rb
142
131
  - features/step_definitions/text_steps.rb
143
132
  - features/step_definitions/view_steps.rb
133
+ - features/step_definitions/webview_steps.rb
144
134
  - features/support/ApiDemos.apk
145
135
  - features/support/core_ext/string.rb
146
136
  - features/support/debug.keystore
147
137
  - features/support/env.rb
148
138
  - features/support/hooks.rb
139
+ - features/support/screens/action_bar.rb
140
+ - features/support/screens/action_bar_usage.rb
149
141
  - features/support/screens/alert_dialogs_screen.rb
150
142
  - features/support/screens/app_menu_screen.rb
151
143
  - features/support/screens/auto_complete_menu_screen.rb
@@ -161,8 +153,11 @@ files:
161
153
  - features/support/screens/never_will_exist.rb
162
154
  - features/support/screens/seek_bar_screen.rb
163
155
  - features/support/screens/views_menu_screen.rb
156
+ - features/support/screens/webview_main_screen.rb
157
+ - features/support/screens/webview_screen.rb
164
158
  - features/text.feature
165
159
  - features/view.feature
160
+ - features/webview.feature
166
161
  - lib/gametel.rb
167
162
  - lib/gametel/accessors.rb
168
163
  - lib/gametel/driver.rb
@@ -170,6 +165,7 @@ files:
170
165
  - lib/gametel/platforms/brazenhead/basic.rb
171
166
  - lib/gametel/platforms/brazenhead/button.rb
172
167
  - lib/gametel/platforms/brazenhead/list_item.rb
168
+ - lib/gametel/platforms/brazenhead/menu.rb
173
169
  - lib/gametel/platforms/brazenhead/progress.rb
174
170
  - lib/gametel/platforms/brazenhead/spinner.rb
175
171
  - lib/gametel/platforms/brazenhead/text.rb
@@ -187,6 +183,7 @@ files:
187
183
  - lib/gametel/views/text.rb
188
184
  - lib/gametel/views/view.rb
189
185
  - lib/gametel/waiter.rb
186
+ - spec/lib/gametel/accessors/menu_spec.rb
190
187
  - spec/lib/gametel/accessors/text_spec.rb
191
188
  - spec/lib/gametel/accessors_spec.rb
192
189
  - spec/lib/gametel/navigation_spec.rb
@@ -195,27 +192,26 @@ files:
195
192
  - spec/spec_helper.rb
196
193
  homepage: http://github.com/leandog/gametel
197
194
  licenses: []
195
+ metadata: {}
198
196
  post_install_message:
199
197
  rdoc_options: []
200
198
  require_paths:
201
199
  - lib
202
200
  required_ruby_version: !ruby/object:Gem::Requirement
203
- none: false
204
201
  requirements:
205
202
  - - ! '>='
206
203
  - !ruby/object:Gem::Version
207
204
  version: '0'
208
205
  required_rubygems_version: !ruby/object:Gem::Requirement
209
- none: false
210
206
  requirements:
211
207
  - - ! '>='
212
208
  - !ruby/object:Gem::Version
213
209
  version: '0'
214
210
  requirements: []
215
211
  rubyforge_project:
216
- rubygems_version: 1.8.25
212
+ rubygems_version: 2.0.3
217
213
  signing_key:
218
- specification_version: 3
214
+ specification_version: 4
219
215
  summary: High level wrapper around android drivers
220
216
  test_files:
221
217
  - features/button.feature
@@ -225,6 +221,7 @@ test_files:
225
221
  - features/is_enabled.feature
226
222
  - features/list_item.feature
227
223
  - features/main_screen.feature
224
+ - features/menu.feature
228
225
  - features/navigation.feature
229
226
  - features/progress.feature
230
227
  - features/radio_button.feature
@@ -237,17 +234,21 @@ test_files:
237
234
  - features/step_definitions/is_enabled_steps.rb
238
235
  - features/step_definitions/list_item_steps.rb
239
236
  - features/step_definitions/main_screen_steps.rb
237
+ - features/step_definitions/menu_steps.rb
240
238
  - features/step_definitions/navigation_steps.rb
241
239
  - features/step_definitions/progress_steps.rb
242
240
  - features/step_definitions/radio_button_steps.rb
243
241
  - features/step_definitions/spinners_steps.rb
244
242
  - features/step_definitions/text_steps.rb
245
243
  - features/step_definitions/view_steps.rb
244
+ - features/step_definitions/webview_steps.rb
246
245
  - features/support/ApiDemos.apk
247
246
  - features/support/core_ext/string.rb
248
247
  - features/support/debug.keystore
249
248
  - features/support/env.rb
250
249
  - features/support/hooks.rb
250
+ - features/support/screens/action_bar.rb
251
+ - features/support/screens/action_bar_usage.rb
251
252
  - features/support/screens/alert_dialogs_screen.rb
252
253
  - features/support/screens/app_menu_screen.rb
253
254
  - features/support/screens/auto_complete_menu_screen.rb
@@ -263,8 +264,12 @@ test_files:
263
264
  - features/support/screens/never_will_exist.rb
264
265
  - features/support/screens/seek_bar_screen.rb
265
266
  - features/support/screens/views_menu_screen.rb
267
+ - features/support/screens/webview_main_screen.rb
268
+ - features/support/screens/webview_screen.rb
266
269
  - features/text.feature
267
270
  - features/view.feature
271
+ - features/webview.feature
272
+ - spec/lib/gametel/accessors/menu_spec.rb
268
273
  - spec/lib/gametel/accessors/text_spec.rb
269
274
  - spec/lib/gametel/accessors_spec.rb
270
275
  - spec/lib/gametel/navigation_spec.rb