Skip to content

Instantly share code, notes, and snippets.

@henrahmagix
Created September 24, 2016 15:47
Show Gist options
  • Save henrahmagix/1f58b0cab6b1cb011a792c8f2720db24 to your computer and use it in GitHub Desktop.
Save henrahmagix/1f58b0cab6b1cb011a792c8f2720db24 to your computer and use it in GitHub Desktop.
Copy of protractor-testability-plugin to allow use of browser.setLocation()
exports.onPageLoad = function () {
// Copied from protractor-testability-plugin.
return browser.executeScript(function () {
if (!window.angular) {
// TODO: This is very very very (very^n) dirty...
// but the only way right now to make protractor work without setting ignoreSynchronization.
window.angular = {
resumeBootstrap: function () { },
module: function () {
return {
config: function () { return this; }
};
},
getTestability: function () {
var Backbone = window.Backbone;
return {
getLocation: function () {
Backbone.history.getFragment();
},
setLocation: function (url) {
Backbone.history.navigate(url, true);
},
whenStable: function (cb) {
cb();
}
};
}
};
window.getAllAngularTestabilities = function () {
return [window.angular.getTestability()];
};
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment