Actually, i am writing some test cases for one angular app but the first page is taking too much time too load and having a popup box for instruction. So i need to store some value in localStorage of browser for making that popup box invisible. So how can i run any javascript function before running any test case?
By default, protractor is syncing with angular, which makes it wait for $http or $timeout you can check if that's the case on this particular page with this: Canonical way to debug Protractor-to-Angular sync issues
or you can inject the behaviour with mocked module
onPrepare: function() {
var doTheFuncyStuff= function() {
angular
.module('doTheFuncyStuff', [])
.run([function(){
//do something here so the popup isn't displayed
window.localStorage.setItem('my-var', 'my-val');
}]);
};
browser.addMockModule('doTheFuncyStuff', doTheFuncyStuff);
}