@@ -320,9 +320,42 @@ var Protractor = function(webdriver, opt_baseUrl, opt_rootElement) {
320
320
}
321
321
}
322
322
323
+ /**
324
+ * The wrapped webdriver instance. Use this to interact with pages that do
325
+ * not contain Angular (such as a log-in screen).
326
+ *
327
+ * @type {webdriver.WebDriver }
328
+ */
323
329
this . driver = webdriver ;
330
+
331
+ /**
332
+ * All get methods will be resolved against this base URL. Relative URLs are =
333
+ * resolved the way anchor tags resolve.
334
+ *
335
+ * @type {string }
336
+ */
324
337
this . baseUrl = opt_baseUrl || '' ;
338
+
339
+ /**
340
+ * The css selector for anmelement on which to find Angular. This is usually
341
+ * 'body' but if your ng-app is on a subsection of the page it may be
342
+ * a subelement.
343
+ *
344
+ * @type {string }
345
+ */
325
346
this . rootEl = opt_rootElement || 'body' ;
347
+
348
+ /**
349
+ * If true, Protractor will not attempt to synchronize with the page before
350
+ * performing actions. This can be harmful because Protractor will not wait
351
+ * until $timeouts and $http calls have been processed, which can cause
352
+ * tests to become flaky. This should be used only when necessary, such as
353
+ * when a page continuously polls an API using $timeout.
354
+ *
355
+ * @type {boolean }
356
+ */
357
+ this . ignoreSynchronization = false ;
358
+
326
359
this . moduleNames_ = [ ] ;
327
360
328
361
this . moduleScripts_ = [ ] ;
@@ -336,7 +369,11 @@ var Protractor = function(webdriver, opt_baseUrl, opt_rootElement) {
336
369
* scripts return value.
337
370
*/
338
371
Protractor . prototype . waitForAngular = function ( ) {
339
- return this . driver . executeAsyncScript ( clientSideScripts . waitForAngular , this . rootEl ) ;
372
+ if ( this . ignoreSynchronization ) {
373
+ return webdriver . promise . fulfilled ( ) ;
374
+ }
375
+ return this . driver . executeAsyncScript (
376
+ clientSideScripts . waitForAngular , this . rootEl ) ;
340
377
} ;
341
378
342
379
// TODO: activeelement also returns a WebElement.
0 commit comments