gametel 0.1 → 0.2

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.
Files changed (54) hide show
  1. data/.gitignore +4 -3
  2. data/ApiDemos/res/layout/buttons_1.xml +6 -0
  3. data/ApiDemos/res/layout/controls_1.xml +1 -0
  4. data/ApiDemos/res/values/strings.xml +1 -0
  5. data/ApiDemos/src/com/example/android/apis/accessibility/ClockBackActivity.java +0 -1
  6. data/ApiDemos/src/com/example/android/apis/accessibility/TaskBackService.java +0 -1
  7. data/ApiDemos/src/com/example/android/apis/accessibility/TaskListActivity.java +0 -1
  8. data/ApiDemos/src/com/example/android/apis/accessibility/TaskListView.java +0 -4
  9. data/ApiDemos/src/com/example/android/apis/app/ActionBarSettingsActionProviderActivity.java +0 -1
  10. data/ApiDemos/src/com/example/android/apis/app/DeviceAdminSample.java +0 -4
  11. data/ApiDemos/src/com/example/android/apis/app/LoaderCursor.java +1 -1
  12. data/ApiDemos/src/com/example/android/apis/app/LoaderCustom.java +5 -6
  13. data/ApiDemos/src/com/example/android/apis/app/VoiceRecognition.java +0 -4
  14. data/ApiDemos/src/com/example/android/apis/content/FileProvider.java +0 -1
  15. data/ApiDemos/src/com/example/android/apis/view/GameControllerInput.java +4 -11
  16. data/ApiDemos/src/com/example/android/apis/view/Hover.java +1 -11
  17. data/ApiDemos/src/com/example/android/apis/view/Switches.java +0 -1
  18. data/ChangeLog +10 -0
  19. data/README.md +14 -1
  20. data/cucumber.yml +10 -2
  21. data/features/button.feature +5 -0
  22. data/features/checkbox.feature +4 -0
  23. data/features/is_enabled.feature +9 -0
  24. data/features/list_item.feature +4 -0
  25. data/features/main_screen.feature +5 -0
  26. data/features/radio_button.feature +3 -0
  27. data/features/step_definitions/button_steps.rb +4 -0
  28. data/features/step_definitions/controls_steps.rb +12 -3
  29. data/features/step_definitions/is_enabled_steps.rb +7 -0
  30. data/features/step_definitions/list_item_steps.rb +4 -0
  31. data/features/step_definitions/main_screen_steps.rb +6 -0
  32. data/features/step_definitions/view_steps.rb +20 -0
  33. data/features/support/app_installation_hooks.rb +9 -17
  34. data/features/support/app_life_cycle_hooks.rb +4 -21
  35. data/features/support/screens/alert_dialogs_screen.rb +5 -0
  36. data/features/support/screens/app_menu_screen.rb +6 -0
  37. data/features/support/screens/auto_complete_menu_screen.rb +11 -0
  38. data/features/support/screens/auto_complete_screen_top_screen.rb +7 -0
  39. data/features/support/screens/buttons_screen.rb +1 -0
  40. data/features/support/screens/controls_screen.rb +5 -2
  41. data/features/support/screens/custom_views_screen.rb +7 -0
  42. data/features/support/screens/main_menu_screen.rb +1 -0
  43. data/features/text.feature +33 -3
  44. data/features/view.feature +11 -0
  45. data/gametel.gemspec +2 -2
  46. data/lib/gametel.rb +14 -0
  47. data/lib/gametel/accessors.rb +40 -3
  48. data/lib/gametel/platforms/calabash.rb +42 -3
  49. data/lib/gametel/version.rb +1 -1
  50. data/spec/lib/gametel/accessors_spec.rb +102 -32
  51. data/spec/lib/gametel_spec.rb +10 -0
  52. metadata +23 -13
  53. data/ApiDemos/bin/ApiDemos.apk +0 -0
  54. data/ApiDemos/local.properties +0 -10
@@ -10,8 +10,15 @@ module Gametel
10
10
  # enter text in a text box
11
11
  #
12
12
  def enter_text(text, locator)
13
- performAction('enter_text_into_named_field', text, locator[:name]) if locator[:name]
14
- performAction('enter_text_into_numbered_field', text, locator[:index] + 1) if locator[:index]
13
+ performAction 'enter_text_into_named_field', text, locator[:content_description] if locator[:content_description]
14
+ performAction 'enter_text_into_numbered_field', text, locator[:index] + 1 if locator[:index]
15
+ performAction 'enter_text_into_id_field', text, locator[:id] if locator[:id]
16
+ end
17
+
18
+ def clear_text(locator)
19
+ performAction 'clear_numbered_field', locator[:index] + 1 if locator[:index]
20
+ performAction 'clear_named_field', locator[:content_description] if locator[:content_description]
21
+ performAction 'clear_id_field', locator[:id] if locator[:id]
15
22
  end
