run_loop 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 42636cfa373f5b8df604217d9bb9ee8e4d34a338
4
- data.tar.gz: 0624902bb001bae1e33631f4840a4999f59da2d2
3
+ metadata.gz: 555d66495497677e02f04d4636929bb5eaf0915d
4
+ data.tar.gz: 731b06dbc736209fd00ca51fe9baf5a18a354e95
5
5
  SHA512:
6
- metadata.gz: 23f1e8173c75dc439197d1d85282790950fcfa54532988fa1bb11085438034ef2f366bc56f6b6f7a7fb6dd1295f1a41d7c564fd033e260009b3e34d4cf4a5e83
7
- data.tar.gz: 5484b9c573f9efd6401542e13f89d162489572fb147ea462b361ecc0f01b862098ac6310d4a513176c9e5c5a3525893d82eab46e7d2c00660abcbf9c7021806b
6
+ metadata.gz: 8415189c600977b255ee274e6cdd9f123fcdf8df8dae8aad3adbf1c4d2c23af945cb3b4cc7a36647adcf38a47bc26ecdd866cf2180739ef0882409d280ef2285
7
+ data.tar.gz: ccf930290492ddee04e8372f5bf5e25c7f1101c40821b0c227bf8fd624186f8f3f6ce98509d92bffe3845ce7360f43314e9fe797d7df0985a2512cfcd8234e4c
data/lib/run_loop.rb CHANGED
@@ -25,6 +25,7 @@ require 'run_loop/host_cache'
25
25
  require 'run_loop/patches/awesome_print'
26
26
  require 'run_loop/core_simulator'
27
27
  require 'run_loop/simctl/plists'
28
+ require 'run_loop/template'
28
29
 
29
30
  module RunLoop
30
31
 
data/lib/run_loop/core.rb CHANGED
@@ -15,15 +15,15 @@ module RunLoop
15
15
  START_DELIMITER = "OUTPUT_JSON:\n"
16
16
  END_DELIMITER="\nEND_OUTPUT"
17
17
 
18
- SCRIPTS_PATH = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'scripts'))
19
18
  SCRIPTS = {
20
- :dismiss => 'run_dismiss_location.js',
21
- :run_loop_fast_uia => 'run_loop_fast_uia.js',
22
- :run_loop_shared_element => 'run_loop_shared_element.js',
23
- :run_loop_host => 'run_loop_host.js',
24
- :run_loop_basic => 'run_loop_basic.js'
19
+ :dismiss => 'run_dismiss_location.js',
20
+ :run_loop_host => 'run_loop_host.js',
21
+ :run_loop_fast_uia => 'run_loop_fast_uia.js',
22
+ :run_loop_shared_element => 'run_loop_shared_element.js',
23
+ :run_loop_basic => 'run_loop_basic.js'
25
24
  }
26
25
 
26
+ SCRIPTS_PATH = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'scripts'))
27
27
  READ_SCRIPT_PATH = File.join(SCRIPTS_PATH, 'read-cmd.sh')
28
28
  TIMEOUT_SCRIPT_PATH = File.join(SCRIPTS_PATH, 'timeout3')
29
29
 
@@ -54,7 +54,7 @@ module RunLoop
54
54
  if SCRIPTS[key].nil?
55
55
  return nil
56
56
  end
57
- File.join(scripts_path, SCRIPTS[key])
57
+ SCRIPTS[key]
58
58
  end
59
59
 
60
60
  def self.detect_connected_device
@@ -244,7 +244,7 @@ module RunLoop
244
244
 
245
245
  script = File.join(results_dir, '_run_loop.js')
246
246
 
247
- code = File.read(options[:script])
247
+ code = UIAScriptTemplate.new(SCRIPTS_PATH, options[:script]).result
248
248
  code = code.gsub(/\$PATH/, results_dir)
249
249
  code = code.gsub(/\$READ_SCRIPT_PATH/, READ_SCRIPT_PATH)
250
250
  code = code.gsub(/\$TIMEOUT_SCRIPT_PATH/, TIMEOUT_SCRIPT_PATH)
@@ -254,13 +254,15 @@ module RunLoop
254
254
  FileUtils.rm_f(repl_path)
255
255
 
256
256
  uia_strategy = options[:uia_strategy]
