calabash-android 0.2.15 → 0.2.16

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 (19) hide show
  1. data/CHANGES.txt +8 -0
  2. data/bin/calabash-android +6 -0
  3. data/bin/calabash-android-helpers.rb +2 -0
  4. data/bin/calabash-android-run.rb +2 -1
  5. data/lib/calabash-android/version.rb +1 -1
  6. data/test-server/build.xml +4 -1
  7. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/Actions.java +10 -11
  8. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map_unsupported/GetMapBounds.java +8 -0
  9. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map_unsupported/GetMapCenter.java +8 -0
  10. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map_unsupported/GetMapMarker.java +8 -0
  11. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map_unsupported/GetMapMarkers.java +8 -0
  12. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map_unsupported/GetMapZoom.java +9 -0
  13. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map_unsupported/PanMapTo.java +9 -0
  14. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map_unsupported/SetMapCenter.java +9 -0
  15. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map_unsupported/SetMapZoom.java +8 -0
  16. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map_unsupported/TapAwayFromMarkers.java +8 -0
  17. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map_unsupported/TapMapMarker.java +8 -0
  18. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map_unsupported/UnsupportedMapAction.java +21 -0
  19. metadata +13 -2
data/CHANGES.txt CHANGED
@@ -1,3 +1,11 @@
1
+ 0.2.16:
2
+ Added --google-maps-support option.
3
+ By default no actions from sh.calaba.instrumentationbackend.actions.map
4
+ will be available. By adding the --google-maps-support all actions will
5
+ be baked into the test server.
6
+
7
+ Removed colors from cucumber output on Windows
8
+
1
9
  0.2.15:
2
10
  Fixed bug related to Google maps api add-on being located at different location
3
11
  in different api versions.
data/bin/calabash-android CHANGED
@@ -23,6 +23,10 @@ def relative_to_full_path(file_path)
23
23
  File.expand_path(file_path)
24
24
  end
25
25
 
26
+ def raise_if_android_home_not_set
27
+ raise "Please set the ANDROID_HOME environment variable" unless ENV["ANDROID_HOME"]
28
+ end
29
+
26
30
  if (ARGV.length == 0)
27
31
  print_usage
28
32
  exit 0
@@ -32,12 +36,14 @@ if cmd == 'help'
32
36
  print_help
33
37
  exit 0
34
38
  elsif cmd == 'build'
39
+ raise_if_android_home_not_set
35
40
  puts "Please specify the app you want to build a test server for" if (ARGV.empty? or not is_apk_file?(ARGV.first))
36
41
  while not ARGV.empty? and is_apk_file?(ARGV.first)
37
42
  calabash_build(relative_to_full_path(ARGV.shift))
38
43
  end
39
44
  exit 0
40
45
  elsif cmd == 'run'
46
+ raise_if_android_home_not_set
41
47
  if ARGV.empty? or not is_apk_file?(ARGV.first)
42
48
  calabash_run()
43
49
  else
@@ -29,6 +29,8 @@ def print_usage
29
29
  <options> can be
30
30
  -v, --verbose
31
31
  Turns on verbose logging
32
+ --google-maps-support
33
+ Adds supports for Google Maps to the test server
32
34
  EOF
33
35
  end
34
36
 
@@ -29,7 +29,8 @@ def calabash_run(app_path = nil)
29
29
  end
30
30
 
31
31
  STDOUT.sync = true
32
- cmd = "cucumber -c #{ARGV.join(" ")} #{env}"
32
+ arguments = ARGV - ["--google-maps-support"]
33
+ cmd = "cucumber #{arguments.join(" ")} #{env} #{"-c" unless is_windows?}"
33
34
  puts cmd
34
35
  IO.popen(cmd) do |io|
35
36
  io.each { |s| print s }
@@ -1,5 +1,5 @@
1
1
  module Calabash
2
2
  module Android
3
- VERSION = "0.2.15"
3
+ VERSION = "0.2.16"
4
4
  end
5
5
  end
@@ -88,7 +88,10 @@
88
88
 
89
89
  <target name="-prepare.testserver" description="Makes sure the testserver matches the tested application by looking at its manifest file">
90
90
  <copy todir="${staging.dir}">
91
- <fileset dir="instrumentation-backend"/>
91
+ <fileset dir="instrumentation-backend">
92
+ <exclude name="src/sh/calaba/instrumentationbackend/actions/map_unsupported/*.java" if="${google_maps_support}"/>
93
+ <exclude name="src/sh/calaba/instrumentationbackend/actions/map/*.java" unless="${google_maps_support}"/>
94
+ </fileset>
92
95
  </copy>
93
96
  <copy todir="${staging.dir}/libs">
94
97
  <fileset erroronmissingdir="false" dir="${env.ANDROID_HOME}/add-ons/addon-google_apis-google_inc_-${android.api.level}/libs"/>
@@ -43,8 +43,7 @@ public class Actions {
43
43
  }
44
44
  }
45
45
  } catch (Exception e) {
46
- // TODO Auto-generated catch block
47
- e.printStackTrace();
46
+ throw new RuntimeException(e);
48
47
  }
49
48
  }
50
49
 
@@ -57,13 +56,9 @@ public class Actions {
57
56
  }
58
57
 
59
58
  @SuppressWarnings("rawtypes")