16
23
 
17
24
  #
@@ -20,13 +27,15 @@ module Gametel
20
27
  def press_button(locator)
21
28
  performAction 'press_button_with_text', locator[:text] if locator[:text]
22
29
  performAction 'press_button_number', locator[:index] + 1 if locator[:index]
30
+ performAction 'click_on_view_by_id', locator[:id] if locator[:id]
23
31
  end
24
32
 
25
33
  #
26
34
  # press a list item
27
35
  #
28
36
  def press_list_item(locator)
29
- performAction 'press_list_item', locator[:index] + 1, 0 if locator[:index]
37
+ list = locator[:list] ? locator[:list] : 0
38
+ performAction 'press_list_item', locator[:index] + 1, list if locator[:index]
30
39
  performAction 'click_on_text', locator[:text] if locator[:text]
31
40
  end
32
41
 
@@ -36,6 +45,7 @@ module Gametel
36
45
  def click_checkbox(locator)
37
46
  performAction 'toggle_numbered_checkbox', locator[:index] + 1 if locator[:index]
38
47
  performAction 'click_on_text', locator[:text] if locator[:text]
48
+ performAction 'click_on_view_by_id', locator[:id] if locator[:id]
39
49
  end
40
50
 
41
51
  #
@@ -43,6 +53,15 @@ module Gametel
43
53
  #
44
54
  def click_radio_button(locator)
45
55
  performAction 'click_on_text', locator[:text] if locator[:text]
56
+ performAction 'click_on_view_by_id', locator[:id] if locator[:id]
57
+ end
58
+
59
+ #
60
+ # click a view
61
+ #
62
+ def click_view(locator)
63
+ performAction 'click_on_view_by_id', locator[:id] if locator[:id]
64
+ performAction 'click_on_text', locator[:text] if locator[:text]
46
65
  end
47
66
 
48
67
  #
@@ -57,6 +76,18 @@ module Gametel
57
76
  true
58
77
  end
59
78
 
79
+ #
80
+ # determine if a view is enabled
81
+ #
82
+ def enabled?(locator)
83
+ begin
84
+ performAction 'is_enabled', locator
85
+ rescue
86
+ return false
87
+ end
88
+ true
89
+ end
90
+
60
91
  #
61
92
  # press the back button
62
93
  #
@@ -64,6 +95,13 @@ module Gametel
64
95
  performAction 'go_back'
65
96
  end
66
97
 
98
+ #
99
+ # press the enter key
100
+ #
101
+ def enter
102
+ performAction 'send_key_enter'
103
+ end
104
+
67
105
  #
68
106
  # scroll down
69
107
  #
@@ -84,6 +122,7 @@ module Gametel
84
122
  def wait_for_text(text_to_find)
85
123
  performAction 'wait_for_text', text_to_find
86
124
  end
125
+
87
126
  end
88
127
  end
89
128
  end
@@ -1,3 +1,3 @@
1
1
  module Gametel
2
- VERSION = "0.1"
2
+ VERSION = "0.2"
3
3
  end
@@ -5,63 +5,133 @@ class AccessorsSampleScreen
5
5
 
6
6
  list_item(:first_list_item_text, :text => 'first item')
7
7
  list_item(:first_list_item_index, :index => 0)
8
+ list_item(:first_list_item_index_list, :index => 0, :list => 1)
8
9
  text(:first_name_index, :index => 2)
9
- text(:first_name_name, :name => 'Some name')
10
+ text(:first_name_name, :content_description => 'Some name')
11
+ text(:first_name_id, :id => 'fnid')
10
12
  button(:save_text, :text => 'Save')
11
13
  button(:save_index, :index => 1)
14
+ button(:save_id, :id => 'some_button_id')
12
15
  checkbox(:checkbox_index, :index => 0)
13
16
  checkbox(:checkbox_text, :text => 'Checkbox 2')
17
+ checkbox(:checkbox_id, :id => 'some_check_id')
14
18
  radio_button(:radio_text, :text => 'Radio Button 1')
