{"action":"closed","issue":{"url":"https://api.github.com/repos/angular/protractor/issues/3184","repository_url":"https://api.github.com/repos/angular/protractor","labels_url":"https://api.github.com/repos/angular/protractor/issues/3184/labels{/name}","comments_url":"https://api.github.com/repos/angular/protractor/issues/3184/comments","events_url":"https://api.github.com/repos/angular/protractor/issues/3184/events","html_url":"https://github.com/angular/protractor/issues/3184","id":151840906,"number":3184,"title":"Override jasmin's function, error when starting tests","user":{"login":"alibabaih","id":3815585,"avatar_url":"https://avatars.githubusercontent.com/u/3815585?v=3","gravatar_id":"","url":"https://api.github.com/users/alibabaih","html_url":"https://github.com/alibabaih","followers_url":"https://api.github.com/users/alibabaih/followers","following_url":"https://api.github.com/users/alibabaih/following{/other_user}","gists_url":"https://api.github.com/users/alibabaih/gists{/gist_id}","starred_url":"https://api.github.com/users/alibabaih/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alibabaih/subscriptions","organizations_url":"https://api.github.com/users/alibabaih/orgs","repos_url":"https://api.github.com/users/alibabaih/repos","events_url":"https://api.github.com/users/alibabaih/events{/privacy}","received_events_url":"https://api.github.com/users/alibabaih/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-29T10:55:31Z","updated_at":"2016-04-29T13:46:37Z","closed_at":"2016-04-29T13:46:37Z","body":"Good day!\r\nI've overridden jasmin's `it` function in the protractor `onPrepare`:\r\n\r\n```\r\nvar originalIt = global.it;\r\n        global.it = function () {\r\n\r\n\r\n            function waitForSpinner() {\r\n\r\n                element(by.css('.uil-element-loader-wrapper')).isPresent().then((el) => { //check if element on the page, if not don't wait at all\r\n\r\n                    if(el) {\r\n                        browser.wait(function () {\r\n                            return element(by.css('.uil-element-loader-wrapper')).getAttribute('style').then((style) => {\r\n                                if ((style.indexOf('block') > -1)) { //console.log('Spinner is here ' + (style.indexOf('block') > -1) + style);\r\n                                    setTimeout(waitForSpinner, 100);\r\n                                } else { //console.log('Spinner is gone');\r\n                                    return true;\r\n                                }\r\n                            });\r\n                        });\r\n                    } else {\r\n                        browser.wait(element(by.css('body')).isPresent());\r\n                    }\r\n                });\r\n\r\n            }\r\n\r\n            waitForSpinner();\r\n\r\n            return originalIt.apply(this, arguments);\r\n        };\r\n```\r\n\r\nbut have some problem when starting tests:\r\n\r\n```\r\n[13:45:46] E/launcher - Process exited with error code 1\r\n\r\n/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:654\r\n    throw error;\r\n    ^\r\nError while waiting for Protractor to sync with the page: \"window.angular is undefined.  This could be either because this is a non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping.  See http://git.io/v4gXM for details\"\r\nTrace: { [Error: protractor exited with code 1]\r\n  message: 'protractor exited with code 1',\r\n  showStack: false,\r\n  showProperties: true,\r\n  plugin: 'gulp-protractor',\r\n  __safety: { toString: [Function: bound ] } }\r\n    at emitOne (events.js:82:20)\r\n    at Stream.emit (events.js:169:7)\r\n    at ChildProcess.<anonymous> (/node_modules/gulp-protractor/index.js:64:13)\r\n    at emitTwo (events.js:87:13)\r\n    at ChildProcess.emit (events.js:172:7)\r\n    at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)\r\n```\r\nAlthough if run tests with commented waitForSpinner(); everything is ok."}}