257
+
257
258
  if uia_strategy == :host
258
259
  create_uia_pipe(repl_path)
259
- RunLoop::HostCache.default.clear unless RunLoop::Environment.xtc?
260
260
  else
261
261
  FileUtils.touch repl_path
262
262
  end
263
263
 
264
+ RunLoop::HostCache.default.clear unless RunLoop::Environment.xtc?
265
+
264
266
  cal_script = File.join(SCRIPTS_PATH, 'calabash_script_uia.js')
265
267
  File.open(script, 'w') do |file|
266
268
  if include_calabash_script?(options)
@@ -472,22 +474,24 @@ Logfile: #{log_file}
472
474
  # version.
473
475
  def self.default_simulator(xcode=RunLoop::Xcode.new)
474
476
 
475
- if xcode.version_gte_71?
476
- 'iPhone 6s (9.1)'
477
+ if xcode.version_gte_72?
478
+ "iPhone 6s (9.2)"
479
+ elsif xcode.version_gte_71?
480
+ "iPhone 6s (9.1)"
477
481
  elsif xcode.version_gte_7?
478
- 'iPhone 5s (9.0)'
482
+ "iPhone 5s (9.0)"
479
483
  elsif xcode.version_gte_64?
480
- 'iPhone 5s (8.4 Simulator)'
484
+ "iPhone 5s (8.4 Simulator)"
481
485
  elsif xcode.version_gte_63?
482
- 'iPhone 5s (8.3 Simulator)'
486
+ "iPhone 5s (8.3 Simulator)"
483
487
  elsif xcode.version_gte_62?
484
- 'iPhone 5s (8.2 Simulator)'
488
+ "iPhone 5s (8.2 Simulator)"
485
489
  elsif xcode.version_gte_61?
486
- 'iPhone 5s (8.1 Simulator)'
490
+ "iPhone 5s (8.1 Simulator)"
487
491
  elsif xcode.version_gte_6?
488
- 'iPhone 5s (8.0 Simulator)'
492
+ "iPhone 5s (8.0 Simulator)"
489
493
  else
490
- 'iPhone Retina (4-inch) - Simulator - iOS 7.1'
494
+ "iPhone Retina (4-inch) - Simulator - iOS 7.1"
491
495
  end
492
496
  end
493
497
 
@@ -85,7 +85,7 @@ module RunLoop
85
85
  # Checks the value of JENKINS_HOME
86
86
  def self.jenkins?
87
87
  value = ENV["JENKINS_HOME"]
88
- return value && value != ''
88
+ !!value && value != ''
89
89
  end
90
90
 
91
91
  # Returns true if running in Travis CI
@@ -93,7 +93,7 @@ module RunLoop
93
93
  # Checks the value of TRAVIS
94
94
  def self.travis?
95
95
  value = ENV["TRAVIS"]
96
- return value && value != ''
96
+ !!value && value != ''
97
97
  end
98
98
 
99
99
  # Returns true if running in Circle CI
@@ -101,7 +101,7 @@ module RunLoop
101
101
  # Checks the value of CIRCLECI
102
102
  def self.circle_ci?
103
103
  value = ENV["CIRCLECI"]
104
- return value && value != ''
104
+ !!value && value != ''
105
105
  end
106
106
 
107
107
  # Returns true if running in Teamcity
@@ -109,7 +109,15 @@ module RunLoop
109
109
  # Checks the value of TEAMCITY_PROJECT_NAME
110
110
  def self.teamcity?
111
111
  value = ENV["TEAMCITY_PROJECT_NAME"]
112
- return value && value != ''
112
+ !!value && value != ''
113
+ end
114
+
115
+ # Returns true if running in Teamcity
116
+ #
117
+ # Checks the value of GITLAB_CI
118
+ def self.gitlab?
119
+ value = ENV["GITLAB_CI"]
120
+ !!value && value != ''
113
121
  end
114
122
 
115
123
  # Returns true if running in a CI environment
@@ -119,7 +127,8 @@ module RunLoop
119
127
  self.travis?,
120
128
  self.jenkins?,
121
129
  self.circle_ci?,
122
- self.teamcity?
130
+ self.teamcity?,
131
+ self.gitlab?
123
132
  ].any?