19
+ radio_button(:radio_id, :id => 'some_radio_id')
20
+ view(:view_id, :id => 'some_view_id')
21
+ view(:view_text, :text => 'Any view text')
15
22
  end
16
23
 
17
24
  describe Gametel::Accessors do
18
25
  context "when using Calabash" do
19
26
  let(:screen) { AccessorsSampleScreen.new }
20
27
  let(:platform) { calabash_platform(screen) }
21
-
22
- it "should know how to press a list item by text" do
23
- platform.should_receive(:performAction).with('click_on_text', 'first item')
24
- screen.first_list_item_text
25
- end
26
28
 
27
- it "should know how to press a list item by index" do
28
- platform.should_receive(:performAction).with('press_list_item', 1, 0)
29
- screen.first_list_item_index
30
- end
29
+ context "list items" do
30
+ it "should know how to be chosen by text" do
31
+ platform.should_receive(:performAction).with('click_on_text', 'first item')
32
+ screen.first_list_item_text
33
+ end
31
34
 
32
- it "should know how to enter text into a text field using index" do
33
- platform.should_receive(:performAction).with('enter_text_into_numbered_field', 'blah', 3)
34
- screen.first_name_index = 'blah'
35
- end
35
+ it "should know how to be chosen by index" do
36
+ platform.should_receive(:performAction).with('press_list_item', 1, 0)
37
+ screen.first_list_item_index
38
+ end
36
39
 
37
- it "should know how to enter text into a text field using the name" do
38
- platform.should_receive(:performAction).with('enter_text_into_named_field', 'blah', 'Some name')
39
- screen.first_name_name = 'blah'
40
+ it "should know how to select the list when using index" do
41
+ platform.should_receive(:performAction).with('press_list_item', 1, 1)
42
+ screen.first_list_item_index_list
43
+ end
40
44
  end
41
45
 
42
- it "should know how to press a button by text" do
43
- platform.should_receive(:performAction).with('press_button_with_text', 'Save')
44
- screen.save_text
46
+ context "text controls" do
47
+ it "should know how to enter text using an index" do
48
+ platform.should_receive(:performAction).with('enter_text_into_numbered_field', 'blah', 3)
49
+ screen.first_name_index = 'blah'
50
+ end
51
+
52
+ it "should know how to enter text using the name" do
53
+ platform.should_receive(:performAction).with('enter_text_into_named_field', 'blah', 'Some name')
54
+ screen.first_name_name = 'blah'
55
+ end
56
+
57
+ it "should know how to enter text using the id" do
58
+ platform.should_receive(:performAction).with('enter_text_into_id_field', 'blah', 'fnid')
59
+ screen.first_name_id = 'blah'
60
+ end
61
+
62
+ it "should know how to be cleared using an index" do
63
+ platform.should_receive(:performAction).with('clear_numbered_field', 3)
64
+ screen.clear_first_name_index
65
+ end
66
+
67
+ it "should know how to be cleared by name" do
68
+ platform.should_receive(:performAction).with('clear_named_field', 'Some name')
69
+ screen.clear_first_name_name
70
+ end
71
+
72
+ it "should know now to be cleared by id" do
73
+ platform.should_receive(:performAction).with('clear_id_field', 'fnid')
74
+ screen.clear_first_name_id
75
+ end
45
76
  end
46
77
 
47
- it "should know how to press a button by index" do
48
- platform.should_receive(:performAction).with('press_button_number', 2)
49
- screen.save_index
78
+ context "buttons" do
79
+ it "should know how to be chosen by text" do
80
+ platform.should_receive(:performAction).with('press_button_with_text', 'Save')
81
+ screen.save_text
82
+ end
83
+
84
+ it "should know how to be chosen by index" do
85
+ platform.should_receive(:performAction).with('press_button_number', 2)
86
+ screen.save_index
87
+ end
88
+
89
+ it "should know how to be chosen by id" do
90
+ platform.should_receive(:performAction).with('click_on_view_by_id', 'some_button_id')
91
+ screen.save_id
92
+ end
50
93
  end
51
94
 
52
- it "should know how to check a checkbox by index" do
53
- platform.should_receive(:performAction).with('toggle_numbered_checkbox', 1)
54
- screen.checkbox_index
95
+
96
+ context "checkboxes" do
97
+ it "should know how to be checked by index" do
98
+ platform.should_receive(:performAction).with('toggle_numbered_checkbox', 1)
99
+ screen.checkbox_index
100
+ end
101
+
102
+ it "should know how to be checked by text" do
103
+ platform.should_receive(:performAction).with('click_on_text', 'Checkbox 2')
104
+ screen.checkbox_text
105
+ end
106
+
107
+ it "should know how to be checked by id" do
108
+ platform.should_receive(:performAction).with('click_on_view_by_id', 'some_check_id')
109
+ screen.checkbox_id
110
+ end
55
111
  end
