run_loop 1.1.1.pre2 → 1.1.1.pre3
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/run_loop/version.rb +1 -1
- data/scripts/run_loop_fast_uia.js +30 -13
- 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: 1822fe07be976e6f4388798cf3056b7580d014f6
|
4
|
+
data.tar.gz: 267f9c4e9035cebe48ef7f1ff31c75b4f76a0943
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3f667f1ea1ed63c1378806ab311d9489567d5567db883ea6467b3dbf0511d9ec2a49961f5cbcd6da042bd178b67aa2346335d0f0bce71c91deb9310f105cf7c
|
7
|
+
data.tar.gz: 8f7b98186a41edc20c158b577ac141a59259ea65b58c556f1dc654646d53d47b2574e98c138d8d9dc0aed6e742f1135d72c8cb3e506e16977870533adf8e4654
|
data/lib/run_loop/version.rb
CHANGED
@@ -146,10 +146,12 @@ if (typeof JSON !== 'object') {
|
|
146
146
|
}());
|
147
147
|
|
148
148
|
|
149
|
+
_RUN_LOOP_MAX_RETRY_AFTER_HANDLER = 10;
|
149
150
|
var _expectedIndex = 0,//expected index of next command
|
150
151
|
_actualIndex=0,//actual index of next command by reading commandPath
|
151
152
|
_exp,//expression to be eval'ed
|
152
|
-
_result
|
153
|
+
_result,
|
154
|
+
_lastResponse=null;
|
153
155
|
|
154
156
|
var Log = (function () {
|
155
157
|
var forceFlush = [],
|
@@ -221,8 +223,11 @@ function isLocationPrompt(alert) {
|
|
221
223
|
}
|
222
224
|
|
223
225
|
UIATarget.onAlert = function (alert) {
|
224
|
-
|
225
|
-
|
226
|
+
var target = UIATarget.localTarget(),
|
227
|
+
app = target.frontMostApp(),
|
228
|
+
req = null,
|
229
|
+
rsp = null,
|
230
|
+
actualIndex = null;
|
226
231
|
target.pushTimeout(10);
|
227
232
|
function attemptTouchOKOnLocation(retry_count) {
|
228
233
|
retry_count = retry_count || 0;
|
@@ -248,6 +253,20 @@ UIATarget.onAlert = function (alert) {
|
|
248
253
|
|
249
254
|
attemptTouchOKOnLocation(0);
|
250
255
|
target.popTimeout();
|
256
|
+
for (var i=0;i<_RUN_LOOP_MAX_RETRY_AFTER_HANDLER;i++) {
|
257
|
+
req = app.preferencesValueForKey(__calabashRequest);
|
258
|
+
rsp = app.preferencesValueForKey(__calabashResponse);
|
259
|
+
actualIndex = req && req['index'];
|
260
|
+
if (req && !isNaN(actualIndex) && actualIndex <= _lastResponse['index']) {
|
261
|
+
UIALogger.logMessage("Deleting previous response: "+(rsp && rsp['index']));
|
262
|
+
app.setPreferencesValueForKey(0, __calabashRequest);
|
263
|
+
app.setPreferencesValueForKey(null, __calabashRequest);
|
264
|
+
}
|
265
|
+
if (_lastResponse) {
|
266
|
+
UIALogger.logMessage("Re-Writing response: "+_lastResponse['value']);
|
267
|
+
_response(_lastResponse);
|
268
|
+
}
|
269
|
+
}
|
251
270
|
return true;
|
252
271
|
};
|
253
272
|
|
@@ -292,9 +311,8 @@ var target = null,
|
|
292
311
|
tmp;
|
293
312
|
|
294
313
|
for (i=0; i<MAX_TRIES; i+=1) {
|
295
|
-
UIALogger.logMessage("Write result...");
|
296
314
|
tmp = target.frontMostApp().preferencesValueForKey(__calabashResponse);
|
297
|
-
UIALogger.logMessage("Last response..."+tmp);
|
315
|
+
UIALogger.logMessage("Last response..."+(tmp && tmp['index']+"->"+tmp['value']));
|
298
316
|
target.frontMostApp().setPreferencesValueForKey(sanitized, __calabashResponse);
|
299
317
|
res = target.frontMostApp().preferencesValueForKey(__calabashRequest);
|
300
318
|
res = target.frontMostApp().preferencesValueForKey(__calabashResponse);
|
@@ -302,7 +320,6 @@ var target = null,
|
|
302
320
|
target.delay(0.1);
|
303
321
|
res = target.frontMostApp().preferencesValueForKey(__calabashResponse);
|
304
322
|
UIALogger.logMessage("Post delay response..."+(res && res['value']));
|
305
|
-
|
306
323
|
if (res && res['index'] == sanitized['index']) {
|
307
324
|
UIALogger.logMessage("Storage succeeded: "+ res['index']);
|
308
325
|
return;
|
@@ -312,18 +329,18 @@ var target = null,
|
|
312
329
|
}
|
313
330
|
}
|
314
331
|
throw new Error("Unable to write to preferences");
|
315
|
-
|
316
332
|
},
|
317
333
|
_success = function(result,index) {
|
318
|
-
|
319
|
-
_response(
|
334
|
+
_lastResponse = {"status":'success', "value":result, "index": index};
|
335
|
+
_response(_lastResponse);
|
320
336
|
|
321
337
|
},
|
322
338
|
_failure = function(err, index) {
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
339
|
+
_lastResponse = {"status":'error',
|
340
|
+
"value":err.toString(),
|
341
|
+
"backtrace":(err.stack ? err.stack.toString() : ""),
|
342
|
+
"index":index};
|
343
|
+
_response(_lastResponse);
|
327
344
|
},
|
328
345
|
_resetCalabashPreferences = function () {
|
329
346
|
//Implementation is weird but reading pref values seems to have side effects
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: run_loop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.1.
|
4
|
+
version: 1.1.1.pre3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karl Krukow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|