Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit a4a7209

Browse files
committed
feat(plugins): skipAngularStability
1 parent a7734f8 commit a4a7209

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

docs/plugins.md

+17
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,23 @@ exports.waitForCondition = function() {};
224224
* @type {string}
225225
*/
226226
exports.name = '';
227+
228+
229+
/**
230+
* Used to turn off default checks for angular stability
231+
*
232+
* Normally Protractor waits for all $timeout and $http calls to be processed
233+
* before executing the next command. This can be disabled using
234+
* browser.ignoreSynchronization, but that will also disable any
235+
* <Plugin>.waitForPromise or <Plugin>.waitForCondition checks. If you want to
236+
* disable synchronization with angular, but leave in tact any custom plugin
237+
* synchronization, this is the option for you.
238+
*
239+
* This is used by users who want to replace Protractor's synchronization code
240+
* with their own.
241+
*
242+
* @type {boolean}
243+
*/
227244
```
228245

229246
Each of these exported properties are optional.

lib/plugins.js

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ var Plugins = function(config) {
2222
this.pluginObjs = [];
2323
this.assertions = {};
2424
this.resultsReported = false;
25+
this.skipAngularStability = false;
2526
this.pluginConfs.forEach(function(pluginConf, i) {
2627
var path;
2728
if (pluginConf.path) {
@@ -45,6 +46,9 @@ var Plugins = function(config) {
4546
}
4647

4748
annotatePluginObj(self, pluginObj, pluginConf, i);
49+
self.skipAngularStability = self.skipAngularStability ||
50+
pluginObj.skipAngularStability;
51+
4852
log.debug('Plugin "' + pluginObj.name + '" loaded.');
4953
self.pluginObjs.push(pluginObj);
5054
});

lib/protractor.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,9 @@ Protractor.prototype.waitForAngular = function(opt_description) {
355355
}
356356

357357
function runWaitForAngularScript() {
358-
if (self.rootEl) {
358+
if (self.plugins_.skipAngularStability) {
359+
return webdriver.promise.fulfilled();
360+
} else if (self.rootEl) {
359361
return self.executeAsyncScript_(
360362
clientSideScripts.waitForAngular,
361363
'Protractor.waitForAngular()' + description,

0 commit comments

Comments
 (0)