56
112
 
57
- it "should know how to check a checkbox by text" do
58
- platform.should_receive(:performAction).with('click_on_text', 'Checkbox 2')
59
- screen.checkbox_text
113
+ context "radio buttons" do
114
+ it "should know how to be clicked by text" do
115
+ platform.should_receive(:performAction).with('click_on_text', 'Radio Button 1')
116
+ screen.radio_text
117
+ end
118
+
119
+ it "should know how to be clicked by id" do
120
+ platform.should_receive(:performAction).with('click_on_view_by_id', 'some_radio_id')
121
+ screen.radio_id
122
+ end
60
123
  end
61
124
 
62
- it "should know how to click a radio button by text" do
63
- platform.should_receive(:performAction).with('click_on_text', 'Radio Button 1')
64
- screen.radio_text
125
+ context "views" do
126
+ it "should know how to be clicked by id" do
127
+ platform.should_receive(:performAction).with('click_on_view_by_id', 'some_view_id')
128
+ screen.view_id
129
+ end
130
+
131
+ it "should know how to be clicked by test" do
132
+ platform.should_receive(:performAction).with('click_on_text', 'Any view text')
133
+ screen.view_text
134
+ end
65
135
  end
66
136
  end
67
137
  end
@@ -26,11 +26,21 @@ describe Gametel do
26
26
  screen.has_text? "blah"
27
27
  end
28
28
 
29
+ it "should know if a view is enabled" do
30
+ platform.should_receive(:performAction).with('is_enabled', 'some_id').and_return("success" => true)
31
+ screen.should be_enabled('some_id')
32
+ end
33
+
29
34
  it "should know how to press the back button" do
30
35
  platform.should_receive(:performAction).with('go_back')
31
36
  screen.back
32
37
  end
33
38
 
39
+ it "should know how to press the enter key" do
40
+ platform.should_receive(:performAction).with('send_key_enter')
41
+ screen.enter
42
+ end
43
+
34
44
  it "should know how to scroll down" do
35
45
  platform.should_receive(:performAction).with('scroll_down')
36
46
  screen.scroll_down
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.1'
4
+ version: '0.2'
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-07-17 00:00:00.000000000 Z
13
+ date: 2012-08-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: calabash-android
@@ -19,7 +19,7 @@ dependencies:
19
19
  requirements:
20
20
  - - ! '>='
21
21
  - !ruby/object:Gem::Version
22
- version: 0.1.0
22
+ version: 0.2.11
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.1.0
30
+ version: 0.2.11
31
31
  - !ruby/object:Gem::Dependency
32
32
  name: rspec
33
33
  requirement: !ruby/object:Gem::Requirement
@@ -82,9 +82,7 @@ files:
82
82
  - ApiDemos/assets/HelloActivity.apk
83
83
  - ApiDemos/assets/fonts/samplefont.ttf
84
84
  - ApiDemos/assets/read_asset.txt
85
- - ApiDemos/bin/ApiDemos.apk
86
85
  - ApiDemos/build.xml
87
- - ApiDemos/local.properties
88
86
  - ApiDemos/proguard-project.txt
89
87
  - ApiDemos/project.properties
90
88
  - ApiDemos/res/anim/animator.xml
@@ -955,6 +953,7 @@ files:
955
953
  - cucumber.yml
956
954
  - features/button.feature
957
955
  - features/checkbox.feature
956
+ - features/is_enabled.feature
958
957
  - features/list_item.feature
959
958
  - features/main_screen.feature
960
959
  - features/radio_button.feature
@@ -962,19 +961,27 @@ files:
962
961
  - features/step_definitions/calabash_steps.rb
963
962
  - features/step_definitions/checkbox_steps.rb
964
963
  - features/step_definitions/controls_steps.rb
964
+ - features/step_definitions/is_enabled_steps.rb
965
965
  - features/step_definitions/list_item_steps.rb
966
966
  - features/step_definitions/main_screen_steps.rb
967
967
  - features/step_definitions/radio_button_steps.rb
968
+ - features/step_definitions/view_steps.rb
968
969
  - features/support/app_installation_hooks.rb
969
970
  - features/support/app_life_cycle_hooks.rb