124
133
  end
125
134
 
@@ -145,7 +154,7 @@ module RunLoop
145
154
  # !@visibility private
146
155
  def self.ci_var_defined?
147
156
  value = ENV["CI"]
148
- return value && value != ''
157
+ !!value && value != ''
149
158
  end
150
159
  end
151
160
  end
@@ -0,0 +1,22 @@
1
+ require 'erb'
2
+
3
+ module RunLoop
4
+
5
+ # class to break up javascript templates in to reusable chunks
6
+ class UIAScriptTemplate < ERB
7
+ def initialize(template_root, template_relative_path)
8
+ @template_root = template_root
9
+ @template = File.read(File.join(@template_root, template_relative_path))
10
+ super(@template)
11
+ end
12
+
13
+ def render_template(template_relative_path)
14
+ return UIAScriptTemplate.new(@template_root, template_relative_path).result
15
+ end
16
+
17
+ def result
18
+ super(binding)
19
+ end
20
+ end
21
+
22
+ end
@@ -1,5 +1,5 @@
1
1
  module RunLoop
2
- VERSION = "2.0.1"
2
+ VERSION = "2.0.2"
3
3
 
4
4
  # A model of a software release version that can be used to compare two versions.
5
5
  #
@@ -24,6 +24,14 @@ module RunLoop
24
24
  to_s
25
25
  end
26
26
 
27
+ # Returns a version instance for `Xcode 7.1`; used to check for the
28
+ # availability of features and paths to various items on the filesystem.
29
+ #
30
+ # @return [RunLoop::Version] 7.1
31
+ def v72
32
+ fetch_version(:v72)
33
+ end
34
+
27
35
  # Returns a version instance for `Xcode 7.1`; used to check for the
28
36
  # availability of features and paths to various items on the filesystem.
29
37
  #
@@ -96,6 +104,13 @@ module RunLoop
96
104
  fetch_version(:v50)
97
105
  end
98
106
 
107
+ # Is the active Xcode version 7.1 or above?
108
+ #
109
+ # @return [Boolean] `true` if the current Xcode version is >= 7.1
110
+ def version_gte_72?
111
+ version >= v72
112
+ end
113
+
99
114
  # Is the active Xcode version 7.1 or above?
100
115
  #
101
116
  # @return [Boolean] `true` if the current Xcode version is >= 7.1
