{"action":"opened","issue":{"url":"https://api.github.com/repos/angular/protractor/issues/2700","labels_url":"https://api.github.com/repos/angular/protractor/issues/2700/labels{/name}","comments_url":"https://api.github.com/repos/angular/protractor/issues/2700/comments","events_url":"https://api.github.com/repos/angular/protractor/issues/2700/events","html_url":"https://github.com/angular/protractor/issues/2700","id":116706561,"number":2700,"title":"Restangular calls not working with Protractor? ","user":{"login":"BaggioWong","id":6848377,"avatar_url":"https://avatars.githubusercontent.com/u/6848377?v=3","gravatar_id":"","url":"https://api.github.com/users/BaggioWong","html_url":"https://github.com/BaggioWong","followers_url":"https://api.github.com/users/BaggioWong/followers","following_url":"https://api.github.com/users/BaggioWong/following{/other_user}","gists_url":"https://api.github.com/users/BaggioWong/gists{/gist_id}","starred_url":"https://api.github.com/users/BaggioWong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BaggioWong/subscriptions","organizations_url":"https://api.github.com/users/BaggioWong/orgs","repos_url":"https://api.github.com/users/BaggioWong/repos","events_url":"https://api.github.com/users/BaggioWong/events{/privacy}","received_events_url":"https://api.github.com/users/BaggioWong/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-13T06:05:36Z","updated_at":"2015-11-13T06:05:36Z","closed_at":null,"body":"I'm not entirely sure what's causing the issue, but it seems like Restangular calls aren't executing on the test server. \r\n\r\nWhat's strange is that a week ago, I wrote two tests and they were working just fine (I was on Yosemite on a Mac), but after upgrading to El Capitan, strange things happened. Long story short, they stopped working. \r\n\r\nSpecifically, using the first test as an example, it's supposed to test the login feature. Everything worked fine up till the point when the submit button is supposed to be clicked. I tried manually clicking the button after browser.pause() (to keep the browser open), to no avail - this is the basis of me determining that Restangular calls are not executing properly. \r\n\r\nTo add additional information about the environment, I'm using a proxy because services like Facebook are blocked here. \r\n\r\nWon't add specs here because I don't think it's something to do with the test specs, but will do so if further info is needed. \r\n\r\nHere's the code for the first test:\r\n\r\n```javascript\r\n  it(\"should log in\", function() {\r\n  \t//\tcommon variables\r\n  \tvar expectedConditions = protractor.ExpectedConditions;\r\n\r\n  \t//\tnav to homepage\r\n    browser.get('http://127.0.0.1:9031/home');\r\n\r\n    //\tlogs user out by default (this is implemented with local storage)\r\n    browser.executeScript('window.sessionStorage.clear();');\r\n    browser.executeScript('window.localStorage.clear();');\r\n\r\n    //\tlogs in with test user account (without remember me)\r\n    var testTeacherId = 163abji;\r\n    var testUsername = testTeacherId@test.com; \r\n    var testPassword = \"abcdef\";\r\n\r\n    //\twait until home page has loaded\r\n    var signinButton = element(by.css('a.btn.btn-outline.btn-login[ui-sref=signin]'));\r\n    browser.wait(expectedConditions.visibilityOf(signinButton), 5000);\t\r\n    \t\r\n    element(by.css('a.btn.btn-outline.btn-login[ui-sref=signin]')).click();\t//\tsignin button\r\n    \r\n    //\twait until the signin page has loaded\r\n    var usernameField = element(by.model('user.LOGIN_PA_USERNAME'));\t\t//\tusername field\r\n    var passwordField = element(by.model('user.LOGIN_PA_PASSWORD'));\t\t//\tpassword field\r\n    var submitButton = element(by.css('button[type=submit]'));\t\t\t\t//\tsubmit button\r\n    browser.wait(expectedConditions.visibilityOf(usernameField), 5000);\t\t\r\n\r\n    //  log in\r\n    usernameField.sendKeys(testUsername);\r\n    passwordField.sendKeys(testPassword);\r\n\r\n    submitButton.click();\r\n\r\n    //\twait until the dashboard page has loaded\r\n    var avatarImg = element(by.css('img.mute.rounded'));\r\n    browser.wait(expectedConditions.visibilityOf(avatarImg), 5000);\r\n  });\r\n```\r\n\r\nThe login service code is pretty straightforward - in the controller:\r\n\r\n```javascript\r\n.controller('AccountSigninCtrl', function ($scope, LoginService) {\r\n    //  omitted for brevity\r\n    $scope.login = function () {\r\n      return LoginService.login($scope);\r\n    }\r\n    //  omitted for brevity\r\n  })\r\n```\r\nAnd the login service\r\n\r\n```javascript\r\n  .service('LoginService', function ($rootScope, $modal, $state, $interval, $log, $q, Facebook, FBError,\r\n                                     FacebookLoginNOEmailModal, FacebookLoginHasEmailModal, Account, UserService) {\r\n    //  omitted for brevity\r\n    this.login = function (ctrlScope) {\r\n      ctrlScope.error = null;\r\n      return UserService.login(ctrlScope.user, function (error) {\r\n        ctrlScope.error = error;\r\n      }, ctrlScope.curState).then(function (result) {\r\n        if (result.curState) {\r\n          ctrlScope.$close();\r\n        }\r\n        return result;\r\n      }, function (error) {\r\n        return error;\r\n      });\r\n    }\r\n});\r\n```\r\n\r\nAnd in the UserService service\r\n\r\n```javascript\r\n.service('UserService', function ($rootScope, FullRestangular, $q, $state, $log, localStorageService, Finance) {\r\n    //  omitted for brevity\r\nthis.login = function (user, errorCallback, curState) {\r\n      /**\r\n       *  Check if the \"Remember Me\" checkbox is checked, calculate the expiry date and\r\n       *  save in LocalStorage.\r\n       *\r\n       *  If checked, expiry date = current time + 7 days\r\n       *  If not, expiry date = current time + 1 day\r\n       */\r\n      var rememberMe = !!user[\"rememberMe\"],\r\n        expiryDate = new Date().getTime(),\r\n        dayInMilliseconds = 1 * 24 * 60 * 60 * 1000;\r\n\r\n      if (rememberMe) {\r\n        expiryDate += (dayInMilliseconds * 7);\r\n      }\r\n      else {\r\n        expiryDate += (dayInMilliseconds * 1);\r\n      }\r\n\r\n      localStorageService.set(KP.SERIALIZE.EXPIRY_DATE, expiryDate);\r\n      return API.post(user).then(function (result) {\r\n        result.curState = curState;\r\n        _handlerResult(result);\r\n        return result;\r\n      }, function (error) {\r\n        $log.debug('[user service] login fail', error);\r\n        $rootScope.$broadcast('kp_account_login_fail', error);\r\n        isFunction(errorCallback) ? errorCallback(error) : angular.noop();\r\n        return error;\r\n      });\r\n    }\r\n    //  omitted for brevity\r\n});\r\n```\r\n\r\nFor the second test, it's supposed to navigate to a page where a list of names are to be fetched and displayed, and to test that the returned array's length is 0. After loading the page, however, again on browser.pause(), it doesn't fetch anything. \r\n\r\n```javascript\r\ndescribe(\"teacher list\", function () {\r\n  beforeEach(function () {\r\n    browser.get('http://127.0.0.1:9031/teachers');\r\n  });\r\n  it(\"has teacher\", function () {\r\n    var teachers = element.all(by.repeater(\"teacher in items track by $index\"));\r\n    expect(teachers.count()).toBe(20);\r\n    //teachers.first().then(function (teacher) {\r\n    //  expect(teacher).not.toBeUndefined();\r\n    //});\r\n\r\n    browser.pause();\r\n  })\r\n});\r\n```\r\n\r\n(I'll omit the code for the second example for now since it's pretty much a Restangular call.)\r\n\r\nIf this was a generic angular issue, I imagine the console would have outputted \"angular not found\", but this doesn't seem to be the case here. \r\n\r\nHas anyone experienced a similar issue? And if you have, what's the possible causes and how did you resolve it? \r\n\r\nI'm almost wanted to shy away from posting it here, because Restangular is a popular module and I would think that someone must have already experienced this, but I didn't come up with a solution on a Google search. \r\n\r\nAny suggestions really appreciated - thanks! "}}