This repository has been archived by the owner on Jul 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(plugins) Calculate skipAngularStability dynamically.
This allows plugins to turn Protractor's default synchronization on and off as needed.
- Loading branch information
Showing
4 changed files
with
74 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
var env = require('../environment.js'), | ||
q = require('q'); | ||
|
||
// Verifies that plugins can change skipAngularStability on the fly. | ||
exports.config = { | ||
seleniumAddress: env.seleniumAddress, | ||
|
||
framework: 'jasmine', | ||
|
||
// Spec patterns are relative to this directory. | ||
specs: [ | ||
'specs/skip_stability_spec.js' | ||
], | ||
|
||
capabilities: env.capabilities, | ||
|
||
baseUrl: env.baseUrl + '/ng1/', | ||
|
||
// Define a plugin that allows skipAngularStability to be changed. | ||
plugins: [{ | ||
inline: { | ||
setup: function() { | ||
this.skipAngularStability = false; | ||
var plugin = this; | ||
|
||
protractor._PluginSetSkipStability = function(newValue) { | ||
plugin.skipAngularStability = newValue; | ||
}; | ||
} | ||
} | ||
}] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
describe('plugins that can disable synchronization', function() { | ||
beforeEach(function() { | ||
browser.get('index.html#/async'); | ||
}); | ||
|
||
it('DOES NOT wait for $timeout with synchronization disabled', function() { | ||
protractor._PluginSetSkipStability(true); | ||
var status = element(by.binding('slowAngularTimeoutStatus')); | ||
var button = element(by.css('[ng-click="slowAngularTimeout()"]')); | ||
|
||
expect(status.getText()).toEqual('not started'); | ||
|
||
button.click(); | ||
|
||
expect(status.getText()).toEqual('pending...'); | ||
}); | ||
|
||
it('waits for $timeout with synchronization enabled', function() { | ||
protractor._PluginSetSkipStability(false); | ||
var status = element(by.binding('slowAngularTimeoutStatus')); | ||
var button = element(by.css('[ng-click="slowAngularTimeout()"]')); | ||
|
||
expect(status.getText()).toEqual('not started'); | ||
|
||
button.click(); | ||
|
||
expect(status.getText()).toEqual('done'); | ||
}); | ||
}); |