File without changes
@@ -0,0 +1,26 @@
1
+ var Log = (function () {
2
+ var forceFlush = [],
3
+ N = 16384,
4
+ i = N;
5
+ while (i--) {
6
+ forceFlush[i] = "*";
7
+ }
8
+ forceFlush = forceFlush.join('');
9
+
10
+ function log_json(object, flush)
11
+ {
12
+ UIALogger.logMessage("OUTPUT_JSON:\n"+JSON.stringify(object)+"\nEND_OUTPUT");
13
+ if (flush) {
14
+ UIALogger.logMessage(forceFlush);
15
+ }
16
+ }
17
+
18
+ return {
19
+ result: function (status, data, flush) {
20
+ log_json({"status": status, "value": data, "index":_actualIndex}, flush)
21
+ },
22
+ output: function (msg, flush) {
23
+ log_json({"output": msg,"last_index":_actualIndex}, flush);
24
+ }
25
+ };
26
+ })();
@@ -0,0 +1,103 @@
1
+ function findAlertViewText(alert) {
2
+ if (!alert) {
3
+ return false;
4
+ }
5
+ var txt = alert.name(),
6
+ txts;
7
+ if (txt == null) {
8
+ txts = alert.staticTexts();
9
+ if (txts != null && txts.length > 0) {
10
+
11
+ txt = txts[0].name();
12
+ }
13
+
14
+ }
15
+ return txt;
16
+ }
17
+
18
+ function englishLocalizations() {
19
+ return [
20
+ ["OK", /Would Like to Use Your Current Location/],
21
+ ["OK", /Location Accuracy/],
22
+ ["Allow", /access your location/],
23
+ ["OK", /Would Like to Access Your Photos/],
24
+ ["OK", /Would Like to Access Your Contacts/],
25
+ ["OK", /Access the Microphone/],
26
+ ["OK", /Would Like to Access Your Calendar/],
27
+ ["OK", /Would Like to Access Your Reminders/],
28
+ ["OK", /Would Like to Access Your Motion Activity/],
29
+ ["OK", /Would Like to Access the Camera/],
30
+ ["OK", /Would Like to Access Your Motion & Fitness Activity/],
31
+ ["OK", /Would Like Access to Twitter Accounts/],
32
+ ["OK", /data available to nearby bluetooth devices/],
33
+ ["OK", /Would Like to Send You Notifications/],
34
+ ["OK", /would like to send you Push Notifications/]
35
+ ];
36
+ }
37
+
38
+ function danishLocalizations() {
39
+ return [
40
+ // Location
41
+ ["Tillad", /bruge din lokalitet, når du bruger appen/],
42
+ ["Tillad", /også når du ikke bruger appen/],
43
+ ["OK", /vil bruge din aktuelle placering/]
44
+ ];
45
+ }
46
+
47
+ function spanishLocalizations() {
48
+ return [
49
+ // APNS
50
+ ["OK", /enviarle notificaiones/]
51
+ ];
52
+ }
53
+
54
+ function germanLocalizations() {
55
+ return [
56
+ // Location
57
+ ["Ja", /Darf (?:.)+ Ihren aktuellen Ort verwenden/]
58
+ ];
59
+ }
60
+
61
+ function dutchLocalizations() {
62
+ return [
63
+ // APNS
64
+ ["OK", /wil u berichten stuern/]
65
+ ];
66
+ }
67
+
68
+ function russianLocalizations() {
69
+ return [
70
+ // Location
71
+ ["OK", /запрашивает разрешение на использование Ващей текущей пгеопозиции/]
72
+ ];
73
+ }
74
+
75
+ function localizations() {
76
+ return [].concat(
77
+ danishLocalizations(),
78
+ dutchLocalizations(),
79
+ englishLocalizations(),
80
+ germanLocalizations(),
81
+ russianLocalizations(),
82
+ spanishLocalizations()
83
+ );
84
+ }
85
+
86
+ function isPrivacyAlert(alert) {
87
+
88
+ var ans, exp, txt;
89
+
90
+ var exps = localizations();
91
+
92
+ txt = findAlertViewText(alert);
93
+ Log.output({"output":"alert: "+txt}, true);
94
+ for (var i = 0; i < exps.length; i++) {
95
+ ans = exps[i][0];
96
+ exp = exps[i][1];
97
+ if (exp.test(txt)) {
98
+ return ans;
99
+ }
100
+ }
101
+ return false;
102
+ }
103
+
@@ -1,43 +1,7 @@
1
1
  var target = UIATarget.localTarget(),
2
2
  screenshot_count = 0;
3
3
 
4
- function findAlertViewText(alert) {
5
- if (!alert) {
6
- return false;
7
- }
8
- var txt = alert.name(),
9
- txts;
10
- if (txt == null) {
11
- txts = alert.staticTexts();
12
- if (txts != null && txts.length > 0) {
13
-
14
- txt = txts[0].name();
15
- }
16
-
17
- }
18
- return txt;
19
- }
20
-
21
- function isLocationPrompt(alert) {
22
- var exps = [
23
- ["OK", /vil bruge din aktuelle placering/],
24
- ["OK", /Would Like to Use Your Current Location/],
25
- ["Ja", /Darf (?:.)+ Ihren aktuellen Ort verwenden/]
26
- ],
27
- ans, exp,
28
- txt;
29
-
30
- txt = findAlertViewText(alert);
31
- for (var i = 0; i < exps.length; i++) {
32
- ans = exps[i][0];
33
- exp = exps[i][1];
34
- if (exp.test(txt)) {
35
- return ans;
36
- }
37
- }
38
- return false;
39
- }
40
-
4
+ <%= render_template("lib/on_alert.js") %>
41
5
 
