Created
September 24, 2016 15:47
-
-
Save henrahmagix/1f58b0cab6b1cb011a792c8f2720db24 to your computer and use it in GitHub Desktop.
Copy of protractor-testability-plugin to allow use of browser.setLocation()
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
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