calabash-android 0.4.15.pre1 → 0.4.15.pre2
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.
- checksums.yaml +4 -4
- data/lib/calabash-android/lib/TestServer.apk +0 -0
- data/lib/calabash-android/version.rb +1 -1
- data/test-server/instrumentation-backend/src/com/jayway/android/robotium/solo/PublicViewFetcher.java +2 -2
- data/test-server/instrumentation-backend/src/com/jayway/android/robotium/solo/SoloEnhanced.java +75 -96
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/InstrumentationBackend.java +70 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e755b2bf29c1fc5dfb3dcf8a268cc4a742af6153
|
4
|
+
data.tar.gz: 0d9cb17214c52a01e58166d8fce6e6ab6fc01087
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc5a1b74c3e3cbca6e1ba51ec043392d4e2bf4fdf1ad66aaa39c7d8d74ada62c5859ab17d96f64c548d4c5e7c96acb50102d7dbe91ff3fc035f310db2807c29f
|
7
|
+
data.tar.gz: 95c1a94f439c58ace65d2a9343736cec61f1ecd17f70f8dde301a31a86ad0d610e41b8da6a285b01a6a126eadc870884174b611914442ac48eedd5756cce21fb
|
Binary file
|
data/test-server/instrumentation-backend/src/com/jayway/android/robotium/solo/PublicViewFetcher.java
CHANGED
@@ -5,7 +5,7 @@ import android.app.Instrumentation;
|
|
5
5
|
|
6
6
|
public class PublicViewFetcher extends ViewFetcher {
|
7
7
|
|
8
|
-
public PublicViewFetcher(
|
9
|
-
super(
|
8
|
+
public PublicViewFetcher(ActivityUtils activityUtils) {
|
9
|
+
super(activityUtils);
|
10
10
|
}
|
11
11
|
}
|
data/test-server/instrumentation-backend/src/com/jayway/android/robotium/solo/SoloEnhanced.java
CHANGED
@@ -1,96 +1,75 @@
|
|
1
|
-
package com.jayway.android.robotium.solo;
|
2
|
-
|
3
|
-
import java.util.List;
|
4
|
-
|
5
|
-
import android.app.
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
private MapViewUtils mapViewUtils;
|
10
|
-
|
11
|
-
public SoloEnhanced(Instrumentation instrumentation) {
|
12
|
-
super(instrumentation);
|
13
|
-
this.mapViewUtils = new MapViewUtils(instrumentation, viewFetcher, sleeper, waiter);
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
* @
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
// * @param togetherOrApart - {@link Pincher#TOGETHER} or {@link Pincher#APART}
|
77
|
-
// */
|
78
|
-
// public void pinch(int togetherOrApart) {
|
79
|
-
// switch( togetherOrApart ) {
|
80
|
-
// case Pincher.TOGETHER: pincher.pinch(Pincher.Direction.TOGETHER); break;
|
81
|
-
// case Pincher.APART: pincher.pinch(Pincher.Direction.APART); break;
|
82
|
-
// }
|
83
|
-
// }
|
84
|
-
//
|
85
|
-
// /**
|
86
|
-
// * Sorry, doesn't work yet
|
87
|
-
// * @param togetherOrApart - {@link Pincher#TOGETHER} or {@link Pincher#APART}
|
88
|
-
// * @param view
|
89
|
-
// */
|
90
|
-
// public void pinch(int togetherOrApart, View view) {
|
91
|
-
// switch( togetherOrApart ) {
|
92
|
-
// case Pincher.TOGETHER: pincher.pinch(Pincher.Direction.TOGETHER, view); break;
|
93
|
-
// case Pincher.APART: pincher.pinch(Pincher.Direction.APART, view); break;
|
94
|
-
// }
|
95
|
-
// }
|
96
|
-
}
|
1
|
+
package com.jayway.android.robotium.solo;
|
2
|
+
|
3
|
+
import java.util.List;
|
4
|
+
|
5
|
+
import android.app.Activity;
|
6
|
+
import android.app.Instrumentation;
|
7
|
+
|
8
|
+
public class SoloEnhanced extends Solo {
|
9
|
+
private MapViewUtils mapViewUtils;
|
10
|
+
|
11
|
+
public SoloEnhanced(Instrumentation instrumentation, Activity activity) {
|
12
|
+
super(instrumentation, activity);
|
13
|
+
this.mapViewUtils = new MapViewUtils(instrumentation, viewFetcher, sleeper, waiter);
|
14
|
+
}
|
15
|
+
public ActivityUtils getActivityUtils() {
|
16
|
+
return activityUtils;
|
17
|
+
}
|
18
|
+
|
19
|
+
public void setMapCenter( double lat, double lon ) {
|
20
|
+
mapViewUtils.setCenter(lat, lon);
|
21
|
+
}
|
22
|
+
|
23
|
+
/** @return {lat,lon} */
|
24
|
+
public double[] getMapCenter() {
|
25
|
+
return mapViewUtils.getMapCenter();
|
26
|
+
}
|
27
|
+
|
28
|
+
public void panMapTo( double lat, double lon ) {
|
29
|
+
mapViewUtils.panTo(lat, lon);
|
30
|
+
}
|
31
|
+
|
32
|
+
public boolean zoomInOnMap() {
|
33
|
+
return mapViewUtils.zoomIn();
|
34
|
+
}
|
35
|
+
|
36
|
+
public boolean zoomOutOnMap() {
|
37
|
+
return mapViewUtils.zoomOut();
|
38
|
+
}
|
39
|
+
|
40
|
+
public int setMapZoom( int zoomLevel ) {
|
41
|
+
return mapViewUtils.setZoom(zoomLevel);
|
42
|
+
}
|
43
|
+
|
44
|
+
public int getMapZoom() {
|
45
|
+
return mapViewUtils.getZoom();
|
46
|
+
}
|
47
|
+
|
48
|
+
public List<String> getMapMarkerItems() {
|
49
|
+
return mapViewUtils.getMarkerItems();
|
50
|
+
}
|
51
|
+
|
52
|
+
public String getMapMarkerItem( String title ) {
|
53
|
+
return mapViewUtils.getMarkerItem( title );
|
54
|
+
}
|
55
|
+
|
56
|
+
/**
|
57
|
+
* @param title
|
58
|
+
* @param timeout in ms
|
59
|
+
* @return
|
60
|
+
*/
|
61
|
+
public boolean tapMapMarkerItem( String title, long timeout ) {
|
62
|
+
return mapViewUtils.tapMarkerItem( title, timeout );
|
63
|
+
}
|
64
|
+
|
65
|
+
public boolean tapMapAwayFromMarkers( int step ) {
|
66
|
+
return mapViewUtils.tapAwayFromMarkerItems( step );
|
67
|
+
}
|
68
|
+
|
69
|
+
/**
|
70
|
+
* @return [top, right, bottom, left] in decimal degrees
|
71
|
+
*/
|
72
|
+
public List<String> getMapBounds() {
|
73
|
+
return mapViewUtils.getBounds();
|
74
|
+
}
|
75
|
+
}
|
@@ -1,5 +1,7 @@
|
|
1
1
|
package sh.calaba.instrumentationbackend;
|
2
2
|
|
3
|
+
import android.os.Looper;
|
4
|
+
import android.os.MessageQueue;
|
3
5
|
import sh.calaba.instrumentationbackend.actions.Actions;
|
4
6
|
import sh.calaba.instrumentationbackend.actions.HttpServer;
|
5
7
|
import android.Manifest;
|
@@ -16,6 +18,10 @@ import android.util.Log;
|
|
16
18
|
import com.jayway.android.robotium.solo.PublicViewFetcher;
|
17
19
|
import com.jayway.android.robotium.solo.SoloEnhanced;
|
18
20
|
|
21
|
+
import java.lang.reflect.Field;
|
22
|
+
import java.util.List;
|
23
|
+
import java.util.concurrent.atomic.AtomicReference;
|
24
|
+
|
19
25
|
public class InstrumentationBackend extends ActivityInstrumentationTestCase2<Activity> {
|
20
26
|
public static String testPackage;
|
21
27
|
public static Class<? extends Activity> mainActivity;
|
@@ -40,8 +46,7 @@ public class InstrumentationBackend extends ActivityInstrumentationTestCase2<Act
|
|
40
46
|
i.setClassName(testPackage, mainActivity.getName());
|
41
47
|
i.putExtras(extras);
|
42
48
|
setActivityIntent(i);
|
43
|
-
|
44
|
-
viewFetcher = new PublicViewFetcher(getInstrumentation(), this.getActivity());
|
49
|
+
|
45
50
|
actions = new Actions(getInstrumentation(), this);
|
46
51
|
instrumentation = getInstrumentation();
|
47
52
|
}
|
@@ -49,12 +54,70 @@ public class InstrumentationBackend extends ActivityInstrumentationTestCase2<Act
|
|
49
54
|
/**
|
50
55
|
* Here to have JUnit3 start the instrumentationBackend
|
51
56
|
*/
|
57
|
+
|
52
58
|
public void testHook() throws Exception {
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
59
|
+
|
60
|
+
final AtomicReference<Activity> activityReference = new AtomicReference<Activity>();
|
61
|
+
Thread activityStarter = new Thread() {
|
62
|
+
public void run() {
|
63
|
+
activityReference.set(getActivity());
|
64
|
+
}
|
65
|
+
};
|
66
|
+
activityStarter.start();
|
67
|
+
activityStarter.join(10000);
|
68
|
+
|
69
|
+
Activity activity = null;
|
70
|
+
if (activityReference.get() != null) {
|
71
|
+
activity = activityReference.get();
|
72
|
+
System.out.println("testHook: Activity set to: " + activity);
|
73
|
+
} else {
|
74
|
+
System.out.println("testHook: Activity not set");
|
75
|
+
try {
|
76
|
+
|
77
|
+
Field mQueue = Looper.getMainLooper().getClass().getDeclaredField("mQueue");
|
78
|
+
mQueue.setAccessible(true);
|
79
|
+
MessageQueue messageQueue = (MessageQueue)mQueue.get(Looper.getMainLooper());
|
80
|
+
|
81
|
+
Field f = messageQueue.getClass().getDeclaredField("mIdleHandlers");
|
82
|
+
f.setAccessible(true);
|
83
|
+
List<?> waiters = (List<?>)f.get(messageQueue);
|
84
|
+
for(Object o : waiters) {
|
85
|
+
Class<?> activityGoingClazz = o.getClass();
|
86
|
+
if (!activityGoingClazz.getName().equals("android.app.Instrumentation$ActivityGoing")) {
|
87
|
+
continue;
|
88
|
+
}
|
89
|
+
|
90
|
+
|
91
|
+
Field mWaiterField = activityGoingClazz.getDeclaredField("mWaiter");
|
92
|
+
mWaiterField.setAccessible(true);
|
93
|
+
Object waiter = mWaiterField.get(o);
|
94
|
+
Class<?> activityWaiterClazz = waiter.getClass();
|
95
|
+
|
96
|
+
Field activityField = activityWaiterClazz.getDeclaredField("activity");
|
97
|
+
activityField.setAccessible(true);
|
98
|
+
activity = (Activity)activityField.get(waiter);
|
99
|
+
|
100
|
+
instrumentation.addMonitor(new Instrumentation.ActivityMonitor(activity.getClass().getName(), null, false));
|
101
|
+
|
102
|
+
}
|
103
|
+
} catch (Exception e) {
|
104
|
+
e.printStackTrace();
|
105
|
+
}
|
106
|
+
}
|
107
|
+
if (activity != null) {
|
108
|
+
solo = new SoloEnhanced(getInstrumentation(), activity);
|
109
|
+
setActivity(activity);
|
110
|
+
|
111
|
+
viewFetcher = new PublicViewFetcher(solo.getActivityUtils());
|
112
|
+
|
113
|
+
HttpServer httpServer = HttpServer.getInstance();
|
114
|
+
httpServer.setReady();
|
115
|
+
httpServer.waitUntilShutdown();
|
116
|
+
solo.finishOpenedActivities();
|
117
|
+
System.exit(0);
|
118
|
+
} else {
|
119
|
+
throw new RuntimeException("Could not get detect the first Activity");
|
120
|
+
}
|
58
121
|
}
|
59
122
|
|
60
123
|
@Override
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: calabash-android
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.15.
|
4
|
+
version: 0.4.15.pre2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Maturana Larsen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|