angular_webdriver 0.0.7 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.gitmodules +3 -0
- data/.rspec +2 -0
- data/.travis.yml +32 -0
- data/Gemfile +2 -0
- data/Thorfile +33 -1
- data/angular_webdriver.gemspec +10 -3
- data/docs/overview.md +101 -0
- data/docs/sync.md +53 -0
- data/lib/angular_webdriver/protractor/by.rb +331 -0
- data/lib/angular_webdriver/protractor/by_repeater_inner.rb +106 -0
- data/lib/angular_webdriver/protractor/client_side_scripts.rb +1035 -0
- data/lib/angular_webdriver/protractor/protractor.rb +396 -77
- data/lib/angular_webdriver/protractor/protractor_element.rb +33 -0
- data/lib/angular_webdriver/protractor/rspec_helpers.rb +19 -0
- data/lib/angular_webdriver/protractor/watir_patch.rb +209 -0
- data/lib/angular_webdriver/protractor/webdriver_patch.rb +246 -0
- data/lib/angular_webdriver/version.rb +2 -2
- data/lib/angular_webdriver.rb +14 -1
- data/{LICENSE → license/angular_webdriver/LICENSE.txt} +0 -0
- data/{lib/angular_webdriver → license}/protractor/LICENSE.txt +0 -0
- data/{lib/angular_webdriver/protractor/get_url_trace.rb → notes/bootstrap_notes.md} +13 -0
- data/notes/element_by_id/element_by_id_sync_off.txt +12 -0
- data/notes/element_by_id/element_by_id_sync_on.txt +74 -0
- data/notes/element_chaining_debug.txt +94 -0
- data/notes/evaluate/js_evaluate_sync_on.txt +60 -0
- data/notes/evaluate/ruby_evaluate_sync_on.txt +35 -0
- data/notes/get_title/browser_get_title_sync_off.txt +11 -0
- data/notes/get_title/browser_get_title_sync_on.txt +54 -0
- data/notes/phantomjs.md +23 -0
- data/notes/protractor_cli_bugs.txt +39 -0
- data/notes/protractor_get/protractor_get.rb +102 -0
- data/notes/protractor_get/protractor_get_website_sync_off.txt +11 -0
- data/notes/protractor_get/protractor_get_website_sync_on.txt +86 -0
- data/notes/repeater/findAllRepeaterRows_annotated.txt +150 -0
- data/notes/repeater/findAllRepeaterRows_raw.txt +145 -0
- data/notes/repeater/findRepeaterColumn_annotated.txt +317 -0
- data/notes/repeater/findRepeaterColumn_raw.txt +310 -0
- data/notes/repeater/findRepeaterElement_annotated.txt +152 -0
- data/notes/repeater/findRepeaterElement_raw.txt +146 -0
- data/notes/repeater/findRepeaterRows_annotated.txt +156 -0
- data/notes/repeater/findRepeaterRows_raw.txt +152 -0
- data/notes/sync_after.md +46 -0
- data/notes/sync_notes.md +137 -0
- data/notes/synchronize_spec/status_gettext.txt +121 -0
- data/notes/synchronize_spec/status_gettext_x3.txt +451 -0
- data/notes/synchronize_spec/synchronize_spec.js.txt +74 -0
- data/notes/synchronize_spec/watir_gettext.txt +73 -0
- data/readme.md +52 -12
- data/release_notes.md +127 -0
- data/selenium_server/lib/logs.rb +50 -0
- data/selenium_server/lib/selenium_server.rb +21 -0
- data/selenium_server/readme.md +3 -0
- data/selenium_server/spec/logs_spec.rb +18 -0
- data/selenium_server/spec/nodejs_sync_spec_waithttp_annotated.txt +54 -0
- data/selenium_server/spec/nodejs_sync_spec_waithttp_raw.txt +367 -0
- data/selenium_server/spec/nodejs_sync_spec_waithttp_raw_processed.txt +43 -0
- data/selenium_server/spec/ruby_sync_spec_waithttp_annotated.txt +59 -0
- data/selenium_server/spec/ruby_sync_spec_waithttp_raw.txt +267 -0
- data/selenium_server/spec/ruby_sync_spec_waithttp_raw_processed.txt +39 -0
- data/selenium_server/spec/spec_helper.rb +6 -0
- data/selenium_server/spec/status_gettext_x3.txt +429 -0
- data/selenium_server/spec/status_gettext_x3_annotated.txt +86 -0
- metadata +91 -18
- data/lib/angular_webdriver/protractor/clientSideScripts.json +0 -19
- data/lib/angular_webdriver/protractor/clientsidescripts.js +0 -671
- data/lib/angular_webdriver/protractor/scripts.rb +0 -7
- data/lib/angular_webdriver/protractor/scripts_to_json.js +0 -11
- data/spec/protractor_spec.rb +0 -40
- data/spec/spec_helper.rb +0 -5
@@ -0,0 +1,310 @@
|
|
1
|
+
browser.get('http://localhost:8081/#/repeater')
|
2
|
+
|
3
|
+
element(by.repeater('baz in days').column('b')).getText();
|
4
|
+
|
5
|
+
16:17:17.296 INFO - Executing: [execute async script: try { return (function (attempts, asyncCallback) {
|
6
|
+
var callback = function(args) {
|
7
|
+
setTimeout(function() {
|
8
|
+
asyncCallback(args);
|
9
|
+
}, 0);
|
10
|
+
};
|
11
|
+
var check = function(n) {
|
12
|
+
try {
|
13
|
+
if (window.angular && window.angular.resumeBootstrap) {
|
14
|
+
callback([true, null]);
|
15
|
+
} else if (n < 1) {
|
16
|
+
if (window.angular) {
|
17
|
+
callback([false, 'angular never provided resumeBootstrap']);
|
18
|
+
} else {
|
19
|
+
callback([false, 'retries looking for angular exceeded']);
|
20
|
+
}
|
21
|
+
} else {
|
22
|
+
window.setTimeout(function() {check(n - 1);}, 1000);
|
23
|
+
}
|
24
|
+
} catch (e) {
|
25
|
+
callback([false, e]);
|
26
|
+
}
|
27
|
+
};
|
28
|
+
check(attempts);
|
29
|
+
}).apply(this, arguments); }
|
30
|
+
catch(e) { throw (e instanceof Error) ? e : new Error(e); }, [10]])
|
31
|
+
16:17:17.350 INFO - Done: [execute async script: try { return (function (attempts, asyncCallback) {
|
32
|
+
var callback = function(args) {
|
33
|
+
setTimeout(function() {
|
34
|
+
asyncCallback(args);
|
35
|
+
}, 0);
|
36
|
+
};
|
37
|
+
var check = function(n) {
|
38
|
+
try {
|
39
|
+
if (window.angular && window.angular.resumeBootstrap) {
|
40
|
+
callback([true, null]);
|
41
|
+
} else if (n < 1) {
|
42
|
+
if (window.angular) {
|
43
|
+
callback([false, 'angular never provided resumeBootstrap']);
|
44
|
+
} else {
|
45
|
+
callback([false, 'retries looking for angular exceeded']);
|
46
|
+
}
|
47
|
+
} else {
|
48
|
+
window.setTimeout(function() {check(n - 1);}, 1000);
|
49
|
+
}
|
50
|
+
} catch (e) {
|
51
|
+
callback([false, e]);
|
52
|
+
}
|
53
|
+
};
|
54
|
+
check(attempts);
|
55
|
+
}).apply(this, arguments); }
|
56
|
+
catch(e) { throw (e instanceof Error) ? e : new Error(e); }, [10]]
|
57
|
+
16:17:17.369 INFO - Executing: [execute script: return (function () {
|
58
|
+
angular.module('protractorBaseModule_', []).
|
59
|
+
config(['$compileProvider', function($compileProvider) {
|
60
|
+
if ($compileProvider.debugInfoEnabled) {
|
61
|
+
$compileProvider.debugInfoEnabled(true);
|
62
|
+
}
|
63
|
+
}]);
|
64
|
+
}).apply(null, arguments);, []])
|
65
|
+
16:17:17.420 INFO - Done: [execute script: return (function () {
|
66
|
+
angular.module('protractorBaseModule_', []).
|
67
|
+
config(['$compileProvider', function($compileProvider) {
|
68
|
+
if ($compileProvider.debugInfoEnabled) {
|
69
|
+
$compileProvider.debugInfoEnabled(true);
|
70
|
+
}
|
71
|
+
}]);
|
72
|
+
}).apply(null, arguments);, []]
|
73
|
+
16:17:17.446 INFO - Executing: [execute script: angular.resumeBootstrap(arguments[0]);, [[protractorBaseModule_]]])
|
74
|
+
16:17:17.525 INFO - Done: [execute script: angular.resumeBootstrap(arguments[0]);, [[protractorBaseModule_]]]
|
75
|
+
16:17:18.682 INFO - Executing: [execute script: , []])
|
76
|
+
16:17:18.682 INFO - Executing: [execute async script: try { return (function (rootSelector, callback) {
|
77
|
+
var el = document.querySelector(rootSelector);
|
78
|
+
|
79
|
+
try {
|
80
|
+
if (!window.angular) {
|
81
|
+
throw new Error('angular could not be found on the window');
|
82
|
+
}
|
83
|
+
if (angular.getTestability) {
|
84
|
+
angular.getTestability(el).whenStable(callback);
|
85
|
+
} else {
|
86
|
+
if (!angular.element(el).injector()) {
|
87
|
+
throw new Error('root element (' + rootSelector + ') has no injector.' +
|
88
|
+
' this may mean it is not inside ng-app.');
|
89
|
+
}
|
90
|
+
angular.element(el).injector().get('$browser').
|
91
|
+
notifyWhenNoOutstandingRequests(callback);
|
92
|
+
}
|
93
|
+
} catch (err) {
|
94
|
+
callback(err.message);
|
95
|
+
}
|
96
|
+
}).apply(this, arguments); }
|
97
|
+
catch(e) { throw (e instanceof Error) ? e : new Error(e); }, [body]])
|
98
|
+
16:17:18.703 INFO - Done: [execute script: , []]
|
99
|
+
16:17:18.763 INFO - Done: [execute async script: try { return (function (rootSelector, callback) {
|
100
|
+
var el = document.querySelector(rootSelector);
|
101
|
+
|
102
|
+
try {
|
103
|
+
if (!window.angular) {
|
104
|
+
throw new Error('angular could not be found on the window');
|
105
|
+
}
|
106
|
+
if (angular.getTestability) {
|
107
|
+
angular.getTestability(el).whenStable(callback);
|
108
|
+
} else {
|
109
|
+
if (!angular.element(el).injector()) {
|
110
|
+
throw new Error('root element (' + rootSelector + ') has no injector.' +
|
111
|
+
' this may mean it is not inside ng-app.');
|
112
|
+
}
|
113
|
+
angular.element(el).injector().get('$browser').
|
114
|
+
notifyWhenNoOutstandingRequests(callback);
|
115
|
+
}
|
116
|
+
} catch (err) {
|
117
|
+
callback(err.message);
|
118
|
+
}
|
119
|
+
}).apply(this, arguments); }
|
120
|
+
catch(e) { throw (e instanceof Error) ? e : new Error(e); }, [body]]
|
121
|
+
16:17:18.782 INFO - Executing: [execute script: try { return (function (repeater, exact, binding, using, rootSelector) {
|
122
|
+
function repeaterMatch(ngRepeat, repeater, exact) {
|
123
|
+
if (exact) {
|
124
|
+
return ngRepeat.split(' track by ')[0].split(' as ')[0].split('|')[0].
|
125
|
+
trim() == repeater;
|
126
|
+
} else {
|
127
|
+
return ngRepeat.indexOf(repeater) != -1;
|
128
|
+
}
|
129
|
+
}
|
130
|
+
|
131
|
+
var matches = [];
|
132
|
+
var root = document.querySelector(rootSelector || 'body');
|
133
|
+
using = using || document;
|
134
|
+
|
135
|
+
var rows = [];
|
136
|
+
var prefixes = ['ng-', 'ng_', 'data-ng-', 'x-ng-', 'ng\\:'];
|
137
|
+
for (var p = 0; p < prefixes.length; ++p) {
|
138
|
+
var attr = prefixes[p] + 'repeat';
|
139
|
+
var repeatElems = using.querySelectorAll('[' + attr + ']');
|
140
|
+
attr = attr.replace(/\\/g, '');
|
141
|
+
for (var i = 0; i < repeatElems.length; ++i) {
|
142
|
+
if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {
|
143
|
+
rows.push(repeatElems[i]);
|
144
|
+
}
|
145
|
+
}
|
146
|
+
}
|
147
|
+
/* multiRows is an array of arrays, where each inner array contains
|
148
|
+
one row of elements. */
|
149
|
+
var multiRows = [];
|
150
|
+
for (var p = 0; p < prefixes.length; ++p) {
|
151
|
+
var attr = prefixes[p] + 'repeat-start';
|
152
|
+
var repeatElems = using.querySelectorAll('[' + attr + ']');
|
153
|
+
attr = attr.replace(/\\/g, '');
|
154
|
+
for (var i = 0; i < repeatElems.length; ++i) {
|
155
|
+
if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {
|
156
|
+
var elem = repeatElems[i];
|
157
|
+
var row = [];
|
158
|
+
while (elem.nodeType != 8 || (elem.nodeValue &&
|
159
|
+
!repeaterMatch(elem.nodeValue, repeater, exact))) {
|
160
|
+
if (elem.nodeType == 1) {
|
161
|
+
row.push(elem);
|
162
|
+
}
|
163
|
+
elem = elem.nextSibling;
|
164
|
+
}
|
165
|
+
multiRows.push(row);
|
166
|
+
}
|
167
|
+
}
|
168
|
+
}
|
169
|
+
var bindings = [];
|
170
|
+
for (var i = 0; i < rows.length; ++i) {
|
171
|
+
if (angular.getTestability) {
|
172
|
+
matches.push.apply(
|
173
|
+
matches,
|
174
|
+
angular.getTestability(root).findBindings(rows[i], binding));
|
175
|
+
} else {
|
176
|
+
if (rows[i].className.indexOf('ng-binding') != -1) {
|
177
|
+
bindings.push(rows[i]);
|
178
|
+
}
|
179
|
+
var childBindings = rows[i].getElementsByClassName('ng-binding');
|
180
|
+
for (var k = 0; k < childBindings.length; ++k) {
|
181
|
+
bindings.push(childBindings[k]);
|
182
|
+
}
|
183
|
+
}
|
184
|
+
}
|
185
|
+
for (var i = 0; i < multiRows.length; ++i) {
|
186
|
+
for (var j = 0; j < multiRows[i].length; ++j) {
|
187
|
+
if (angular.getTestability) {
|
188
|
+
matches.push.apply(
|
189
|
+
matches,
|
190
|
+
angular.getTestability(root).findBindings(multiRows[i][j], binding));
|
191
|
+
} else {
|
192
|
+
var elem = multiRows[i][j];
|
193
|
+
if (elem.className.indexOf('ng-binding') != -1) {
|
194
|
+
bindings.push(elem);
|
195
|
+
}
|
196
|
+
var childBindings = elem.getElementsByClassName('ng-binding');
|
197
|
+
for (var k = 0; k < childBindings.length; ++k) {
|
198
|
+
bindings.push(childBindings[k]);
|
199
|
+
}
|
200
|
+
}
|
201
|
+
}
|
202
|
+
}
|
203
|
+
for (var j = 0; j < bindings.length; ++j) {
|
204
|
+
var dataBinding = angular.element(bindings[j]).data('$binding');
|
205
|
+
if (dataBinding) {
|
206
|
+
var bindingName = dataBinding.exp || dataBinding[0].exp || dataBinding;
|
207
|
+
if (bindingName.indexOf(binding) != -1) {
|
208
|
+
matches.push(bindings[j]);
|
209
|
+
}
|
210
|
+
}
|
211
|
+
}
|
212
|
+
return matches;
|
213
|
+
}).apply(this, arguments); }
|
214
|
+
catch(e) { throw (e instanceof Error) ? e : new Error(e); }, [baz in days, false, b, null, body]])
|
215
|
+
16:17:18.876 INFO - Done: [execute script: try { return (function (repeater, exact, binding, using, rootSelector) {
|
216
|
+
function repeaterMatch(ngRepeat, repeater, exact) {
|
217
|
+
if (exact) {
|
218
|
+
return ngRepeat.split(' track by ')[0].split(' as ')[0].split('|')[0].
|
219
|
+
trim() == repeater;
|
220
|
+
} else {
|
221
|
+
return ngRepeat.indexOf(repeater) != -1;
|
222
|
+
}
|
223
|
+
}
|
224
|
+
|
225
|
+
var matches = [];
|
226
|
+
var root = document.querySelector(rootSelector || 'body');
|
227
|
+
using = using || document;
|
228
|
+
|
229
|
+
var rows = [];
|
230
|
+
var prefixes = ['ng-', 'ng_', 'data-ng-', 'x-ng-', 'ng\\:'];
|
231
|
+
for (var p = 0; p < prefixes.length; ++p) {
|
232
|
+
var attr = prefixes[p] + 'repeat';
|
233
|
+
var repeatElems = using.querySelectorAll('[' + attr + ']');
|
234
|
+
attr = attr.replace(/\\/g, '');
|
235
|
+
for (var i = 0; i < repeatElems.length; ++i) {
|
236
|
+
if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {
|
237
|
+
rows.push(repeatElems[i]);
|
238
|
+
}
|
239
|
+
}
|
240
|
+
}
|
241
|
+
/* multiRows is an array of arrays, where each inner array contains
|
242
|
+
one row of elements. */
|
243
|
+
var multiRows = [];
|
244
|
+
for (var p = 0; p < prefixes.length; ++p) {
|
245
|
+
var attr = prefixes[p] + 'repeat-start';
|
246
|
+
var repeatElems = using.querySelectorAll('[' + attr + ']');
|
247
|
+
attr = attr.replace(/\\/g, '');
|
248
|
+
for (var i = 0; i < repeatElems.length; ++i) {
|
249
|
+
if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {
|
250
|
+
var elem = repeatElems[i];
|
251
|
+
var row = [];
|
252
|
+
while (elem.nodeType != 8 || (elem.nodeValue &&
|
253
|
+
!repeaterMatch(elem.nodeValue, repeater, exact))) {
|
254
|
+
if (elem.nodeType == 1) {
|
255
|
+
row.push(elem);
|
256
|
+
}
|
257
|
+
elem = elem.nextSibling;
|
258
|
+
}
|
259
|
+
multiRows.push(row);
|
260
|
+
}
|
261
|
+
}
|
262
|
+
}
|
263
|
+
var bindings = [];
|
264
|
+
for (var i = 0; i < rows.length; ++i) {
|
265
|
+
if (angular.getTestability) {
|
266
|
+
matches.push.apply(
|
267
|
+
matches,
|
268
|
+
angular.getTestability(root).findBindings(rows[i], binding));
|
269
|
+
} else {
|
270
|
+
if (rows[i].className.indexOf('ng-binding') != -1) {
|
271
|
+
bindings.push(rows[i]);
|
272
|
+
}
|
273
|
+
var childBindings = rows[i].getElementsByClassName('ng-binding');
|
274
|
+
for (var k = 0; k < childBindings.length; ++k) {
|
275
|
+
bindings.push(childBindings[k]);
|
276
|
+
}
|
277
|
+
}
|
278
|
+
}
|
279
|
+
for (var i = 0; i < multiRows.length; ++i) {
|
280
|
+
for (var j = 0; j < multiRows[i].length; ++j) {
|
281
|
+
if (angular.getTestability) {
|
282
|
+
matches.push.apply(
|
283
|
+
matches,
|
284
|
+
angular.getTestability(root).findBindings(multiRows[i][j], binding));
|
285
|
+
} else {
|
286
|
+
var elem = multiRows[i][j];
|
287
|
+
if (elem.className.indexOf('ng-binding') != -1) {
|
288
|
+
bindings.push(elem);
|
289
|
+
}
|
290
|
+
var childBindings = elem.getElementsByClassName('ng-binding');
|
291
|
+
for (var k = 0; k < childBindings.length; ++k) {
|
292
|
+
bindings.push(childBindings[k]);
|
293
|
+
}
|
294
|
+
}
|
295
|
+
}
|
296
|
+
}
|
297
|
+
for (var j = 0; j < bindings.length; ++j) {
|
298
|
+
var dataBinding = angular.element(bindings[j]).data('$binding');
|
299
|
+
if (dataBinding) {
|
300
|
+
var bindingName = dataBinding.exp || dataBinding[0].exp || dataBinding;
|
301
|
+
if (bindingName.indexOf(binding) != -1) {
|
302
|
+
matches.push(bindings[j]);
|
303
|
+
}
|
304
|
+
}
|
305
|
+
}
|
306
|
+
return matches;
|
307
|
+
}).apply(this, arguments); }
|
308
|
+
catch(e) { throw (e instanceof Error) ? e : new Error(e); }, [baz in days, false, b, null, body]]
|
309
|
+
16:17:18.892 INFO - Executing: [get text: 0 [org.openqa.selenium.remote.RemoteWebElement@9bad693c -> unknown locator]])
|
310
|
+
16:17:18.943 INFO - Done: [get text: 0 [org.openqa.selenium.remote.RemoteWebElement@9bad693c -> unknown locator]]
|
@@ -0,0 +1,152 @@
|
|
1
|
+
browser.get('http://localhost:8081/#/repeater')
|
2
|
+
var partialMatch = element(by.repeater('baz in days').row(0).column('b'));
|
3
|
+
partialMatch.getText()
|
4
|
+
|
5
|
+
// wait for angular
|
6
|
+
15:59:03.466 INFO - Executing: [execute async script: try { return (function (rootSelector, callback) {
|
7
|
+
var el = document.querySelector(rootSelector);
|
8
|
+
|
9
|
+
try {
|
10
|
+
if (!window.angular) {
|
11
|
+
throw new Error('angular could not be found on the window');
|
12
|
+
}
|
13
|
+
if (angular.getTestability) {
|
14
|
+
angular.getTestability(el).whenStable(callback);
|
15
|
+
} else {
|
16
|
+
if (!angular.element(el).injector()) {
|
17
|
+
throw new Error('root element (' + rootSelector + ') has no injector.' +
|
18
|
+
' this may mean it is not inside ng-app.');
|
19
|
+
}
|
20
|
+
angular.element(el).injector().get('$browser').
|
21
|
+
notifyWhenNoOutstandingRequests(callback);
|
22
|
+
}
|
23
|
+
} catch (err) {
|
24
|
+
callback(err.message);
|
25
|
+
}
|
26
|
+
}).apply(this, arguments); }
|
27
|
+
catch(e) { throw (e instanceof Error) ? e : new Error(e); }, [body]])
|
28
|
+
15:59:03.467 INFO - Executing: [execute script: , []])
|
29
|
+
15:59:08.146 INFO - Done: [execute async script: try { return (function (rootSelector, callback) {
|
30
|
+
var el = document.querySelector(rootSelector);
|
31
|
+
|
32
|
+
try {
|
33
|
+
if (!window.angular) {
|
34
|
+
throw new Error('angular could not be found on the window');
|
35
|
+
}
|
36
|
+
if (angular.getTestability) {
|
37
|
+
angular.getTestability(el).whenStable(callback);
|
38
|
+
} else {
|
39
|
+
if (!angular.element(el).injector()) {
|
40
|
+
throw new Error('root element (' + rootSelector + ') has no injector.' +
|
41
|
+
' this may mean it is not inside ng-app.');
|
42
|
+
}
|
43
|
+
angular.element(el).injector().get('$browser').
|
44
|
+
notifyWhenNoOutstandingRequests(callback);
|
45
|
+
}
|
46
|
+
} catch (err) {
|
47
|
+
callback(err.message);
|
48
|
+
}
|
49
|
+
}).apply(this, arguments); }
|
50
|
+
catch(e) { throw (e instanceof Error) ? e : new Error(e); }, [body]]
|
51
|
+
|
52
|
+
|
53
|
+
// -- function (repeater, exact, index, binding, using, rootSelector)
|
54
|
+
// -- [baz in days, false, 0, b, null, body]
|
55
|
+
// -- findRepeaterElement client side script
|
56
|
+
15:59:08.177 INFO - Executing: [execute script: try { return (function (repeater, exact, index, binding, using, rootSelector) {
|
57
|
+
function repeaterMatch(ngRepeat, repeater, exact) {
|
58
|
+
if (exact) {
|
59
|
+
return ngRepeat.split(' track by ')[0].split(' as ')[0].split('|')[0].
|
60
|
+
trim() == repeater;
|
61
|
+
} else {
|
62
|
+
return ngRepeat.indexOf(repeater) != -1;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
var matches = [];
|
67
|
+
var root = document.querySelector(rootSelector || 'body');
|
68
|
+
using = using || document;
|
69
|
+
|
70
|
+
var rows = [];
|
71
|
+
var prefixes = ['ng-', 'ng_', 'data-ng-', 'x-ng-', 'ng\\:'];
|
72
|
+
for (var p = 0; p < prefixes.length; ++p) {
|
73
|
+
var attr = prefixes[p] + 'repeat';
|
74
|
+
var repeatElems = using.querySelectorAll('[' + attr + ']');
|
75
|
+
attr = attr.replace(/\\/g, '');
|
76
|
+
for (var i = 0; i < repeatElems.length; ++i) {
|
77
|
+
if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {
|
78
|
+
rows.push(repeatElems[i]);
|
79
|
+
}
|
80
|
+
}
|
81
|
+
}
|
82
|
+
/* multiRows is an array of arrays, where each inner array contains
|
83
|
+
one row of elements. */
|
84
|
+
var multiRows = [];
|
85
|
+
for (var p = 0; p < prefixes.length; ++p) {
|
86
|
+
var attr = prefixes[p] + 'repeat-start';
|
87
|
+
var repeatElems = using.querySelectorAll('[' + attr + ']');
|
88
|
+
attr = attr.replace(/\\/g, '');
|
89
|
+
for (var i = 0; i < repeatElems.length; ++i) {
|
90
|
+
if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {
|
91
|
+
var elem = repeatElems[i];
|
92
|
+
var row = [];
|
93
|
+
while (elem.nodeType != 8 || (elem.nodeValue &&
|
94
|
+
!repeaterMatch(elem.nodeValue, repeater, exact))) {
|
95
|
+
if (elem.nodeType == 1) {
|
96
|
+
row.push(elem);
|
97
|
+
}
|
98
|
+
elem = elem.nextSibling;
|
99
|
+
}
|
100
|
+
multiRows.push(row);
|
101
|
+
}
|
102
|
+
}
|
103
|
+
}
|
104
|
+
var row = rows[index];
|
105
|
+
var multiRow = multiRows[index];
|
106
|
+
var bindings = [];
|
107
|
+
if (row) {
|
108
|
+
if (angular.getTestability) {
|
109
|
+
matches.push.apply(
|
110
|
+
matches,
|
111
|
+
angular.getTestability(root).findBindings(row, binding));
|
112
|
+
} else {
|
113
|
+
if (row.className.indexOf('ng-binding') != -1) {
|
114
|
+
bindings.push(row);
|
115
|
+
}
|
116
|
+
var childBindings = row.getElementsByClassName('ng-binding');
|
117
|
+
for (var i = 0; i < childBindings.length; ++i) {
|
118
|
+
bindings.push(childBindings[i]);
|
119
|
+
}
|
120
|
+
}
|
121
|
+
}
|
122
|
+
if (multiRow) {
|
123
|
+
for (var i = 0; i < multiRow.length; ++i) {
|
124
|
+
var rowElem = multiRow[i];
|
125
|
+
if (angular.getTestability) {
|
126
|
+
matches.push.apply(
|
127
|
+
matches,
|
128
|
+
angular.getTestability(root).findBindings(rowElem, binding));
|
129
|
+
} else {
|
130
|
+
if (rowElem.className.indexOf('ng-binding') != -1) {
|
131
|
+
bindings.push(rowElem);
|
132
|
+
}
|
133
|
+
var childBindings = rowElem.getElementsByClassName('ng-binding');
|
134
|
+
for (var j = 0; j < childBindings.length; ++j) {
|
135
|
+
bindings.push(childBindings[j]);
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}
|
139
|
+
}
|
140
|
+
for (var i = 0; i < bindings.length; ++i) {
|
141
|
+
var dataBinding = angular.element(bindings[i]).data('$binding');
|
142
|
+
if (dataBinding) {
|
143
|
+
var bindingName = dataBinding.exp || dataBinding[0].exp || dataBinding;
|
144
|
+
if (bindingName.indexOf(binding) != -1) {
|
145
|
+
matches.push(bindings[i]);
|
146
|
+
}
|
147
|
+
}
|
148
|
+
}
|
149
|
+
return matches;
|
150
|
+
}).apply(this, arguments); }
|
151
|
+
catch(e) { throw (e instanceof Error) ? e : new Error(e); }, [baz in days, false, 0, b, null, body]])
|
152
|
+
|
@@ -0,0 +1,146 @@
|
|
1
|
+
browser.get('http://localhost:8081/#/repeater')
|
2
|
+
var partialMatch = element(by.repeater('baz in days').row(0).column('b'));
|
3
|
+
partialMatch.getText()
|
4
|
+
|
5
|
+
15:59:03.466 INFO - Executing: [execute async script: try { return (function (rootSelector, callback) {
|
6
|
+
var el = document.querySelector(rootSelector);
|
7
|
+
|
8
|
+
try {
|
9
|
+
if (!window.angular) {
|
10
|
+
throw new Error('angular could not be found on the window');
|
11
|
+
}
|
12
|
+
if (angular.getTestability) {
|
13
|
+
angular.getTestability(el).whenStable(callback);
|
14
|
+
} else {
|
15
|
+
if (!angular.element(el).injector()) {
|
16
|
+
throw new Error('root element (' + rootSelector + ') has no injector.' +
|
17
|
+
' this may mean it is not inside ng-app.');
|
18
|
+
}
|
19
|
+
angular.element(el).injector().get('$browser').
|
20
|
+
notifyWhenNoOutstandingRequests(callback);
|
21
|
+
}
|
22
|
+
} catch (err) {
|
23
|
+
callback(err.message);
|
24
|
+
}
|
25
|
+
}).apply(this, arguments); }
|
26
|
+
catch(e) { throw (e instanceof Error) ? e : new Error(e); }, [body]])
|
27
|
+
15:59:03.467 INFO - Executing: [execute script: , []])
|
28
|
+
15:59:08.146 INFO - Done: [execute async script: try { return (function (rootSelector, callback) {
|
29
|
+
var el = document.querySelector(rootSelector);
|
30
|
+
|
31
|
+
try {
|
32
|
+
if (!window.angular) {
|
33
|
+
throw new Error('angular could not be found on the window');
|
34
|
+
}
|
35
|
+
if (angular.getTestability) {
|
36
|
+
angular.getTestability(el).whenStable(callback);
|
37
|
+
} else {
|
38
|
+
if (!angular.element(el).injector()) {
|
39
|
+
throw new Error('root element (' + rootSelector + ') has no injector.' +
|
40
|
+
' this may mean it is not inside ng-app.');
|
41
|
+
}
|
42
|
+
angular.element(el).injector().get('$browser').
|
43
|
+
notifyWhenNoOutstandingRequests(callback);
|
44
|
+
}
|
45
|
+
} catch (err) {
|
46
|
+
callback(err.message);
|
47
|
+
}
|
48
|
+
}).apply(this, arguments); }
|
49
|
+
catch(e) { throw (e instanceof Error) ? e : new Error(e); }, [body]]
|
50
|
+
15:59:08.177 INFO - Executing: [execute script: try { return (function (repeater, exact, index, binding, using, rootSelector) {
|
51
|
+
function repeaterMatch(ngRepeat, repeater, exact) {
|
52
|
+
if (exact) {
|
53
|
+
return ngRepeat.split(' track by ')[0].split(' as ')[0].split('|')[0].
|
54
|
+
trim() == repeater;
|
55
|
+
} else {
|
56
|
+
return ngRepeat.indexOf(repeater) != -1;
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
var matches = [];
|
61
|
+
var root = document.querySelector(rootSelector || 'body');
|
62
|
+
using = using || document;
|
63
|
+
|
64
|
+
var rows = [];
|
65
|
+
var prefixes = ['ng-', 'ng_', 'data-ng-', 'x-ng-', 'ng\\:'];
|
66
|
+
for (var p = 0; p < prefixes.length; ++p) {
|
67
|
+
var attr = prefixes[p] + 'repeat';
|
68
|
+
var repeatElems = using.querySelectorAll('[' + attr + ']');
|
69
|
+
attr = attr.replace(/\\/g, '');
|
70
|
+
for (var i = 0; i < repeatElems.length; ++i) {
|
71
|
+
if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {
|
72
|
+
rows.push(repeatElems[i]);
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}
|
76
|
+
/* multiRows is an array of arrays, where each inner array contains
|
77
|
+
one row of elements. */
|
78
|
+
var multiRows = [];
|
79
|
+
for (var p = 0; p < prefixes.length; ++p) {
|
80
|
+
var attr = prefixes[p] + 'repeat-start';
|
81
|
+
var repeatElems = using.querySelectorAll('[' + attr + ']');
|
82
|
+
attr = attr.replace(/\\/g, '');
|
83
|
+
for (var i = 0; i < repeatElems.length; ++i) {
|
84
|
+
if (repeaterMatch(repeatElems[i].getAttribute(attr), repeater, exact)) {
|
85
|
+
var elem = repeatElems[i];
|
86
|
+
var row = [];
|
87
|
+
while (elem.nodeType != 8 || (elem.nodeValue &&
|
88
|
+
!repeaterMatch(elem.nodeValue, repeater, exact))) {
|
89
|
+
if (elem.nodeType == 1) {
|
90
|
+
row.push(elem);
|
91
|
+
}
|
92
|
+
elem = elem.nextSibling;
|
93
|
+
}
|
94
|
+
multiRows.push(row);
|
95
|
+
}
|
96
|
+
}
|
97
|
+
}
|
98
|
+
var row = rows[index];
|
99
|
+
var multiRow = multiRows[index];
|
100
|
+
var bindings = [];
|
101
|
+
if (row) {
|
102
|
+
if (angular.getTestability) {
|
103
|
+
matches.push.apply(
|
104
|
+
matches,
|
105
|
+
angular.getTestability(root).findBindings(row, binding));
|
106
|
+
} else {
|
107
|
+
if (row.className.indexOf('ng-binding') != -1) {
|
108
|
+
bindings.push(row);
|
109
|
+
}
|
110
|
+
var childBindings = row.getElementsByClassName('ng-binding');
|
111
|
+
for (var i = 0; i < childBindings.length; ++i) {
|
112
|
+
bindings.push(childBindings[i]);
|
113
|
+
}
|
114
|
+
}
|
115
|
+
}
|
116
|
+
if (multiRow) {
|
117
|
+
for (var i = 0; i < multiRow.length; ++i) {
|
118
|
+
var rowElem = multiRow[i];
|
119
|
+
if (angular.getTestability) {
|
120
|
+
matches.push.apply(
|
121
|
+
matches,
|
122
|
+
angular.getTestability(root).findBindings(rowElem, binding));
|
123
|
+
} else {
|
124
|
+
if (rowElem.className.indexOf('ng-binding') != -1) {
|
125
|
+
bindings.push(rowElem);
|
126
|
+
}
|
127
|
+
var childBindings = rowElem.getElementsByClassName('ng-binding');
|
128
|
+
for (var j = 0; j < childBindings.length; ++j) {
|
129
|
+
bindings.push(childBindings[j]);
|
130
|
+
}
|
131
|
+
}
|
132
|
+
}
|
133
|
+
}
|
134
|
+
for (var i = 0; i < bindings.length; ++i) {
|
135
|
+
var dataBinding = angular.element(bindings[i]).data('$binding');
|
136
|
+
if (dataBinding) {
|
137
|
+
var bindingName = dataBinding.exp || dataBinding[0].exp || dataBinding;
|
138
|
+
if (bindingName.indexOf(binding) != -1) {
|
139
|
+
matches.push(bindings[i]);
|
140
|
+
}
|
141
|
+
}
|
142
|
+
}
|
143
|
+
return matches;
|
144
|
+
}).apply(this, arguments); }
|
145
|
+
catch(e) { throw (e instanceof Error) ? e : new Error(e); }, [baz in days, false, 0, b, null, body]])
|
146
|
+
|