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

Commit

Permalink
feat(plugins): skipAngularStability
Browse files Browse the repository at this point in the history
  • Loading branch information
sjelin committed Feb 16, 2016
1 parent a7734f8 commit a4a7209
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
17 changes: 17 additions & 0 deletions docs/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,23 @@ exports.waitForCondition = function() {};
* @type {string}
*/
exports.name = '';


/**
* Used to turn off default checks for angular stability
*
* Normally Protractor waits for all $timeout and $http calls to be processed
* before executing the next command. This can be disabled using
* browser.ignoreSynchronization, but that will also disable any
* <Plugin>.waitForPromise or <Plugin>.waitForCondition checks. If you want to
* disable synchronization with angular, but leave in tact any custom plugin
* synchronization, this is the option for you.
*
* This is used by users who want to replace Protractor's synchronization code
* with their own.
*
* @type {boolean}
*/
```

Each of these exported properties are optional.
Expand Down
4 changes: 4 additions & 0 deletions lib/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var Plugins = function(config) {
this.pluginObjs = [];
this.assertions = {};
this.resultsReported = false;
this.skipAngularStability = false;
this.pluginConfs.forEach(function(pluginConf, i) {
var path;
if (pluginConf.path) {
Expand All @@ -45,6 +46,9 @@ var Plugins = function(config) {
}

annotatePluginObj(self, pluginObj, pluginConf, i);
self.skipAngularStability = self.skipAngularStability ||
pluginObj.skipAngularStability;

log.debug('Plugin "' + pluginObj.name + '" loaded.');
self.pluginObjs.push(pluginObj);
});
Expand Down
4 changes: 3 additions & 1 deletion lib/protractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,9 @@ Protractor.prototype.waitForAngular = function(opt_description) {
}

function runWaitForAngularScript() {
if (self.rootEl) {
if (self.plugins_.skipAngularStability) {
return webdriver.promise.fulfilled();
} else if (self.rootEl) {
return self.executeAsyncScript_(
clientSideScripts.waitForAngular,
'Protractor.waitForAngular()' + description,
Expand Down

0 comments on commit a4a7209

Please sign in to comment.