42
6
  var alertHandlers = [//run in reverse order of this:
43
7
  isLocationPrompt
@@ -1,248 +1,34 @@
1
- if (typeof JSON !== 'object') {
2
- JSON = {};
3
- }
4
- (function () {
5
- 'use strict';
6
- function f(n) {
7
- return n < 10 ? '0' + n : n;
8
- }
9
-
10
- if (typeof Date.prototype.toJSON !== 'function') {
11
- Date.prototype.toJSON = function (key) {
12
- return isFinite(this.valueOf()) ? this.getUTCFullYear() + '-' +
13
- f(this.getUTCMonth() + 1) + '-' +
14
- f(this.getUTCDate()) + 'T' +
15
- f(this.getUTCHours()) + ':' +
16
- f(this.getUTCMinutes()) + ':' +
17
- f(this.getUTCSeconds()) + 'Z' : null;
18
- };
19
- String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function (key) {
20
- return this.valueOf();
21
- };
22
- }
23
- var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, gap, indent, meta = {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"': '\\"', '\\': '\\\\'}, rep;
24
-
25
- function quote(string) {
26
- escapable.lastIndex = 0;
27
- return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
28
- var c = meta[a];
29
- return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
30
- }) + '"' : '"' + string + '"';
31
- }
32
-
33
- function str(key, holder) {
34
- var i, k, v, length, mind = gap, partial, value = holder[key];
35
- if (value && typeof value === 'object' && typeof value.toJSON === 'function') {
36
- value = value.toJSON(key);
37
- }
38
- if (typeof rep === 'function') {
39
- value = rep.call(holder, key, value);
40
- }
41
- switch (typeof value) {
42
- case'string':
43
- return quote(value);
44
- case'number':
45
- return isFinite(value) ? String(value) : 'null';
46
- case'boolean':
47
- case'null':
48
- return String(value);
49
- case'object':
50
- if (!value) {
51
- return'null';
52
- }
53
- gap += indent;
54
- partial = [];
55
- if (Object.prototype.toString.apply(value) === '[object Array]') {
56
- length = value.length;
57
- for (i = 0; i < length; i += 1) {
58
- partial[i] = str(i, value) || 'null';
59
- }
60
- v = partial.length === 0 ? '[]' : gap ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : '[' + partial.join(',') + ']';
61
- gap = mind;
62
- return v;
63
- }
64
- if (rep && typeof rep === 'object') {
65
- length = rep.length;
66
- for (i = 0; i < length; i += 1) {
67
- if (typeof rep[i] === 'string') {
68
- k = rep[i];
69
- v = str(k, value);
70
- if (v) {
71
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
72
- }
73
- }
74
- }
75
- } else {
76
- for (k in value) {
77
- if (Object.prototype.hasOwnProperty.call(value, k)) {
78
- v = str(k, value);
79
- if (v) {
80
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
81
- }
82
- }
83
- }
84
- }
85
- v = partial.length === 0 ? '{}' : gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : '{' + partial.join(',') + '}';
86
- gap = mind;
87
- return v;
88
- }
89
- }
90
-
91
- if (typeof JSON.stringify !== 'function') {
92
- JSON.stringify = function (value, replacer, space) {
93
- var i;
94
- gap = '';
95
- indent = '';
96
- if (typeof space === 'number') {
97
- for (i = 0; i < space; i += 1) {
98
- indent += ' ';
99
- }
100
- } else if (typeof space === 'string') {
101
- indent = space;
102
- }
103
- rep = replacer;
104
- if (replacer && typeof replacer !== 'function' && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) {
105
- throw new Error('JSON.stringify');
106
- }
107
- return str('', {'': value});
108
- };
109
- }
110
- if (typeof JSON.parse !== 'function') {
111
- JSON.parse = function (text, reviver) {
112
- var j;
113
-
114
- function walk(holder, key) {
115
- var k, v, value = holder[key];
116
- if (value && typeof value === 'object') {
117
- for (k in value) {
118
- if (Object.prototype.hasOwnProperty.call(value, k)) {
119
- v = walk(value, k);
120
- if (v !== undefined) {
121
- value[k] = v;
122
- } else {
123
- delete value[k];
124
- }
125
- }
126
- }
127
- }
128
- return reviver.call(holder, key, value);
129
- }
130
-
131
- text = String(text);
132
- cx.lastIndex = 0;
133
- if (cx.test(text)) {
134
- text = text.replace(cx, function (a) {
135
- return'\\u' +
136
- ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
137
- });
138
- }
139
- if (/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
140
- j = eval('(' + text + ')');
141
- return typeof reviver === 'function' ? walk({'': j}, '') : j;
142
- }
143
- throw new SyntaxError('JSON.parse');
144
- };
145
- }
146
- }());
147
-
148
-
149
- var Log = (function () {
150
- var forceFlush = [],
151
- N = 16384,
152
- i = N;
153
- while (i--) {
154
- forceFlush[i] = "*";
155
- }
156
- forceFlush = forceFlush.join('');
157
-
158
- function log_json(object, flush)
159
- {
160
- UIALogger.logMessage("OUTPUT_JSON:\n"+JSON.stringify(object)+"\nEND_OUTPUT");
161
- if (flush) {
162
- UIALogger.logMessage(forceFlush);
163
- }
164
- }
165
-
166
- return {
167
- result: function (status, data, flush) {
168
- log_json({"status": status, "value": data, "index":_actualIndex}, flush)
169
- },
170
- output: function (msg, flush) {
171
- log_json({"output": msg,"last_index":_actualIndex}, flush);
172
- }
173
- };
174
- })();
175
-
176
-
177
- function findAlertViewText(alert) {
178
- if (!alert) {
179
- return false;
180
- }
181
- var txt = alert.name(),
182
- txts;
183
- if (txt == null) {
184
- txts = alert.staticTexts();
185
- if (txts != null && txts.length > 0) {
186
- txt = txts[0].name();
187
- }
188
- }
189
- return txt;
190
- }
191
-
192
- function isLocationPrompt(alert) {
193
- var exps = [
194
- ["OK", /vil bruge din aktuelle placering/],
195
- ["OK", /Would Like to Use Your Current Location/],
196
- ["OK", /Would Like to Send You Notifications/],
197
- ["Allow", /access your location/],
198
- ["Ja", /Darf (?:.)+ Ihren aktuellen Ort verwenden/],
199
- ["OK", /Would Like to Access Your Photos/],
200
- ["OK", /Would Like to Access Your Contacts/],
201
- ["OK", /Location Accuracy/],
202
- ["OK", /запрашивает разрешение на использование Ващей текущей пгеопозиции/]
203
- ],
204
- ans, exp,
205
- txt;
206
-
207
- txt = findAlertViewText(alert);
208
- Log.output({"output":"alert: "+txt}, true);
209
- for (var i = 0; i < exps.length; i++) {
210
- ans = exps[i][0];
211
- exp = exps[i][1];
212
- if (exp.test(txt)) {
213
- return ans;
214
- }
215
- }
216
- return false;
217
- }
1
+ <%= render_template("lib/json2.min.js") %>
2
+ <%= render_template("lib/log.js"); %>
3
+ <%= render_template("lib/on_alert.js"); %>
218
4
 
