calabash-android 0.5.16.pre1 → 0.6.0.prelatestcrosswalk
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/calabash-android-build.rb +2 -1
- data/irbrc +17 -0
- data/lib/calabash-android.rb +6 -1
- data/lib/calabash-android/dot_dir.rb +17 -0
- data/lib/calabash-android/environment.rb +120 -0
- data/{test-server → lib/calabash-android/lib}/AndroidManifest.xml +0 -0
- data/lib/calabash-android/lib/TestServer.apk +0 -0
- data/lib/calabash-android/logging.rb +120 -0
- data/lib/calabash-android/operations.rb +14 -2
- data/lib/calabash-android/store/preferences.rb +211 -0
- data/lib/calabash-android/text_helpers.rb +41 -14
- data/lib/calabash-android/usage_tracker.rb +192 -0
- data/lib/calabash-android/version.rb +1 -1
- data/lib/calabash-android/wait_helpers.rb +1 -1
- metadata +122 -15
- data/.calabash_settings +0 -1
- data/.yardopts +0 -3
- data/CHANGES.txt +0 -354
- data/ENVIRONMENT_VARIABLES.md +0 -106
- data/Gemfile +0 -4
- data/README_YARDOC.md +0 -163
- data/Rakefile +0 -49
- data/calabash-android.gemspec +0 -30
- data/lib/calabash-android/canned_steps.md +0 -229
- data/test-server/build.xml +0 -152
- data/test-server/calabash-js/src/calabash.js +0 -172
data/test-server/build.xml
DELETED
@@ -1,152 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<project name="" default="package" basedir=".">
|
3
|
-
<description>
|
4
|
-
Bits and pieces plucked out of $ANDROID_HOME/tools/ant/build.xml
|
5
|
-
</description>
|
6
|
-
|
7
|
-
<property name="adb.device.arg" value="" />
|
8
|
-
<property environment="env"/>
|
9
|
-
<property name="staging.dir" location="staging"/>
|
10
|
-
<property name="bin.dir" location="bin"/>
|
11
|
-
<property name="test.app.aapt" location="${bin.dir}/Test_aapt.apk"/>
|
12
|
-
<property name="dex.file" location="${bin.dir}/classes.dex"/>
|
13
|
-
<property name="test.app.unsigned" location="${bin.dir}/Test_unsigned.apk"/>
|
14
|
-
<property name="calabashjs.dir" location="calabash-js/src"/>
|
15
|
-
|
16
|
-
<!-- Windows support -->
|
17
|
-
<condition property="bat" value=".bat" else=""><os family="windows" /></condition>
|
18
|
-
|
19
|
-
<property name="dx" location="${tools.dir}/dx${bat}" />
|
20
|
-
<property name="aapt" location="${tools.dir}/aapt" />
|
21
|
-
|
22
|
-
<property name="android.lib" location="${env.ANDROID_HOME}/platforms/android-${android.api.level}/android.jar"/>
|
23
|
-
<path id="android.antlibs">
|
24
|
-
<pathelement path="${env.ANDROID_HOME}/tools/lib/ant-tasks.jar" />
|
25
|
-
<pathelement path="${env.ANDROID_HOME}/tools/lib/anttasks.jar" />
|
26
|
-
<pathelement path="${env.ANDROID_HOME}/tools/lib/sdklib.jar" />
|
27
|
-
<pathelement path="${env.ANDROID_HOME}/tools/lib/androidprefs.jar" />
|
28
|
-
</path>
|
29
|
-
|
30
|
-
<path id="jar.libs.ref">
|
31
|
-
<fileset dir="${staging.dir}/libs/" includes="*.jar" />
|
32
|
-
</path>
|
33
|
-
|
34
|
-
<path id="cucumber.path">
|
35
|
-
<fileset dir="cucumber/" includes="*.jar" />
|
36
|
-
</path>
|
37
|
-
|
38
|
-
<path id="android.target.classpath">
|
39
|
-
<fileset dir="${env.ANDROID_HOME}/platforms/android-${android.api.level}/" includes="*.jar"/>
|
40
|
-
</path>
|
41
|
-
|
42
|
-
<target name="-check.preconditions">
|
43
|
-
<available file="${calabashjs.dir}" type="dir" property="doesCalabashJsExist" />
|
44
|
-
<fail unless="doesCalabashJsExist">
|
45
|
-
${calabashjs.dir} does not exist.
|
46
|
-
</fail>
|
47
|
-
<antversion property="version.running" />
|
48
|
-
<fail message="FATAL ERROR: The running Ant version, ${version.running}, is too old.">
|
49
|
-
<condition>
|
50
|
-
<not>
|
51
|
-
<antversion atleast="1.8" />
|
52
|
-
</not>
|
53
|
-
</condition>
|
54
|
-
</fail>
|
55
|
-
</target>
|
56
|
-
|
57
|
-
<target name="-stage">
|
58
|
-
<mkdir dir="${staging.dir}"/>
|
59
|
-
<mkdir dir="${bin.dir}"/>
|
60
|
-
<antcall target="-prepare.testserver"/>
|
61
|
-
</target>
|
62
|
-
|
63
|
-
<target name="-prepare.testserver" description="Makes sure the testserver matches the tested application by looking at its manifest file">
|
64
|
-
<copy todir="${staging.dir}">
|
65
|
-
<fileset dir="instrumentation-backend" />
|
66
|
-
</copy>
|
67
|
-
<copy todir="${staging.dir}/libs">
|
68
|
-
<fileset erroronmissingdir="false" dir="${env.ANDROID_HOME}/add-ons/addon-google_apis-google_inc_-${android.api.level}/libs"/>
|
69
|
-
<fileset erroronmissingdir="false" dir="${env.ANDROID_HOME}/add-ons/addon-google_apis-google-${android.api.level}/libs"/>
|
70
|
-
</copy>
|
71
|
-
<copy todir="${staging.dir}/assets">
|
72
|
-
<fileset dir="${calabashjs.dir}"/>
|
73
|
-
</copy>
|
74
|
-
<replace file="${staging.dir}/src/sh/calaba/instrumentationbackend/actions/version/Version.java" token="####VERSION####" value="${version}" failOnNoReplacements="true" />
|
75
|
-
|
76
|
-
<property name="src.dir.absolute" location="${staging.dir}/src" />
|
77
|
-
<pathconvert property="testserver.actions" pathsep="${line.separator}" dirsep=".">
|
78
|
-
<fileset dir="${src.dir.absolute}" includes="sh/calaba/instrumentationbackend/actions/**/*.java" />
|
79
|
-
<globmapper from="${src.dir.absolute}/*.java" to="*" handledirsep="true" />
|
80
|
-
</pathconvert>
|
81
|
-
<echo file="${staging.dir}/assets/actions" message="${testserver.actions}${line.separator}" />
|
82
|
-
</target>
|
83
|
-
|
84
|
-
|
85
|
-
<target name="-compile">
|
86
|
-
<antcall target="-stage" />
|
87
|
-
<javac
|
88
|
-
srcdir="${staging.dir}/src"
|
89
|
-
destdir="${bin.dir}"
|
90
|
-
verbose="${verbose}"
|
91
|
-
source="1.6"
|
92
|
-
target="1.6"
|
93
|
-
debug="true"
|
94
|
-
includeantruntime="false"
|
95
|
-
bootclasspathref="android.target.classpath"
|
96
|
-
classpath="${extensible.classpath}"
|
97
|
-
classpathref="jar.libs.ref" />
|
98
|
-
</target>
|
99
|
-
|
100
|
-
|
101
|
-
<target name="package" depends="-check.preconditions">
|
102
|
-
<antcall target="-compile" />
|
103
|
-
<antcall target="-aapt" />
|
104
|
-
<antcall target="-dex" />
|
105
|
-
<antcall target="-apk" />
|
106
|
-
</target>
|
107
|
-
|
108
|
-
|
109
|
-
<target name="clean" description="clean up">
|
110
|
-
<delete dir="${staging.dir}"/>
|
111
|
-
<delete dir="${bin.dir}"/>
|
112
|
-
</target>
|
113
|
-
|
114
|
-
<target name="-aapt">
|
115
|
-
<exec executable="${aapt}" failonerror="yes">
|
116
|
-
<arg value="package" />
|
117
|
-
<arg value="-f" />
|
118
|
-
<arg value="-F" />
|
119
|
-
<arg file="${test.app.aapt}" />
|
120
|
-
<arg value="-I" />
|
121
|
-
<arg path="${android.lib}" />
|
122
|
-
<arg value="-A" />
|
123
|
-
<arg path="${staging.dir}/assets" />
|
124
|
-
<arg value="-m" />
|
125
|
-
<arg value="-J" />
|
126
|
-
<arg path="gen" />
|
127
|
-
</exec>
|
128
|
-
</target>
|
129
|
-
|
130
|
-
<target name="-dex">
|
131
|
-
<copy todir="${bin.dir}/libs">
|
132
|
-
<fileset dir="instrumentation-backend/libs"/>
|
133
|
-
</copy>
|
134
|
-
<exec executable="${dx}" failonerror="yes">
|
135
|
-
<arg value="--dex" />
|
136
|
-
<arg value="--output" />
|
137
|
-
<arg file="${dex.file}" />
|
138
|
-
<arg path="${bin.dir}" />
|
139
|
-
</exec>
|
140
|
-
</target>
|
141
|
-
|
142
|
-
<target name="-apk">
|
143
|
-
<exec executable="java" failonerror="yes">
|
144
|
-
<arg value="-jar" />
|
145
|
-
<arg value="${staging.dir}/CalabashApkBuilder.jar" />
|
146
|
-
<arg file="${test.app.unsigned}" />
|
147
|
-
<arg file="${test.app.aapt}" />
|
148
|
-
<arg file="${dex.file}" />
|
149
|
-
</exec>
|
150
|
-
</target>
|
151
|
-
|
152
|
-
</project>
|
@@ -1,172 +0,0 @@
|
|
1
|
-
(function () {
|
2
|
-
/** David Mark's isHostMethod function,
|
3
|
-
* http://peter.michaux.ca/articles/feature-detection-state-of-the-art-browser-scripting
|
4
|
-
* Modified to use strict equality
|
5
|
-
*/
|
6
|
-
function isHostMethod (object, property)
|
7
|
-
{
|
8
|
-
var t = typeof object[property];
|
9
|
-
return t==='function' ||
|
10
|
-
(!!(t==='object' && object[property])) ||
|
11
|
-
t==='unknown';
|
12
|
-
}
|
13
|
-
/*http://www.w3.org/TR/DOM-Level-2-Core/core.html*/
|
14
|
-
var NODE_TYPES = {
|
15
|
-
/*ELEMENT_NODE : */ 1 : 'ELEMENT_NODE',
|
16
|
-
/*ATTRIBUTE_NODE : */ 2: 'ATTRIBUTE_NODE',
|
17
|
-
/*TEXT_NODE : */ 3 : 'TEXT_NODE',
|
18
|
-
/*DOCUMENT_NODE : */ 9 : 'DOCUMENT_NODE'
|
19
|
-
};
|
20
|
-
|
21
|
-
function computeRectForNode(object)
|
22
|
-
{
|
23
|
-
var res = {}, boundingBox;
|
24
|
-
if (isHostMethod(object,'getBoundingClientRect'))
|
25
|
-
{
|
26
|
-
boundingBox = object.getBoundingClientRect();
|
27
|
-
var rect = {};
|
28
|
-
rect.width = boundingBox.width;
|
29
|
-
rect.height = boundingBox.height;
|
30
|
-
rect.left = boundingBox.left;
|
31
|
-
rect.top = boundingBox.top;
|
32
|
-
res.rect = rect;
|
33
|
-
res.rect.center_x = rect.left + Math.floor(rect.width/2);
|
34
|
-
res.rect.center_y = rect.top + Math.floor(rect.height/2);
|
35
|
-
}
|
36
|
-
res.nodeType = NODE_TYPES[object.nodeType] || res.nodeType + ' (Unexpected)';
|
37
|
-
res.nodeName = object.nodeName;
|
38
|
-
res.id = object.id || '';
|
39
|
-
res['class'] = object.className || '';
|
40
|
-
if (object.href)
|
41
|
-
{
|
42
|
-
res.href = object.href;
|
43
|
-
}
|
44
|
-
if (object.hasOwnProperty('value'))
|
45
|
-
{
|
46
|
-
res.value = object.value || '';
|
47
|
-
}
|
48
|
-
res.html = object.outerHTML || '';
|
49
|
-
res.textContent = object.textContent;
|
50
|
-
return res;
|
51
|
-
}
|
52
|
-
function toJSON(object)
|
53
|
-
{
|
54
|
-
var res, i, N, spanEl, parentEl;
|
55
|
-
if (typeof object==='undefined')
|
56
|
-
{
|
57
|
-
throw {message:'Calling toJSON with undefined'};
|
58
|
-
}
|
59
|
-
else if (object instanceof Text)
|
60
|
-
{
|
61
|
-
parentEl = object.parentElement;
|
62
|
-
if (parentEl)
|
63
|
-
{
|
64
|
-
spanEl = document.createElement("calabash");
|
65
|
-
spanEl.style.display = "inline";
|
66
|
-
spanEl.innerHTML = object.textContent;
|
67
|
-
parentEl.replaceChild(spanEl, object);
|
68
|
-
res = computeRectForNode(spanEl);
|
69
|
-
res.nodeType = NODE_TYPES[object.nodeType];
|
70
|
-
delete res.nodeName;
|
71
|
-
delete res.id;
|
72
|
-
delete res['class'];
|
73
|
-
|
74
|
-
parentEl.replaceChild(object,spanEl);
|
75
|
-
}
|
76
|
-
else
|
77
|
-
{
|
78
|
-
res = object;
|
79
|
-
}
|
80
|
-
|
81
|
-
|
82
|
-
}
|
83
|
-
else if (object instanceof Node)
|
84
|
-
{
|
85
|
-
res = computeRectForNode(object);
|
86
|
-
}
|
87
|
-
else if (object instanceof NodeList ||
|
88
|
-
(typeof object=='object' && object &&
|
89
|
-
typeof object.length === 'number' &&
|
90
|
-
object.length > 0
|
91
|
-
&& typeof object[0] !== 'undefined'))
|
92
|
-
{
|
93
|
-
res = [];
|
94
|
-
for (i=0,N=object.length;i<N;i++)
|
95
|
-
{
|
96
|
-
res[i] = toJSON(object[i]);
|
97
|
-
}
|
98
|
-
}
|
99
|
-
else
|
100
|
-
{
|
101
|
-
res = object;
|
102
|
-
}
|
103
|
-
return res;
|
104
|
-
}
|
105
|
-
|
106
|
-
function applyMethods(object, arguments) {
|
107
|
-
var length = arguments.length;
|
108
|
-
|
109
|
-
for(var i = 0; i < length; i++) {
|
110
|
-
var argument = arguments[i];
|
111
|
-
|
112
|
-
if (typeof argument === 'string') {
|
113
|
-
argument = {method_name: argument, arguments: []}
|
114
|
-
}
|
115
|
-
|
116
|
-
var methodName = argument.method_name;
|
117
|
-
var methodArguments = argument.arguments;
|
118
|
-
|
119
|
-
if (typeof object[methodName] === 'undefined') {
|
120
|
-
var type = Object.prototype.toString.call(object);
|
121
|
-
|
122
|
-
object =
|
123
|
-
{
|
124
|
-
error: "No such method '" + methodName + "'",
|
125
|
-
methodName: methodName,
|
126
|
-
receiverString: object.constructor.name,
|
127
|
-
receiverClass: type
|
128
|
-
};
|
129
|
-
|
130
|
-
break;
|
131
|
-
} else {
|
132
|
-
object = object[methodName].apply(object, methodArguments);
|
133
|
-
}
|
134
|
-
}
|
135
|
-
}
|
136
|
-
|
137
|
-
var exp = '%@'/* dynamic */,
|
138
|
-
queryType = '%@' /* dynamic */,
|
139
|
-
arguments = '%@' /* dynamic */,
|
140
|
-
nodes = null,
|
141
|
-
res = [],
|
142
|
-
i,N;
|
143
|
-
try
|
144
|
-
{
|
145
|
-
if (queryType==='xpath')
|
146
|
-
{
|
147
|
-
nodes = document.evaluate(exp, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
|
148
|
-
for (i=0,N=nodes.snapshotLength;i<N;i++)
|
149
|
-
{
|
150
|
-
res[i] = nodes.snapshotItem(i);
|
151
|
-
}
|
152
|
-
}
|
153
|
-
else
|
154
|
-
{
|
155
|
-
res = document.querySelectorAll(exp);
|
156
|
-
}
|
157
|
-
}
|
158
|
-
catch (e)
|
159
|
-
{
|
160
|
-
return JSON.stringify({error:'Exception while running query: '+exp, details:e.toString()})
|
161
|
-
}
|
162
|
-
|
163
|
-
if (arguments !== '%@') {
|
164
|
-
var length = res.length;
|
165
|
-
|
166
|
-
for (var i = 0; i < length; i++) {
|
167
|
-
res[i] = applyMethods(res[i], arguments);
|
168
|
-
}
|
169
|
-
}
|
170
|
-
|
171
|
-
return JSON.stringify(toJSON(res));
|
172
|
-
})();
|