970
971
  - features/support/env.rb
971
972
  - features/support/hooks.rb
973
+ - features/support/screens/alert_dialogs_screen.rb
974
+ - features/support/screens/app_menu_screen.rb
975
+ - features/support/screens/auto_complete_menu_screen.rb
976
+ - features/support/screens/auto_complete_screen_top_screen.rb
972
977
  - features/support/screens/buttons_screen.rb
973
978
  - features/support/screens/controls_menu_screen.rb
974
979
  - features/support/screens/controls_screen.rb
980
+ - features/support/screens/custom_views_screen.rb
975
981
  - features/support/screens/main_menu_screen.rb
976
982
  - features/support/screens/views_menu_screen.rb
977
983
  - features/text.feature
984
+ - features/view.feature
978
985
  - gametel.gemspec
979
986
  - irb_android.sh
980
987
  - lib/gametel.rb
@@ -985,7 +992,7 @@ files:
985
992
  - spec/lib/gametel/accessors_spec.rb
986
993
  - spec/lib/gametel_spec.rb
987
994
  - spec/spec_helper.rb
988
- homepage: ''
995
+ homepage: http://github.com/leandog/gametel
989
996
  licenses: []
990
997
  post_install_message:
991
998
  rdoc_options: []
@@ -997,18 +1004,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
997
1004
  - - ! '>='
998
1005
  - !ruby/object:Gem::Version
999
1006
  version: '0'
1000
- segments:
1001
- - 0
1002
- hash: 3967481805464418560
1003
1007
  required_rubygems_version: !ruby/object:Gem::Requirement
1004
1008
  none: false
1005
1009
  requirements:
1006
1010
  - - ! '>='
1007
1011
  - !ruby/object:Gem::Version
1008
1012
  version: '0'
1009
- segments:
1010
- - 0
1011
- hash: 3967481805464418560
1012
1013
  requirements: []
1013
1014
  rubyforge_project:
1014
1015
  rubygems_version: 1.8.24
@@ -1018,6 +1019,7 @@ summary: High level wrapper around android drivers
1018
1019
  test_files:
1019
1020
  - features/button.feature
1020
1021
  - features/checkbox.feature
1022
+ - features/is_enabled.feature
1021
1023
  - features/list_item.feature
1022
1024
  - features/main_screen.feature
1023
1025
  - features/radio_button.feature
@@ -1025,19 +1027,27 @@ test_files:
1025
1027
  - features/step_definitions/calabash_steps.rb
1026
1028
  - features/step_definitions/checkbox_steps.rb
1027
1029
  - features/step_definitions/controls_steps.rb
1030
+ - features/step_definitions/is_enabled_steps.rb
1028
1031
  - features/step_definitions/list_item_steps.rb
1029
1032
  - features/step_definitions/main_screen_steps.rb
1030
1033
  - features/step_definitions/radio_button_steps.rb
1034
+ - features/step_definitions/view_steps.rb
1031
1035
  - features/support/app_installation_hooks.rb
1032
1036
  - features/support/app_life_cycle_hooks.rb
1033
1037
  - features/support/env.rb
1034
1038
  - features/support/hooks.rb
1039
+ - features/support/screens/alert_dialogs_screen.rb
1040
+ - features/support/screens/app_menu_screen.rb
1041
+ - features/support/screens/auto_complete_menu_screen.rb
1042
+ - features/support/screens/auto_complete_screen_top_screen.rb
1035
1043
  - features/support/screens/buttons_screen.rb
1036
1044
  - features/support/screens/controls_menu_screen.rb
1037
1045
  - features/support/screens/controls_screen.rb
1046
+ - features/support/screens/custom_views_screen.rb
1038
1047
  - features/support/screens/main_menu_screen.rb
1039
1048
  - features/support/screens/views_menu_screen.rb
1040
1049
  - features/text.feature
1050
+ - features/view.feature
1041
1051
  - spec/lib/gametel/accessors_spec.rb
1042
1052
  - spec/lib/gametel_spec.rb
1043
1053
  - spec/spec_helper.rb
Binary file
@@ -1,10 +0,0 @@
1
- # This file is automatically generated by Android Tools.
2
- # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3
- #
4
- # This file must *NOT* be checked into Version Control Systems,
5
- # as it contains information specific to your local configuration.
6
-
7
- # location of the SDK. This is only used by Ant
8
- # For customization when using a Version Control System, please read the
9
- # header note.
10
- sdk.dir=/opt/android