219
5
  UIATarget.onAlert = function (alert) {
220
6
  Log.output({"output":"on alert"}, true);
221
7
  var target = UIATarget.localTarget();
222
8
  target.pushTimeout(10);
223
- function attemptTouchOKOnLocation(retry_count) {
9
+ function dismissPrivacyAlert(retry_count) {
224
10
  retry_count = retry_count || 0;
225
11
  if (retry_count >= 5) {
226
- Log.output("Maxed out retry (5) - unable to dismiss location dialog.");
12
+ Log.output("Maxed out retry (5) - unable to dismiss privacy alert.");
227
13
  return;
228
14
  }
229
15
  try {
230
- var answer = isLocationPrompt(alert);
16
+ var answer = isPrivacyAlert(alert);
231
17
  if (answer) {
232
18
  alert.buttons()[answer].tap();
233
19
  }
234
20
  }
235
21
  catch (e) {
236
- Log.output("Exception while trying to touch alert dialog. Retrying...");
22
+ Log.output("Exception while trying to touch alert. Retrying...");
237
23
  if (e && typeof e.toString == 'function') {
238
24
  Log.output(e.toString());
239
25
  }
240
26
  target.delay(1);
241
- attemptTouchOKOnLocation(retry_count + 1);
27
+ dismissPrivacyAlert(retry_count + 1);
242
28
  }
243
29
  }
244
30
 
245
- attemptTouchOKOnLocation(0);
31
+ dismissPrivacyAlert(0);
246
32
  target.popTimeout();
247
33
  return true;
248
34
  };