gametel 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -3
- data/ApiDemos/res/layout/buttons_1.xml +6 -0
- data/ApiDemos/res/layout/controls_1.xml +1 -0
- data/ApiDemos/res/values/strings.xml +1 -0
- data/ApiDemos/src/com/example/android/apis/accessibility/ClockBackActivity.java +0 -1
- data/ApiDemos/src/com/example/android/apis/accessibility/TaskBackService.java +0 -1
- data/ApiDemos/src/com/example/android/apis/accessibility/TaskListActivity.java +0 -1
- data/ApiDemos/src/com/example/android/apis/accessibility/TaskListView.java +0 -4
- data/ApiDemos/src/com/example/android/apis/app/ActionBarSettingsActionProviderActivity.java +0 -1
- data/ApiDemos/src/com/example/android/apis/app/DeviceAdminSample.java +0 -4
- data/ApiDemos/src/com/example/android/apis/app/LoaderCursor.java +1 -1
- data/ApiDemos/src/com/example/android/apis/app/LoaderCustom.java +5 -6
- data/ApiDemos/src/com/example/android/apis/app/VoiceRecognition.java +0 -4
- data/ApiDemos/src/com/example/android/apis/content/FileProvider.java +0 -1
- data/ApiDemos/src/com/example/android/apis/view/GameControllerInput.java +4 -11
- data/ApiDemos/src/com/example/android/apis/view/Hover.java +1 -11
- data/ApiDemos/src/com/example/android/apis/view/Switches.java +0 -1
- data/ChangeLog +10 -0
- data/README.md +14 -1
- data/cucumber.yml +10 -2
- data/features/button.feature +5 -0
- data/features/checkbox.feature +4 -0
- data/features/is_enabled.feature +9 -0
- data/features/list_item.feature +4 -0
- data/features/main_screen.feature +5 -0
- data/features/radio_button.feature +3 -0
- data/features/step_definitions/button_steps.rb +4 -0
- data/features/step_definitions/controls_steps.rb +12 -3
- data/features/step_definitions/is_enabled_steps.rb +7 -0
- data/features/step_definitions/list_item_steps.rb +4 -0
- data/features/step_definitions/main_screen_steps.rb +6 -0
- data/features/step_definitions/view_steps.rb +20 -0
- data/features/support/app_installation_hooks.rb +9 -17
- data/features/support/app_life_cycle_hooks.rb +4 -21
- data/features/support/screens/alert_dialogs_screen.rb +5 -0
- data/features/support/screens/app_menu_screen.rb +6 -0
- data/features/support/screens/auto_complete_menu_screen.rb +11 -0
- data/features/support/screens/auto_complete_screen_top_screen.rb +7 -0
- data/features/support/screens/buttons_screen.rb +1 -0
- data/features/support/screens/controls_screen.rb +5 -2
- data/features/support/screens/custom_views_screen.rb +7 -0
- data/features/support/screens/main_menu_screen.rb +1 -0
- data/features/text.feature +33 -3
- data/features/view.feature +11 -0
- data/gametel.gemspec +2 -2
- data/lib/gametel.rb +14 -0
- data/lib/gametel/accessors.rb +40 -3
- data/lib/gametel/platforms/calabash.rb +42 -3
- data/lib/gametel/version.rb +1 -1
- data/spec/lib/gametel/accessors_spec.rb +102 -32
- data/spec/lib/gametel_spec.rb +10 -0
- metadata +23 -13
- data/ApiDemos/bin/ApiDemos.apk +0 -0
- data/ApiDemos/local.properties +0 -10
@@ -0,0 +1,9 @@
|
|
1
|
+
Feature: Determining whether or not a view is enabled
|
2
|
+
|
3
|
+
Scenario: Identifying a disabled view
|
4
|
+
When I'm on the buttons screen
|
5
|
+
Then I can tell when buttons are disabled
|
6
|
+
|
7
|
+
Scenario: Identifying an enabled view
|
8
|
+
When I'm on the buttons screen
|
9
|
+
Then I can tell when buttons are enabled
|
data/features/list_item.feature
CHANGED
@@ -11,3 +11,7 @@ Feature: Interacting with the list item control
|
|
11
11
|
Scenario: Should be able to click a list item when it is not visible on the screen
|
12
12
|
When I click the list item "Views" from the main menu
|
13
13
|
Then I should see the "Controls" list item
|
14
|
+
|
15
|
+
Scenario: Should be able to click a list item from a specific list
|
16
|
+
When I click the first list item by index on the first list
|
17
|
+
Then I should see the "Accessibility Service" list item
|
@@ -16,3 +16,8 @@ Feature: Interacting with the elements on the main screen
|
|
16
16
|
Then I should see the "Views" list item
|
17
17
|
When I scroll up to the top of the screen
|
18
18
|
Then I should see the "Accessibility" list item
|
19
|
+
|
20
|
+
Scenario: Pressing the enter key
|
21
|
+
When I hit the enter key twice
|
22
|
+
Then I should see the "Accessibility Service" list item
|
23
|
+
|
@@ -8,12 +8,21 @@ Given /^I\'m on the controls screen$/ do
|
|
8
8
|
screen.wait_for_text 'Light Theme'
|
9
9
|
end
|
10
10
|
on(ControlsMenuScreen).light_theme
|
11
|
+
on(ControlsScreen).wait_for_text 'Views/Controls'
|
11
12
|
end
|
12
13
|
|
13
|
-
When /^I enter "(.*?)" into the text field$/ do |text_value|
|
14
|
-
on(ControlsScreen).
|
14
|
+
When /^I enter "(.*?)" into the text field identified by "(.*?)"$/ do |text_value, how|
|
15
|
+
on(ControlsScreen).send "text_field_#{how}=", text_value
|
15
16
|
end
|
16
17
|
|
17
|
-
Then /^I should have the value "(.*?)" on the screen$/ do |text_value|
|
18
|
+
Then /^I should have the value "(.*?)" on the control screen$/ do |text_value|
|
18
19
|
on(ControlsScreen).should have_text text_value
|
19
20
|
end
|
21
|
+
|
22
|
+
When /^I clear the text from the text field identified by "(.*?)"$/ do |how|
|
23
|
+
on(ControlsScreen).send "clear_text_field_#{how}"
|
24
|
+
end
|
25
|
+
|
26
|
+
Then /^I should not have the value "(.*?)" on the control screen$/ do |text_value|
|
27
|
+
on(ControlsScreen).should_not have_text text_value
|
28
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
When /^I am perusing options for Alert Dialogs$/ do
|
2
|
+
on(MainMenuScreen).app
|
3
|
+
on(AppScreen).alert_dialogs
|
4
|
+
end
|
5
|
+
|
6
|
+
When /^I choose the List Dialogs button by id$/ do
|
7
|
+
on(AlertDialogsScreen).list_dialog
|
8
|
+
end
|
9
|
+
|
10
|
+
When /^I am observing custom views$/ do
|
11
|
+
on(MainMenuScreen) do |screen|
|
12
|
+
screen.scroll_down
|
13
|
+
screen.views
|
14
|
+
end
|
15
|
+
on(ViewsMenuScreen).custom
|
16
|
+
end
|
17
|
+
|
18
|
+
Then /^I should see the "(.*?)" custom view$/ do |view_text|
|
19
|
+
on(CustomViewScreen).send view_text
|
20
|
+
end
|
@@ -5,23 +5,15 @@ AfterConfiguration do |config|
|
|
5
5
|
end
|
6
6
|
|
7
7
|
Before do |scenario|
|
8
|
-
|
9
|
-
FeatureNameMemory.feature_name
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
!FeatureNameMemory.feature_name.nil?
|
18
|
-
end
|
19
|
-
|
20
|
-
def deploy_app()
|
21
|
-
log "Is first scenario - reinstalling apps"
|
22
|
-
uninstall_apps
|
23
|
-
install_app(ENV["TEST_APP_PATH"])
|
24
|
-
install_app(ENV["APP_PATH"])
|
8
|
+
feature_name = scenario.feature.name
|
9
|
+
if FeatureNameMemory.feature_name != feature_name
|
10
|
+
log "Is first scenario - reinstalling apps"
|
11
|
+
|
12
|
+
uninstall_apps
|
13
|
+
install_app(ENV["TEST_APP_PATH"])
|
14
|
+
install_app(ENV["APP_PATH"])
|
15
|
+
FeatureNameMemory.feature_name = feature_name
|
16
|
+
end
|
25
17
|
end
|
26
18
|
|
27
19
|
FeatureNameMemory = Class.new
|
@@ -3,26 +3,9 @@ require 'calabash-android/management/adb'
|
|
3
3
|
Before do |scenario|
|
4
4
|
|
5
5
|
return if scenario.failed? #No need to start the server is anything before this has failed.
|
6
|
-
|
7
|
-
log "Starting test server using:"
|
8
|
-
log cmd
|
9
|
-
if is_windows?
|
10
|
-
system(%Q(start /MIN cmd /C #{cmd}))
|
11
|
-
else
|
12
|
-
`#{cmd} 1>&2 &`
|
13
|
-
end
|
14
|
-
|
15
|
-
sleep 2
|
16
|
-
begin
|
17
|
-
connect_to_test_server
|
18
|
-
log "Connection established"
|
19
|
-
rescue Exception => e
|
20
|
-
log "Exception:#{e.backtrace}"
|
21
|
-
end
|
6
|
+
start_test_server_in_background
|
22
7
|
end
|
23
8
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
disconnect_from_test_server
|
28
|
-
end
|
9
|
+
After do
|
10
|
+
shutdown_test_server
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class AutoCompleteMenuScreen
|
2
|
+
include Gametel
|
3
|
+
|
4
|
+
list_item(:screen_top, :text => '1. Screen Top')
|
5
|
+
list_item(:screen_bottom, :text => '2. Screen Bottom')
|
6
|
+
list_item(:scroll, :text => '3. Scroll')
|
7
|
+
list_item(:contacts, :text => '4. Contacts')
|
8
|
+
list_item(:contacts_with_hint, :text => '5. Contacts with Hint')
|
9
|
+
list_item(:multiple_items, :text => '6. Multiple items')
|
10
|
+
|
11
|
+
end
|
@@ -1,11 +1,14 @@
|
|
1
1
|
class ControlsScreen
|
2
2
|
include Gametel
|
3
3
|
|
4
|
-
text(:
|
4
|
+
text(:text_field_index, :index => 0)
|
5
|
+
text(:text_field_id, :id => 'edit')
|
6
|
+
text(:text_field_name, :content_description => 'Edit Description')
|
5
7
|
button(:enabled_save, :index => 0)
|
6
8
|
button(:disabled_save, :index => 1)
|
7
9
|
checkbox(:checkbox_index, :index => 0)
|
8
10
|
checkbox(:checkbox_text, :text => 'Checkbox 2')
|
11
|
+
checkbox(:checkbox_id, :id => 'check1')
|
9
12
|
radio_button(:radio_button_text, :text => 'RadioButton 1')
|
10
|
-
|
13
|
+
radio_button(:radio_button_id, :id => 'radio2')
|
11
14
|
end
|
@@ -3,6 +3,7 @@ class MainMenuScreen
|
|
3
3
|
|
4
4
|
list_item(:first_list_item_text, :text => 'Accessibility')
|
5
5
|
list_item(:first_list_item_index, :index => 0)
|
6
|
+
list_item(:first_list_item_index_list, :index => 0, :list => 0)
|
6
7
|
list_item(:app, :text => 'App')
|
7
8
|
list_item(:content, :text => 'Content')
|
8
9
|
list_item(:graphics, :text => 'Graphics')
|
data/features/text.feature
CHANGED
@@ -1,7 +1,37 @@
|
|
1
1
|
Feature: Interacting with the standard text field
|
2
2
|
|
3
|
-
Scenario: Entering text into a text field
|
3
|
+
Scenario: Entering text into a text field identified by index
|
4
4
|
Given I'm on the controls screen
|
5
|
-
When I enter "example text" into the text field
|
6
|
-
Then I should have the value "example text" on the screen
|
5
|
+
When I enter "example text" into the text field identified by "index"
|
6
|
+
Then I should have the value "example text" on the control screen
|
7
7
|
|
8
|
+
Scenario: Entering text into a text field identified by id
|
9
|
+
Given I'm on the controls screen
|
10
|
+
When I enter "example text" into the text field identified by "id"
|
11
|
+
Then I should have the value "example text" on the control screen
|
12
|
+
|
13
|
+
Scenario: Entering text into a text field identified by name
|
14
|
+
Given I'm on the controls screen
|
15
|
+
When I enter "example text" into the text field identified by "name"
|
16
|
+
Then I should have the value "example text" on the control screen
|
17
|
+
|
18
|
+
Scenario: Clearing the text from a text field identified by index
|
19
|
+
Given I'm on the controls screen
|
20
|
+
When I enter "example text" into the text field identified by "index"
|
21
|
+
Then I should have the value "example text" on the control screen
|
22
|
+
When I clear the text from the text field identified by "index"
|
23
|
+
Then I should not have the value "example text" on the control screen
|
24
|
+
|
25
|
+
Scenario: Clearing the text from a text field identified by id
|
26
|
+
Given I'm on the controls screen
|
27
|
+
When I enter "example text" into the text field identified by "id"
|
28
|
+
Then I should have the value "example text" on the control screen
|
29
|
+
When I clear the text from the text field identified by "id"
|
30
|
+
Then I should not have the value "example text" on the control screen
|
31
|
+
|
32
|
+
Scenario: Clearing the text from a text field identified by name
|
33
|
+
Given I'm on the controls screen
|
34
|
+
When I enter "example text" into the text field identified by "name"
|
35
|
+
Then I should have the value "example text" on the control screen
|
36
|
+
When I clear the text from the text field identified by "name"
|
37
|
+
Then I should not have the value "example text" on the control screen
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Feature: Interacting with view elements
|
2
|
+
|
3
|
+
Scenario: Clicking on views by their id
|
4
|
+
When I am perusing options for Alert Dialogs
|
5
|
+
And I choose the List Dialogs button by id
|
6
|
+
Then I should see the "Command one" list item
|
7
|
+
|
8
|
+
@ignore
|
9
|
+
Scenario: Clicking on view by their text
|
10
|
+
When I am observing custom views
|
11
|
+
Then I should see the "blue" custom view
|
data/gametel.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.email = ["jeff.morgan@leandog.com", "levi@leandog.com"]
|
7
7
|
gem.description = %q{High level wrapper around android drivers}
|
8
8
|
gem.summary = %q{High level wrapper around android drivers}
|
9
|
-
gem.homepage = ""
|
9
|
+
gem.homepage = "http://github.com/leandog/gametel"
|
10
10
|
|
11
11
|
gem.files = `git ls-files`.split($\)
|
12
12
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = Gametel::VERSION
|
17
17
|
|
18
|
-
gem.add_dependency 'calabash-android', '>= 0.
|
18
|
+
gem.add_dependency 'calabash-android', '>= 0.2.11'
|
19
19
|
|
20
20
|
gem.add_development_dependency 'rspec', '>= 2.6.0'
|
21
21
|
gem.add_development_dependency 'cucumber'
|
data/lib/gametel.rb
CHANGED
@@ -23,6 +23,13 @@ module Gametel
|
|
23
23
|
platform.has_text?(text)
|
24
24
|
end
|
25
25
|
|
26
|
+
#
|
27
|
+
# Returns true if the view is enabled
|
28
|
+
#
|
29
|
+
def enabled?(locator)
|
30
|
+
platform.enabled?(locator)
|
31
|
+
end
|
32
|
+
|
26
33
|
#
|
27
34
|
# Press the back button
|
28
35
|
#
|
@@ -30,6 +37,13 @@ module Gametel
|
|
30
37
|
platform.back
|
31
38
|
end
|
32
39
|
|
40
|
+
#
|
41
|
+
# Press the enter key
|
42
|
+
#
|
43
|
+
def enter
|
44
|
+
platform.enter
|
45
|
+
end
|
46
|
+
|
33
47
|
#
|
34
48
|
# scroll down
|
35
49
|
#
|
data/lib/gametel/accessors.rb
CHANGED
@@ -1,22 +1,27 @@
|
|
1
1
|
module Gametel
|
2
2
|
module Accessors
|
3
3
|
#
|
4
|
-
# Generates
|
4
|
+
# Generates two method to enter text into a text field and to
|
5
|
+
# clear the text field
|
5
6
|
#
|
6
7
|
# @example
|
7
8
|
# text(:first_name, :index => 0)
|
8
|
-
# # will generate 'first_name=
|
9
|
+
# # will generate 'first_name=' and 'clear_first_name' methods
|
9
10
|
#
|
10
11
|
# @param [String] the name used for the generated methods
|
11
12
|
# @param [Hash] locator for how the text is found The valid
|
12
13
|
# keys are:
|
13
|
-
# * :
|
14
|
+
# * :content_description
|
15
|
+
# * :id
|
14
16
|
# * :index
|
15
17
|
#
|
16
18
|
def text(name, locator)
|
17
19
|
define_method("#{name}=") do |value|
|
18
20
|
platform.enter_text(value, locator)
|
19
21
|
end
|
22
|
+
define_method("clear_#{name}") do
|
23
|
+
platform.clear_text(locator)
|
24
|
+
end
|
20
25
|
end
|
21
26
|
|
22
27
|
#
|
@@ -31,6 +36,7 @@ module Gametel
|
|
31
36
|
# keys are:
|
32
37
|
# * :text
|
33
38
|
# * :index
|
39
|
+
# * :id
|
34
40
|
#
|
35
41
|
def button(name, locator)
|
36
42
|
define_method(name) do
|
@@ -45,11 +51,23 @@ module Gametel
|
|
45
51
|
# list_item(:details, :text => 'Details')
|
46
52
|
# # will generate 'details' method
|
47
53
|
#
|
54
|
+
# @example
|
55
|
+
# list_item(:details, :index => 1, :list => 1)
|
56
|
+
# # will generate 'details' method to select second item in the
|
57
|
+
# # second list
|
58
|
+
#
|
59
|
+
# @example
|
60
|
+
# list_item(:details, :index => 2)
|
61
|
+
# # will generate 'details' method to select third item in the
|
62
|
+
# # first list
|
63
|
+
#
|
48
64
|
# @param [String] the name used for the generated methods
|
49
65
|
# @param [Hash] locator for how the list item is found The valid
|
50
66
|
# keys are:
|
51
67
|
# * :text
|
52
68
|
# * :index
|
69
|
+
# * :list - only us with :index to indicate which list to use on
|
70
|
+
# the screen. Default is 0
|
53
71
|
#
|
54
72
|
def list_item(name, locator)
|
55
73
|
define_method(name) do
|
@@ -69,6 +87,7 @@ module Gametel
|
|
69
87
|
# keys are:
|
70
88
|
# * :text
|
71
89
|
# * :index
|
90
|
+
# * :id
|
72
91
|
#
|
73
92
|
def checkbox(name, locator)
|
74
93
|
define_method(name) do
|
@@ -87,12 +106,30 @@ module Gametel
|
|
87
106
|
# @param [Hash] locator for how the checkbox is found The valid
|
88
107
|
# keys are:
|
89
108
|
# * :text
|
109
|
+
# * :id
|
90
110
|
#
|
91
111
|
def radio_button(name, locator)
|
92
112
|
define_method(name) do
|
93
113
|
platform.click_radio_button(locator)
|
94
114
|
end
|
95
115
|
end
|
116
|
+
|
117
|
+
#
|
118
|
+
# Generates one method to click a view.
|
119
|
+
# @example
|
120
|
+
# view(:clickable_text, :id => 'id_name_of_your_control')
|
121
|
+
# # will generate 'clickable_text' method
|
122
|
+
#
|
123
|
+
# @param [String] the name used for the generated methods
|
124
|
+
# @param [Hash] locator indicating an id for how the view is found.
|
125
|
+
# The only valid keys are:
|
126
|
+
# * :id
|
127
|
+
#
|
128
|
+
def view(name, locator)
|
129
|
+
define_method(name) do
|
130
|
+
platform.click_view(locator)
|
131
|
+
end
|
132
|
+
end
|
96
133
|
end
|
97
134
|
end
|
98
135
|
|