selenium-webdriver 2.43.5 → 2.44.0
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.
- package/CHANGES.md +20 -0
- package/README.md +8 -13
- package/builder.js +4 -3
- package/docs/class_webdriver_Alert.html +6 -6
- package/docs/class_webdriver_AlertPromise.html +6 -6
- package/docs/class_webdriver_UnhandledAlertError.html +4 -4
- package/docs/class_webdriver_WebDriver.html +39 -37
- package/docs/class_webdriver_WebDriver_Logs.html +3 -3
- package/docs/class_webdriver_WebDriver_Navigation.html +5 -5
- package/docs/class_webdriver_WebDriver_Options.html +9 -9
- package/docs/class_webdriver_WebDriver_TargetLocator.html +6 -6
- package/docs/class_webdriver_WebDriver_Timeouts.html +4 -4
- package/docs/class_webdriver_WebDriver_Window.html +6 -6
- package/docs/class_webdriver_WebElement.html +23 -23
- package/docs/class_webdriver_WebElementPromise.html +22 -22
- package/docs/class_webdriver_promise_CancellationError.html +3 -0
- package/docs/class_webdriver_promise_ControlFlow.html +32 -32
- package/docs/class_webdriver_promise_Deferred.html +7 -8
- package/docs/class_webdriver_promise_Frame_.html +14 -30
- package/docs/class_webdriver_promise_Promise.html +2 -2
- package/docs/class_webdriver_promise_Task_.html +12 -12
- package/docs/class_webdriver_until_Condition.html +3 -0
- package/docs/enum_webdriver_Key.html +1 -1
- package/docs/enum_webdriver_promise_ControlFlow_EventType.html +1 -1
- package/docs/enum_webdriver_promise_Deferred_State_.html +1 -1
- package/docs/index.html +8 -13
- package/docs/interface_webdriver_promise_Thenable.html +8 -10
- package/docs/license.html +1 -1
- package/docs/module_selenium-webdriver.html +2 -2
- package/docs/module_selenium-webdriver__base.html +1 -1
- package/docs/module_selenium-webdriver__base_class_Context.html +1 -1
- package/docs/module_selenium-webdriver_builder.html +1 -1
- package/docs/module_selenium-webdriver_builder_class_Builder.html +1 -1
- package/docs/module_selenium-webdriver_chrome.html +1 -1
- package/docs/module_selenium-webdriver_chrome_class_Driver.html +2 -2
- package/docs/module_selenium-webdriver_chrome_class_Options.html +2 -2
- package/docs/module_selenium-webdriver_chrome_class_ServiceBuilder.html +1 -1
- package/docs/module_selenium-webdriver_error.html +1 -1
- package/docs/module_selenium-webdriver_executors.html +1 -1
- package/docs/module_selenium-webdriver_firefox.html +1 -1
- package/docs/module_selenium-webdriver_firefox_binary.html +1 -1
- package/docs/module_selenium-webdriver_firefox_binary_class_Binary.html +1 -1
- package/docs/module_selenium-webdriver_firefox_class_Driver.html +2 -2
- package/docs/module_selenium-webdriver_firefox_class_Options.html +1 -1
- package/docs/module_selenium-webdriver_firefox_extension.html +1 -1
- package/docs/module_selenium-webdriver_firefox_profile.html +1 -1
- package/docs/module_selenium-webdriver_firefox_profile_class_Profile.html +1 -1
- package/docs/module_selenium-webdriver_http.html +1 -1
- package/docs/module_selenium-webdriver_http_class_HttpClient.html +1 -1
- package/docs/module_selenium-webdriver_http_util.html +1 -1
- package/docs/module_selenium-webdriver_io.html +1 -1
- package/docs/module_selenium-webdriver_io_exec.html +1 -1
- package/docs/module_selenium-webdriver_net.html +1 -1
- package/docs/module_selenium-webdriver_net_portprober.html +1 -1
- package/docs/module_selenium-webdriver_phantomjs.html +1 -1
- package/docs/module_selenium-webdriver_phantomjs_class_Driver.html +2 -2
- package/docs/module_selenium-webdriver_proxy.html +1 -1
- package/docs/module_selenium-webdriver_remote.html +1 -1
- package/docs/module_selenium-webdriver_remote_class_DriverService.html +2 -2
- package/docs/module_selenium-webdriver_remote_class_SeleniumServer.html +2 -2
- package/docs/module_selenium-webdriver_testing.html +16 -29
- package/docs/module_selenium-webdriver_testing_assert.html +1 -1
- package/docs/namespace_webdriver_promise.html +18 -20
- package/docs/namespace_webdriver_stacktrace.html +15 -15
- package/docs/namespace_webdriver_until.html +32 -0
- package/docs/source/_base.js.src.html +1 -1
- package/docs/source/builder.js.src.html +1 -1
- package/docs/source/chrome.js.src.html +1 -1
- package/docs/source/error.js.src.html +1 -1
- package/docs/source/executors.js.src.html +1 -1
- package/docs/source/firefox/binary.js.src.html +1 -1
- package/docs/source/firefox/extension.js.src.html +1 -1
- package/docs/source/firefox/index.js.src.html +1 -1
- package/docs/source/firefox/profile.js.src.html +1 -1
- package/docs/source/http/index.js.src.html +1 -1
- package/docs/source/http/util.js.src.html +1 -1
- package/docs/source/index.js.src.html +1 -1
- package/docs/source/io/exec.js.src.html +1 -1
- package/docs/source/io/index.js.src.html +1 -1
- package/docs/source/lib/atoms/error.js.src.html +1 -1
- package/docs/source/lib/atoms/json.js.src.html +1 -1
- package/docs/source/lib/atoms/response.js.src.html +1 -1
- package/docs/source/lib/atoms/userAgent.js.src.html +1 -1
- package/docs/source/lib/goog/array/array.js.src.html +1 -1
- package/docs/source/lib/goog/asserts/asserts.js.src.html +1 -1
- package/docs/source/lib/goog/async/nexttick.js.src.html +1 -1
- package/docs/source/lib/goog/async/run.js.src.html +1 -1
- package/docs/source/lib/goog/base.js.src.html +1 -1
- package/docs/source/lib/goog/debug/debug.js.src.html +1 -1
- package/docs/source/lib/goog/debug/entrypointregistry.js.src.html +1 -1
- package/docs/source/lib/goog/debug/error.js.src.html +1 -1
- package/docs/source/lib/goog/debug/logbuffer.js.src.html +1 -1
- package/docs/source/lib/goog/debug/logger.js.src.html +1 -1
- package/docs/source/lib/goog/debug/logrecord.js.src.html +1 -1
- package/docs/source/lib/goog/deps.js.src.html +1 -1
- package/docs/source/lib/goog/disposable/disposable.js.src.html +1 -1
- package/docs/source/lib/goog/disposable/idisposable.js.src.html +1 -1
- package/docs/source/lib/goog/dom/browserfeature.js.src.html +1 -1
- package/docs/source/lib/goog/dom/dom.js.src.html +1 -1
- package/docs/source/lib/goog/dom/nodetype.js.src.html +1 -1
- package/docs/source/lib/goog/dom/tagname.js.src.html +1 -1
- package/docs/source/lib/goog/dom/vendor.js.src.html +1 -1
- package/docs/source/lib/goog/events/browserevent.js.src.html +1 -1
- package/docs/source/lib/goog/events/browserfeature.js.src.html +1 -1
- package/docs/source/lib/goog/events/event.js.src.html +1 -1
- package/docs/source/lib/goog/events/eventid.js.src.html +1 -1
- package/docs/source/lib/goog/events/events.js.src.html +1 -1
- package/docs/source/lib/goog/events/eventtarget.js.src.html +1 -1
- package/docs/source/lib/goog/events/eventtype.js.src.html +1 -1
- package/docs/source/lib/goog/events/keycodes.js.src.html +1 -1
- package/docs/source/lib/goog/events/listenable.js.src.html +1 -1
- package/docs/source/lib/goog/events/listener.js.src.html +1 -1
- package/docs/source/lib/goog/events/listenermap.js.src.html +1 -1
- package/docs/source/lib/goog/functions/functions.js.src.html +1 -1
- package/docs/source/lib/goog/iter/iter.js.src.html +1 -1
- package/docs/source/lib/goog/json/json.js.src.html +1 -1
- package/docs/source/lib/goog/labs/testing/assertthat.js.src.html +1 -1
- package/docs/source/lib/goog/labs/testing/logicmatcher.js.src.html +1 -1
- package/docs/source/lib/goog/labs/testing/matcher.js.src.html +1 -1
- package/docs/source/lib/goog/labs/testing/numbermatcher.js.src.html +1 -1
- package/docs/source/lib/goog/labs/testing/objectmatcher.js.src.html +1 -1
- package/docs/source/lib/goog/labs/testing/stringmatcher.js.src.html +1 -1
- package/docs/source/lib/goog/labs/useragent/browser.js.src.html +1 -1
- package/docs/source/lib/goog/labs/useragent/engine.js.src.html +1 -1
- package/docs/source/lib/goog/labs/useragent/util.js.src.html +1 -1
- package/docs/source/lib/goog/math/box.js.src.html +1 -1
- package/docs/source/lib/goog/math/coordinate.js.src.html +1 -1
- package/docs/source/lib/goog/math/math.js.src.html +1 -1
- package/docs/source/lib/goog/math/rect.js.src.html +1 -1
- package/docs/source/lib/goog/math/size.js.src.html +1 -1
- package/docs/source/lib/goog/net/wrapperxmlhttpfactory.js.src.html +1 -1
- package/docs/source/lib/goog/net/xhrlike.js.src.html +1 -1
- package/docs/source/lib/goog/net/xmlhttp.js.src.html +1 -1
- package/docs/source/lib/goog/net/xmlhttpfactory.js.src.html +1 -1
- package/docs/source/lib/goog/object/object.js.src.html +1 -1
- package/docs/source/lib/goog/reflect/reflect.js.src.html +1 -1
- package/docs/source/lib/goog/string/string.js.src.html +1 -1
- package/docs/source/lib/goog/structs/collection.js.src.html +1 -1
- package/docs/source/lib/goog/structs/map.js.src.html +1 -1
- package/docs/source/lib/goog/structs/set.js.src.html +1 -1
- package/docs/source/lib/goog/structs/structs.js.src.html +1 -1
- package/docs/source/lib/goog/style/style.js.src.html +1 -1
- package/docs/source/lib/goog/testing/asserts.js.src.html +1 -1
- package/docs/source/lib/goog/testing/asynctestcase.js.src.html +1 -1
- package/docs/source/lib/goog/testing/events/events.js.src.html +1 -1
- package/docs/source/lib/goog/testing/functionmock.js.src.html +1 -1
- package/docs/source/lib/goog/testing/jsunit.js.src.html +1 -1
- package/docs/source/lib/goog/testing/loosemock.js.src.html +1 -1
- package/docs/source/lib/goog/testing/mock.js.src.html +1 -1
- package/docs/source/lib/goog/testing/mockclock.js.src.html +1 -1
- package/docs/source/lib/goog/testing/mockcontrol.js.src.html +1 -1
- package/docs/source/lib/goog/testing/mockinterface.js.src.html +1 -1
- package/docs/source/lib/goog/testing/mockmatchers.js.src.html +1 -1
- package/docs/source/lib/goog/testing/objectpropertystring.js.src.html +1 -1
- package/docs/source/lib/goog/testing/propertyreplacer.js.src.html +1 -1
- package/docs/source/lib/goog/testing/recordfunction.js.src.html +1 -1
- package/docs/source/lib/goog/testing/stacktrace.js.src.html +1 -1
- package/docs/source/lib/goog/testing/strictmock.js.src.html +1 -1
- package/docs/source/lib/goog/testing/testcase.js.src.html +1 -1
- package/docs/source/lib/goog/testing/testrunner.js.src.html +1 -1
- package/docs/source/lib/goog/testing/watchers.js.src.html +1 -1
- package/docs/source/lib/goog/uri/uri.js.src.html +1 -1
- package/docs/source/lib/goog/uri/utils.js.src.html +1 -1
- package/docs/source/lib/goog/useragent/product.js.src.html +1 -1
- package/docs/source/lib/goog/useragent/product_isversion.js.src.html +1 -1
- package/docs/source/lib/goog/useragent/useragent.js.src.html +1 -1
- package/docs/source/lib/webdriver/abstractbuilder.js.src.html +1 -1
- package/docs/source/lib/webdriver/actionsequence.js.src.html +1 -1
- package/docs/source/lib/webdriver/builder.js.src.html +1 -1
- package/docs/source/lib/webdriver/button.js.src.html +1 -1
- package/docs/source/lib/webdriver/capabilities.js.src.html +1 -1
- package/docs/source/lib/webdriver/command.js.src.html +1 -1
- package/docs/source/lib/webdriver/events.js.src.html +1 -1
- package/docs/source/lib/webdriver/firefoxdomexecutor.js.src.html +1 -1
- package/docs/source/lib/webdriver/http/corsclient.js.src.html +1 -1
- package/docs/source/lib/webdriver/http/http.js.src.html +1 -1
- package/docs/source/lib/webdriver/http/xhrclient.js.src.html +1 -1
- package/docs/source/lib/webdriver/key.js.src.html +1 -1
- package/docs/source/lib/webdriver/locators.js.src.html +1 -1
- package/docs/source/lib/webdriver/logging.js.src.html +1 -1
- package/docs/source/lib/webdriver/process.js.src.html +1 -1
- package/docs/source/lib/webdriver/promise.js.src.html +1 -1
- package/docs/source/lib/webdriver/session.js.src.html +1 -1
- package/docs/source/lib/webdriver/stacktrace.js.src.html +1 -1
- package/docs/source/lib/webdriver/testing/asserts.js.src.html +1 -1
- package/docs/source/lib/webdriver/testing/testcase.js.src.html +1 -1
- package/docs/source/lib/webdriver/until.js.src.html +1 -0
- package/docs/source/lib/webdriver/webdriver.js.src.html +1 -1
- package/docs/source/net/index.js.src.html +1 -1
- package/docs/source/net/portprober.js.src.html +1 -1
- package/docs/source/phantomjs.js.src.html +1 -1
- package/docs/source/proxy.js.src.html +1 -1
- package/docs/source/remote/index.js.src.html +1 -1
- package/docs/source/testing/assert.js.src.html +1 -1
- package/docs/source/testing/index.js.src.html +1 -1
- package/docs/types.js +1 -1
- package/example/google_search.js +9 -17
- package/example/google_search_generator.js +6 -7
- package/example/google_search_test.js +10 -18
- package/example/parallel_flows.js +4 -7
- package/index.js +6 -0
- package/lib/firefox/webdriver.xpi +0 -0
- package/lib/goog/deps.js +7 -5
- package/lib/test/index.js +0 -8
- package/lib/webdriver/promise.js +263 -251
- package/lib/webdriver/stacktrace.js +15 -1
- package/lib/webdriver/test/promise_flow_test.js +82 -76
- package/lib/webdriver/test/promise_test.js +22 -62
- package/lib/webdriver/test/stacktrace_test.js +18 -0
- package/lib/webdriver/test/until_test.js +388 -0
- package/lib/webdriver/test/webdriver_test.js +41 -0
- package/lib/webdriver/until.js +408 -0
- package/lib/webdriver/webdriver.js +91 -29
- package/package.json +2 -2
- package/test/element_finding_test.js +6 -6
- package/test/http/util_test.js +4 -5
- package/test/page_loading_test.js +7 -7
- package/test/stale_element_test.js +2 -10
- package/testing/index.js +9 -22
|
@@ -353,7 +353,9 @@ webdriver.stacktrace.V8_LOCATION_PATTERN_ = ' (?:\\((.*)\\)|(.*))';
|
|
|
353
353
|
* @private {!RegExp}
|
|
354
354
|
* @const
|
|
355
355
|
*/
|
|
356
|
-
webdriver.stacktrace.V8_STACK_FRAME_REGEXP_ = new RegExp('
|
|
356
|
+
webdriver.stacktrace.V8_STACK_FRAME_REGEXP_ = new RegExp('^\\s+at' +
|
|
357
|
+
// Prevent intersections with IE10 stack frame regex.
|
|
358
|
+
'(?! (?:Anonymous function|Global code|eval code) )' +
|
|
357
359
|
'(?:' + webdriver.stacktrace.V8_FUNCTION_CALL_PATTERN_ + ')?' +
|
|
358
360
|
webdriver.stacktrace.V8_LOCATION_PATTERN_ + '$');
|
|
359
361
|
|
|
@@ -591,6 +593,18 @@ webdriver.stacktrace.format = function(error) {
|
|
|
591
593
|
var stack = webdriver.stacktrace.getStack_(error);
|
|
592
594
|
var frames = webdriver.stacktrace.parse_(stack);
|
|
593
595
|
|
|
596
|
+
// If the original stack is in an unexpected format, our formatted stack
|
|
597
|
+
// trace will be a bunch of " at <anonymous>" lines. If this is the case,
|
|
598
|
+
// just return the error unmodified to avoid losing information. This is
|
|
599
|
+
// necessary since the user may have defined a custom stack formatter in
|
|
600
|
+
// V8 via Error.prepareStackTrace. See issue 7994.
|
|
601
|
+
var isAnonymousFrame = function(frame) {
|
|
602
|
+
return frame.toString() === ' at <anonymous>';
|
|
603
|
+
};
|
|
604
|
+
if (frames.length && goog.array.every(frames, isAnonymousFrame)) {
|
|
605
|
+
return error;
|
|
606
|
+
}
|
|
607
|
+
|
|
594
608
|
// Older versions of IE simply return [object Error] for toString(), so
|
|
595
609
|
// only use that as a last resort.
|
|
596
610
|
var errorStr = '';
|
|
@@ -183,7 +183,7 @@ function testAddChild_withSubframes() {
|
|
|
183
183
|
assertArrayEquals([task1, frame1], root.children_);
|
|
184
184
|
assertArrayEquals([task2, task3], frame1.children_);
|
|
185
185
|
|
|
186
|
-
frame1.
|
|
186
|
+
frame1.isLocked_ = true;
|
|
187
187
|
var task4 = createTask('task4'), task5 = createTask('task5');
|
|
188
188
|
root.addChild(task4);
|
|
189
189
|
root.addChild(task5);
|
|
@@ -199,9 +199,9 @@ function testAddChild_withSubframes() {
|
|
|
199
199
|
root.addChild(frame2);
|
|
200
200
|
root.addChild(frame3);
|
|
201
201
|
root.addChild(task6);
|
|
202
|
-
frame3.
|
|
202
|
+
frame3.isLocked_ = true;
|
|
203
203
|
root.addChild(task7);
|
|
204
|
-
frame2.
|
|
204
|
+
frame2.isLocked_ = true;
|
|
205
205
|
root.addChild(task8);
|
|
206
206
|
|
|
207
207
|
assertArrayEquals([task1, frame1, task4, task5, frame2, task8],
|
|
@@ -218,11 +218,11 @@ function testAddChild_insertingFramesIntoAnActiveFrame() {
|
|
|
218
218
|
task1 = createTask('task1');
|
|
219
219
|
|
|
220
220
|
root.addChild(task1);
|
|
221
|
-
root.
|
|
221
|
+
root.isLocked_ = true;
|
|
222
222
|
root.addChild(frame2);
|
|
223
|
-
frame2.
|
|
223
|
+
frame2.isLocked_ = true;
|
|
224
224
|
root.addChild(frame3);
|
|
225
|
-
frame3.
|
|
225
|
+
frame3.isLocked_ = true;
|
|
226
226
|
|
|
227
227
|
assertArrayEquals([frame2, frame3, task1], root.children_);
|
|
228
228
|
}
|
|
@@ -248,9 +248,9 @@ function testResolveFrame() {
|
|
|
248
248
|
assertArrayEquals([frame3], frame2.children_);
|
|
249
249
|
assertArrayEquals([frame2], frame1.children_);
|
|
250
250
|
|
|
251
|
-
frame1.
|
|
252
|
-
frame2.
|
|
253
|
-
frame3.
|
|
251
|
+
frame1.close = callbackHelper();
|
|
252
|
+
frame2.close = callbackHelper();
|
|
253
|
+
frame3.close = callbackHelper();
|
|
254
254
|
|
|
255
255
|
var obj = {
|
|
256
256
|
activeFrame_: frame2,
|
|
@@ -260,9 +260,9 @@ function testResolveFrame() {
|
|
|
260
260
|
};
|
|
261
261
|
webdriver.promise.ControlFlow.prototype.resolveFrame_.call(obj, frame3);
|
|
262
262
|
assertEquals(1, obj.trimHistory_.getCallCount());
|
|
263
|
-
frame3.
|
|
264
|
-
frame2.
|
|
265
|
-
frame1.
|
|
263
|
+
frame3.close.assertCalled('frame 3 not resolved');
|
|
264
|
+
frame2.close.assertNotCalled('frame 2 should not be resolved yet');
|
|
265
|
+
frame1.close.assertNotCalled('frame 1 should not be resolved yet');
|
|
266
266
|
assertNull(frame3.getParent());
|
|
267
267
|
assertArrayEquals([], frame2.children_);
|
|
268
268
|
assertArrayEquals([frame2], frame1.children_);
|
|
@@ -270,8 +270,8 @@ function testResolveFrame() {
|
|
|
270
270
|
|
|
271
271
|
webdriver.promise.ControlFlow.prototype.resolveFrame_.call(obj, frame2);
|
|
272
272
|
assertEquals(2, obj.trimHistory_.getCallCount());
|
|
273
|
-
frame2.
|
|
274
|
-
frame1.
|
|
273
|
+
frame2.close.assertCalled('frame 2 not resolved');
|
|
274
|
+
frame1.close.assertNotCalled('frame 1 should not be resolved yet');
|
|
275
275
|
assertNull(frame2.getParent());
|
|
276
276
|
assertArrayEquals([], frame1.children_);
|
|
277
277
|
assertEquals(frame1, obj.activeFrame_);
|
|
@@ -279,7 +279,7 @@ function testResolveFrame() {
|
|
|
279
279
|
obj.commenceShutdown_.assertNotCalled();
|
|
280
280
|
webdriver.promise.ControlFlow.prototype.resolveFrame_.call(obj, frame1);
|
|
281
281
|
assertEquals(3, obj.trimHistory_.getCallCount());
|
|
282
|
-
frame1.
|
|
282
|
+
frame1.close.assertCalled('frame 1 not resolved');
|
|
283
283
|
obj.commenceShutdown_.assertCalled();
|
|
284
284
|
assertNull(frame1.getParent());
|
|
285
285
|
assertNull(obj.activeFrame_);
|
|
@@ -302,10 +302,10 @@ function testGetNextTask() {
|
|
|
302
302
|
task8 = createTask('task8');
|
|
303
303
|
|
|
304
304
|
flow.commenceShutdown_ = callbackHelper();
|
|
305
|
-
root.
|
|
306
|
-
frame1.
|
|
307
|
-
frame2.
|
|
308
|
-
frame3.
|
|
305
|
+
root.close = callbackHelper();
|
|
306
|
+
frame1.close = callbackHelper();
|
|
307
|
+
frame2.close = callbackHelper();
|
|
308
|
+
frame3.close = callbackHelper();
|
|
309
309
|
|
|
310
310
|
root.addChild(task1);
|
|
311
311
|
root.addChild(frame1);
|
|
@@ -314,7 +314,7 @@ function testGetNextTask() {
|
|
|
314
314
|
assertArrayEquals([task1, frame1], root.children_);
|
|
315
315
|
assertArrayEquals([task2, task3], frame1.children_);
|
|
316
316
|
|
|
317
|
-
frame1.
|
|
317
|
+
frame1.isLocked_ = true;
|
|
318
318
|
root.addChild(task4);
|
|
319
319
|
root.addChild(task5);
|
|
320
320
|
assertArrayEquals([task1, frame1, task4, task5], root.children_);
|
|
@@ -324,9 +324,9 @@ function testGetNextTask() {
|
|
|
324
324
|
root.addChild(frame2);
|
|
325
325
|
root.addChild(frame3);
|
|
326
326
|
root.addChild(task6);
|
|
327
|
-
frame3.
|
|
327
|
+
frame3.isLocked_ = true;
|
|
328
328
|
root.addChild(task7);
|
|
329
|
-
frame2.
|
|
329
|
+
frame2.isLocked_ = true;
|
|
330
330
|
root.addChild(task8);
|
|
331
331
|
|
|
332
332
|
assertArrayEquals([task1, frame1, task4, task5, frame2, task8],
|
|
@@ -335,88 +335,79 @@ function testGetNextTask() {
|
|
|
335
335
|
assertArrayEquals([frame3, task7], frame2.children_);
|
|
336
336
|
assertArrayEquals([task6], frame3.children_);
|
|
337
337
|
|
|
338
|
-
assertEquals(root, task1.getParent());
|
|
339
338
|
assertEquals(task1, flow.getNextTask_());
|
|
340
|
-
assertNull(task1.getParent());
|
|
341
339
|
assertEquals(root, flow.activeFrame_);
|
|
342
|
-
root.
|
|
343
|
-
frame1.
|
|
344
|
-
frame2.
|
|
345
|
-
frame3.
|
|
340
|
+
root.close.assertNotCalled();
|
|
341
|
+
frame1.close.assertNotCalled();
|
|
342
|
+
frame2.close.assertNotCalled();
|
|
343
|
+
frame3.close.assertNotCalled();
|
|
346
344
|
|
|
347
345
|
assertEquals(task2, flow.getNextTask_());
|
|
348
|
-
assertNull(task2.getParent());
|
|
349
346
|
assertEquals(frame1, flow.activeFrame_);
|
|
350
|
-
root.
|
|
351
|
-
frame1.
|
|
352
|
-
frame2.
|
|
353
|
-
frame3.
|
|
347
|
+
root.close.assertNotCalled();
|
|
348
|
+
frame1.close.assertNotCalled();
|
|
349
|
+
frame2.close.assertNotCalled();
|
|
350
|
+
frame3.close.assertNotCalled();
|
|
354
351
|
|
|
355
352
|
assertEquals(task3, flow.getNextTask_());
|
|
356
|
-
assertNull(task3.getParent());
|
|
357
353
|
assertEquals(frame1, flow.activeFrame_);
|
|
358
|
-
root.
|
|
359
|
-
frame1.
|
|
360
|
-
frame2.
|
|
361
|
-
frame3.
|
|
354
|
+
root.close.assertNotCalled();
|
|
355
|
+
frame1.close.assertNotCalled();
|
|
356
|
+
frame2.close.assertNotCalled();
|
|
357
|
+
frame3.close.assertNotCalled();
|
|
362
358
|
|
|
363
359
|
assertNull(flow.getNextTask_());
|
|
364
360
|
assertNull(frame1.getParent());
|
|
365
361
|
assertEquals(root, flow.activeFrame_);
|
|
366
|
-
root.
|
|
367
|
-
frame1.
|
|
368
|
-
frame2.
|
|
369
|
-
frame3.
|
|
362
|
+
root.close.assertNotCalled();
|
|
363
|
+
frame1.close.assertCalled();
|
|
364
|
+
frame2.close.assertNotCalled();
|
|
365
|
+
frame3.close.assertNotCalled();
|
|
370
366
|
|
|
371
367
|
assertEquals(task4, flow.getNextTask_());
|
|
372
|
-
assertNull(task4.getParent());
|
|
373
368
|
assertEquals(root, flow.activeFrame_);
|
|
374
|
-
root.
|
|
375
|
-
frame2.
|
|
376
|
-
frame3.
|
|
369
|
+
root.close.assertNotCalled();
|
|
370
|
+
frame2.close.assertNotCalled();
|
|
371
|
+
frame3.close.assertNotCalled();
|
|
377
372
|
|
|
378
373
|
assertEquals(task5, flow.getNextTask_());
|
|
379
|
-
assertNull(task5.getParent());
|
|
380
374
|
assertEquals(root, flow.activeFrame_);
|
|
381
|
-
root.
|
|
382
|
-
frame2.
|
|
383
|
-
frame3.
|
|
375
|
+
root.close.assertNotCalled();
|
|
376
|
+
frame2.close.assertNotCalled();
|
|
377
|
+
frame3.close.assertNotCalled();
|
|
384
378
|
|
|
385
379
|
assertEquals(task6, flow.getNextTask_());
|
|
386
|
-
assertNull(task6.getParent());
|
|
387
380
|
assertEquals(frame3, flow.activeFrame_);
|
|
388
|
-
root.
|
|
389
|
-
frame2.
|
|
390
|
-
frame3.
|
|
381
|
+
root.close.assertNotCalled();
|
|
382
|
+
frame2.close.assertNotCalled();
|
|
383
|
+
frame3.close.assertNotCalled();
|
|
391
384
|
|
|
392
385
|
assertNull(flow.getNextTask_());
|
|
393
386
|
assertNull(frame3.getParent());
|
|
394
387
|
assertEquals(frame2, flow.activeFrame_);
|
|
395
|
-
root.
|
|
396
|
-
frame2.
|
|
397
|
-
frame3.
|
|
388
|
+
root.close.assertNotCalled();
|
|
389
|
+
frame2.close.assertNotCalled();
|
|
390
|
+
frame3.close.assertCalled('frame3 should have been resolved');
|
|
398
391
|
|
|
399
392
|
assertEquals(task7, flow.getNextTask_());
|
|
400
|
-
assertNull(task7.getParent());
|
|
401
393
|
assertEquals(frame2, flow.activeFrame_);
|
|
402
|
-
root.
|
|
403
|
-
frame2.
|
|
394
|
+
root.close.assertNotCalled();
|
|
395
|
+
frame2.close.assertNotCalled();
|
|
404
396
|
|
|
405
397
|
assertNull(flow.getNextTask_());
|
|
406
398
|
assertNull(frame2.getParent());
|
|
407
399
|
assertEquals(root, flow.activeFrame_);
|
|
408
|
-
root.
|
|
409
|
-
frame2.
|
|
400
|
+
root.close.assertNotCalled();
|
|
401
|
+
frame2.close.assertCalled('frame2 should have been resolved');
|
|
410
402
|
|
|
411
403
|
assertEquals(task8, flow.getNextTask_());
|
|
412
|
-
assertNull(task8.getParent());
|
|
413
404
|
assertEquals(root, flow.activeFrame_);
|
|
414
|
-
root.
|
|
405
|
+
root.close.assertNotCalled();
|
|
415
406
|
|
|
416
407
|
flow.commenceShutdown_.assertNotCalled();
|
|
417
408
|
assertNull(flow.getNextTask_());
|
|
418
409
|
assertNull(flow.activeFrame_);
|
|
419
|
-
root.
|
|
410
|
+
root.close.assertCalled('Root should have been resolved');
|
|
420
411
|
flow.commenceShutdown_.assertCalled();
|
|
421
412
|
}
|
|
422
413
|
|
|
@@ -504,14 +495,15 @@ function testAbortFrame_unhandledAbortionsBubbleUp() {
|
|
|
504
495
|
assertNull(flow.activeFrame_);
|
|
505
496
|
flow.abortNow_.assertCalled();
|
|
506
497
|
|
|
507
|
-
function installResolveHelper(
|
|
508
|
-
var
|
|
509
|
-
var
|
|
498
|
+
function installResolveHelper(frame) {
|
|
499
|
+
var abort = goog.bind(frame.abort, frame);
|
|
500
|
+
var close = goog.bind(frame.close, frame);
|
|
501
|
+
var pair = callbackPair(close, function(e) {
|
|
510
502
|
assertIsStubError(e);
|
|
511
|
-
|
|
503
|
+
abort(e);
|
|
512
504
|
});
|
|
513
|
-
|
|
514
|
-
|
|
505
|
+
frame.close = pair.callback;
|
|
506
|
+
frame.abort = pair.errback;
|
|
515
507
|
return pair;
|
|
516
508
|
}
|
|
517
509
|
}
|
|
@@ -667,6 +659,7 @@ function testRunInNewFrame_doesNotReturnUntilScheduledFrameResolved() {
|
|
|
667
659
|
pair.assertNeither('active frame still not resolved yet');
|
|
668
660
|
|
|
669
661
|
assertNull(flow.getNextTask_());
|
|
662
|
+
clock.tick();
|
|
670
663
|
pair.assertCallback();
|
|
671
664
|
assertEquals(root, flow.activeFrame_);
|
|
672
665
|
assertEquals(task2, flow.getNextTask_());
|
|
@@ -693,9 +686,11 @@ function testRunInNewFrame_doesNotReturnUntilScheduledFrameResolved_nested() {
|
|
|
693
686
|
assertEquals('task3', flow.getNextTask_().getDescription());
|
|
694
687
|
assertEquals('task4', flow.getNextTask_().getDescription());
|
|
695
688
|
assertNull(flow.getNextTask_());
|
|
689
|
+
clock.tick();
|
|
696
690
|
pair1.assertNeither();
|
|
697
691
|
pair2.assertCallback();
|
|
698
692
|
assertNull(flow.getNextTask_());
|
|
693
|
+
clock.tick();
|
|
699
694
|
pair1.assertCallback();
|
|
700
695
|
|
|
701
696
|
assertEquals(root, flow.activeFrame_);
|
|
@@ -1372,6 +1367,7 @@ function testWaiting_aConditionThatReturnsATaskResult() {
|
|
|
1372
1367
|
clock.tick(100); // Advance clock for next polling pass.
|
|
1373
1368
|
assertEquals(1, count);
|
|
1374
1369
|
turnEventLoop();
|
|
1370
|
+
clock.tick();
|
|
1375
1371
|
assertEquals(2, count);
|
|
1376
1372
|
turnEventLoop();
|
|
1377
1373
|
assertFlowHistory(
|
|
@@ -1381,6 +1377,7 @@ function testWaiting_aConditionThatReturnsATaskResult() {
|
|
|
1381
1377
|
clock.tick(100); // Advance clock for next polling pass.
|
|
1382
1378
|
assertEquals(2, count);
|
|
1383
1379
|
turnEventLoop();
|
|
1380
|
+
clock.tick();
|
|
1384
1381
|
assertEquals(3, count);
|
|
1385
1382
|
turnEventLoop();
|
|
1386
1383
|
assertFlowHistory(
|
|
@@ -1502,7 +1499,7 @@ function testWaiting_pollingLoopWaitsForAllScheduledTasksInCondition() {
|
|
|
1502
1499
|
scheduleWait(function() {
|
|
1503
1500
|
scheduleAction('increment count', function() { ++count; });
|
|
1504
1501
|
return count >= 3;
|
|
1505
|
-
},
|
|
1502
|
+
}, 350, 'counting to 3');
|
|
1506
1503
|
schedule('post wait');
|
|
1507
1504
|
|
|
1508
1505
|
turnEventLoop();
|
|
@@ -1515,6 +1512,7 @@ function testWaiting_pollingLoopWaitsForAllScheduledTasksInCondition() {
|
|
|
1515
1512
|
clock.tick(100); // Advance clock for next polling pass.
|
|
1516
1513
|
assertEquals(1, count);
|
|
1517
1514
|
turnEventLoop();
|
|
1515
|
+
clock.tick();
|
|
1518
1516
|
assertEquals(2, count);
|
|
1519
1517
|
|
|
1520
1518
|
clock.tick(100); // Advance clock for next polling pass.
|
|
@@ -1799,8 +1797,12 @@ function testEventLoopWaitsOnPendingPromiseRejections_multipleRejections() {
|
|
|
1799
1797
|
}
|
|
1800
1798
|
|
|
1801
1799
|
function testCancelsPromiseReturnedByCallbackIfFrameFails_promiseCallback() {
|
|
1802
|
-
var
|
|
1803
|
-
|
|
1800
|
+
var isCancellationError = function(e) {
|
|
1801
|
+
assertEquals('CancellationError: Error: ouch', e.toString());
|
|
1802
|
+
};
|
|
1803
|
+
|
|
1804
|
+
var chainPair = callbackPair(null, isCancellationError);
|
|
1805
|
+
var deferredPair = callbackPair(null, isCancellationError);
|
|
1804
1806
|
|
|
1805
1807
|
var d = new webdriver.promise.Deferred();
|
|
1806
1808
|
d.then(deferredPair.callback, deferredPair.errback);
|
|
@@ -1820,8 +1822,12 @@ function testCancelsPromiseReturnedByCallbackIfFrameFails_promiseCallback() {
|
|
|
1820
1822
|
}
|
|
1821
1823
|
|
|
1822
1824
|
function testCancelsPromiseReturnedByCallbackIfFrameFails_taskCallback() {
|
|
1823
|
-
var
|
|
1824
|
-
|
|
1825
|
+
var isCancellationError = function(e) {
|
|
1826
|
+
assertEquals('CancellationError: Error: ouch', e.toString());
|
|
1827
|
+
};
|
|
1828
|
+
|
|
1829
|
+
var chainPair = callbackPair(null, isCancellationError);
|
|
1830
|
+
var deferredPair = callbackPair(null, isCancellationError);
|
|
1825
1831
|
|
|
1826
1832
|
var d = new webdriver.promise.Deferred();
|
|
1827
1833
|
d.then(deferredPair.callback, deferredPair.errback);
|
|
@@ -341,7 +341,10 @@ function testWhen_WaitsForValueToBeResolvedBeforeInvokingCallback() {
|
|
|
341
341
|
|
|
342
342
|
|
|
343
343
|
function testWhen_canCancelReturnedPromise() {
|
|
344
|
-
var callbacks = callbackPair(null,
|
|
344
|
+
var callbacks = callbackPair(null, function(e) {
|
|
345
|
+
assertTrue(e instanceof webdriver.promise.CancellationError);
|
|
346
|
+
assertEquals('just because', e.message);
|
|
347
|
+
});
|
|
345
348
|
|
|
346
349
|
var promiseLike = {
|
|
347
350
|
then: function(cb, eb) {
|
|
@@ -354,7 +357,7 @@ function testWhen_canCancelReturnedPromise() {
|
|
|
354
357
|
callbacks.callback, callbacks.errback);
|
|
355
358
|
|
|
356
359
|
assertTrue(promise.isPending());
|
|
357
|
-
promise.cancel(
|
|
360
|
+
promise.cancel('just because');
|
|
358
361
|
callbacks.assertErrback();
|
|
359
362
|
|
|
360
363
|
// The following should have no effect.
|
|
@@ -1044,84 +1047,47 @@ function testCheckedNodeCall_functionThrowsAndReturns() {
|
|
|
1044
1047
|
|
|
1045
1048
|
|
|
1046
1049
|
function testCancel_passesTheCancellationReasonToReject() {
|
|
1047
|
-
var pair = callbackPair(null,
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
d.cancel(STUB_ERROR);
|
|
1051
|
-
pair.assertErrback();
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
function testCancel_invokesTheCancellerFunctionIfOneWasProvided() {
|
|
1056
|
-
var pair = callbackPair(null, assertIsStubError);
|
|
1057
|
-
var callback = callbackHelper();
|
|
1058
|
-
var d = new webdriver.promise.Deferred(callback);
|
|
1059
|
-
d.then(pair.callback, pair.errback);
|
|
1060
|
-
d.cancel(STUB_ERROR);
|
|
1061
|
-
pair.assertErrback();
|
|
1062
|
-
callback.assertCalled();
|
|
1063
|
-
}
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
function testCancel_canChangeRejectionReasonWithTruthyCancellerReturnValue() {
|
|
1067
|
-
var pair = callbackPair(null, assertIsStubError);
|
|
1068
|
-
var callback = callbackHelper(function() {
|
|
1069
|
-
return STUB_ERROR;
|
|
1050
|
+
var pair = callbackPair(null, function(e) {
|
|
1051
|
+
assertTrue(e instanceof webdriver.promise.CancellationError);
|
|
1052
|
+
assertEquals('because i said so', e.message);
|
|
1070
1053
|
});
|
|
1071
|
-
var d = new webdriver.promise.Deferred(
|
|
1054
|
+
var d = new webdriver.promise.Deferred();
|
|
1072
1055
|
d.then(pair.callback, pair.errback);
|
|
1073
|
-
d.cancel();
|
|
1056
|
+
d.cancel('because i said so');
|
|
1074
1057
|
pair.assertErrback();
|
|
1075
|
-
callback.assertCalled();
|
|
1076
1058
|
}
|
|
1077
1059
|
|
|
1078
1060
|
|
|
1079
1061
|
function testCancel_canCancelADeferredFromAChainedPromise() {
|
|
1080
|
-
var pair1 = callbackPair(null,
|
|
1081
|
-
|
|
1062
|
+
var pair1 = callbackPair(null, function(e) {
|
|
1063
|
+
assertTrue(e instanceof webdriver.promise.CancellationError);
|
|
1064
|
+
assertEquals('because i said so', e.message);
|
|
1065
|
+
});
|
|
1066
|
+
var pair2 = callbackPair();
|
|
1082
1067
|
|
|
1083
1068
|
var d = new webdriver.promise.Deferred();
|
|
1084
1069
|
var p = d.then(pair1.callback, pair1.errback);
|
|
1085
1070
|
p.then(pair2.callback, pair2.errback);
|
|
1086
1071
|
|
|
1087
|
-
p.cancel(
|
|
1072
|
+
p.cancel('because i said so');
|
|
1088
1073
|
pair1.assertErrback('The first errback should have fired.');
|
|
1089
1074
|
pair2.assertCallback();
|
|
1090
1075
|
}
|
|
1091
1076
|
|
|
1092
1077
|
|
|
1093
1078
|
function testCancel_canCancelATimeout() {
|
|
1094
|
-
var pair = callbackPair(null,
|
|
1079
|
+
var pair = callbackPair(null, function(e) {
|
|
1080
|
+
assertTrue(e instanceof webdriver.promise.CancellationError);
|
|
1081
|
+
});
|
|
1095
1082
|
var p = webdriver.promise.delayed(250).
|
|
1096
1083
|
then(pair.callback, pair.errback);
|
|
1097
|
-
p.cancel(
|
|
1084
|
+
p.cancel();
|
|
1098
1085
|
pair.assertErrback();
|
|
1099
1086
|
clock.tick(250); // Just to make sure nothing happens.
|
|
1100
1087
|
pair.assertErrback();
|
|
1101
1088
|
}
|
|
1102
1089
|
|
|
1103
1090
|
|
|
1104
|
-
function testCancel_cannotCancelACheckedNodeCall() {
|
|
1105
|
-
var d = webdriver.promise.checkedNodeCall(goog.nullFunction);
|
|
1106
|
-
assertThrows(d.cancel);
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
function testCancel_cancellerFunctionExplicityResolvesPromise() {
|
|
1111
|
-
var pair = callbackPair(goog.partial(assertEquals, 123));
|
|
1112
|
-
var canceller;
|
|
1113
|
-
var d = new webdriver.promise.Deferred(
|
|
1114
|
-
canceller = callbackHelper(function(e) {
|
|
1115
|
-
assertIsStubError(e);
|
|
1116
|
-
d.fulfill(123);
|
|
1117
|
-
}));
|
|
1118
|
-
d.then(pair.callback, pair.errback);
|
|
1119
|
-
d.cancel(STUB_ERROR);
|
|
1120
|
-
canceller.assertCalled();
|
|
1121
|
-
pair.assertCallback();
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
1091
|
function testCancel_cancelIsANoopOnceAPromiseHasBeenFulfilled() {
|
|
1126
1092
|
var p = webdriver.promise.fulfilled(123);
|
|
1127
1093
|
p.cancel();
|
|
@@ -1151,12 +1117,6 @@ function testCancel_noopCancelTriggeredOnCallbackOfResolvedPromise() {
|
|
|
1151
1117
|
}
|
|
1152
1118
|
|
|
1153
1119
|
|
|
1154
|
-
function testCancel_cancellerCanForbidCancellation() {
|
|
1155
|
-
var d = new webdriver.promise.Deferred(throwStubError);
|
|
1156
|
-
assertThrows(d.cancel);
|
|
1157
|
-
}
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
1120
|
function testCallbackRegistersAnotherListener_callbacksConfiguredPreResolve() {
|
|
1161
1121
|
var messages = [];
|
|
1162
1122
|
var d = new webdriver.promise.Deferred();
|
|
@@ -1239,11 +1199,11 @@ function testResolvedReturnsInputValueIfItIsAPromise() {
|
|
|
1239
1199
|
|
|
1240
1200
|
function testADeferredsParentControlFlowIsActiveForCallbacks() {
|
|
1241
1201
|
var flow = new webdriver.promise.ControlFlow();
|
|
1242
|
-
var d = new webdriver.promise.Deferred(
|
|
1202
|
+
var d = new webdriver.promise.Deferred(flow);
|
|
1243
1203
|
d.fulfill();
|
|
1244
1204
|
|
|
1245
1205
|
var flow2 = new webdriver.promise.ControlFlow();
|
|
1246
|
-
var d2 = new webdriver.promise.Deferred(
|
|
1206
|
+
var d2 = new webdriver.promise.Deferred(flow2);
|
|
1247
1207
|
d2.fulfill();
|
|
1248
1208
|
|
|
1249
1209
|
assertIsFlow(webdriver.promise.defaultFlow_)();
|
|
@@ -165,6 +165,11 @@ function testParseStackFrameInV8() {
|
|
|
165
165
|
' at Object.assert (http://bar:4000/bar.js?value=(a):150:3)',
|
|
166
166
|
new webdriver.stacktrace.Frame('Object', 'assert', '',
|
|
167
167
|
'http://bar:4000/bar.js?value=(a):150:3'));
|
|
168
|
+
|
|
169
|
+
assertStackFrame('Frame with non-standard leading whitespace (issue 7994)',
|
|
170
|
+
' at module.exports.runCucumber (/local/dir/path)',
|
|
171
|
+
new webdriver.stacktrace.Frame('module.exports', 'runCucumber', '',
|
|
172
|
+
'/local/dir/path'));
|
|
168
173
|
}
|
|
169
174
|
|
|
170
175
|
function testParseStackFrameInOpera() {
|
|
@@ -468,6 +473,19 @@ function testFormatsUsingNameAndMessageIfAvailable() {
|
|
|
468
473
|
assertEquals('TypeError: boom\n', ret.stack);
|
|
469
474
|
}
|
|
470
475
|
|
|
476
|
+
function testDoesNotFormatErrorIfOriginalStacktraceIsInAnUnexpectedFormat() {
|
|
477
|
+
var error = Error('testing');
|
|
478
|
+
var stack = error.stack = [
|
|
479
|
+
'Error: testing',
|
|
480
|
+
'..> at Color.red (http://x:1234)',
|
|
481
|
+
'..> at Foo.bar (http://y:5678)'
|
|
482
|
+
].join('\n');
|
|
483
|
+
|
|
484
|
+
var ret = webdriver.stacktrace.format(error);
|
|
485
|
+
assertEquals(ret, error);
|
|
486
|
+
assertEquals(stack, error.stack);
|
|
487
|
+
}
|
|
488
|
+
|
|
471
489
|
function testParseStackFrameInIE10() {
|
|
472
490
|
assertStackFrame('name and path',
|
|
473
491
|
' at foo (http://bar:4000/bar.js:150:3)',
|