60
- private boolean isAction(Class action) {
61
- for (Class i : action.getInterfaces()) {
62
- if (i.equals(Action.class)) {
63
- return true;
64
- }
65
- }
66
- return false;
59
+ private boolean isAction(Class actionCandidate) {
60
+ boolean isImplementation = !actionCandidate.isInterface();
61
+ return isImplementation && Action.class.isAssignableFrom(actionCandidate);
67
62
  }
68
63
 
69
64
  private void put(Action action) {
@@ -71,8 +66,12 @@ public class Actions {
71
66
  Action duplicate = getActions().get(action.key());
72
67
  throw new RuntimeException("Found duplicate action key:'" + action.key() + "'. [" + duplicate.getClass().getName() + "," + action.getClass().getName() + "]");
73
68
  }
74
- InstrumentationBackend.log("Added:'" + action.getClass().getSimpleName() + "', with key:'" + action.key() + "'");
75
- getActions().put(action.key(), action);
69
+ if (action.key() == null) {
70
+ System.out.println("Skipping " + action.getClass() + ". Key is null.");
71
+ } else {
72
+ InstrumentationBackend.log("Added:'" + action.getClass().getSimpleName() + "', with key:'" + action.key() + "'");
73
+ getActions().put(action.key(), action);
74
+ }
76
75
  }
77
76
 
78
77
  public Action lookup(String key) {
@@ -0,0 +1,8 @@
1
+ package sh.calaba.instrumentationbackend.actions.map_unsupported;
2
+
3
+ public class GetMapBounds extends UnsupportedMapAction {
4
+ @Override
5
+ public String key() {
6
+ return "get_map_bounds";
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ package sh.calaba.instrumentationbackend.actions.map_unsupported;
2
+
3
+ public class GetMapCenter extends UnsupportedMapAction {
4
+ @Override
5
+ public String key() {
6
+ return "get_map_center";
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ package sh.calaba.instrumentationbackend.actions.map_unsupported;
2
+
3
+ public class GetMapMarker extends UnsupportedMapAction {
4
+ @Override
5
+ public String key() {
6
+ return "get_map_marker";
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ package sh.calaba.instrumentationbackend.actions.map_unsupported;
2
+
3
+ public class GetMapMarkers extends UnsupportedMapAction {
4
+ @Override
5
+ public String key() {
6
+ return "get_map_markers";
7
+ }
8
+ }
@@ -0,0 +1,9 @@
1
+ package sh.calaba.instrumentationbackend.actions.map_unsupported;
2
+
3
+ public class GetMapZoom extends UnsupportedMapAction {
4
+
5
+ @Override
6
+ public String key() {
7
+ return "get_map_zoom";
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ package sh.calaba.instrumentationbackend.actions.map_unsupported;
2
+
3
+ public class PanMapTo extends UnsupportedMapAction {
4
+
5
+ @Override
6
+ public String key() {
7
+ return "pan_map_to";
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ package sh.calaba.instrumentationbackend.actions.map_unsupported;
2
+
3
+ public class SetMapCenter extends UnsupportedMapAction {
4
+
5
+ @Override
6
+ public String key() {
7
+ return "set_map_center";
8
+ }
9
+ }
@@ -0,0 +1,8 @@
1
+ package sh.calaba.instrumentationbackend.actions.map_unsupported;
2
+
3
+ public class SetMapZoom extends UnsupportedMapAction {
4
+ @Override
5
+ public String key() {
6
+ return "set_map_zoom";
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ package sh.calaba.instrumentationbackend.actions.map_unsupported;
2
+
3
+ public class TapAwayFromMarkers extends UnsupportedMapAction {
4
+ @Override
5
+ public String key() {
6
+ return "tap_map_away_from_markers";
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ package sh.calaba.instrumentationbackend.actions.map_unsupported;
2
+
3
+ public class TapMapMarker extends UnsupportedMapAction {
4
+ @Override
5
+ public String key() {
6
+ return "tap_map_marker_by_title";
7
+ }
8
+ }
@@ -0,0 +1,21 @@
1
+ package sh.calaba.instrumentationbackend.actions.map_unsupported;
2
+
3
+ import sh.calaba.instrumentationbackend.Result;
4
+ import sh.calaba.instrumentationbackend.actions.Action;
5
+
6
+ public class UnsupportedMapAction implements Action {
7
+
8
+ @Override
9
+ public Result execute(String... args) {
10
+ throw new RuntimeException(
11
+ "Google Maps is not supported by default.\n" +
12
+ "You can add support by following running calabash-android with --google-maps-support\n" +
13
+ "See more at: https://github.com/calabash/calabash-android/wiki/Google-Maps-Support"
14
+ );
15
+ }
16
+
17
+ @Override
18
+ public String key() {
19
+ return null;
20
+ }
21
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-android
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.15
4
+ version: 0.2.16
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-04 00:00:00.000000000 Z
12
+ date: 2012-09-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber
@@ -190,6 +190,17 @@ files:
190
190
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map/SetMapZoom.java
191
191
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map/TapAwayFromMarkers.java
192
192
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map/TapMapMarker.java
193
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map_unsupported/GetMapBounds.java
194
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map_unsupported/GetMapCenter.java
195
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map_unsupported/GetMapMarker.java
196
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map_unsupported/GetMapMarkers.java
197
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map_unsupported/GetMapZoom.java
198
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map_unsupported/PanMapTo.java
199
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map_unsupported/SetMapCenter.java
200
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map_unsupported/SetMapZoom.java
201
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map_unsupported/TapAwayFromMarkers.java
202
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map_unsupported/TapMapMarker.java
203
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map_unsupported/UnsupportedMapAction.java
193
204
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/scrolling/ScrollDown.java
194
205
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/scrolling/ScrollUp.java
195
206
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/softkey/DownKey.java