{"action":"created","issue":{"url":"https://api.github.com/repos/angular/protractor/issues/1797","labels_url":"https://api.github.com/repos/angular/protractor/issues/1797/labels{/name}","comments_url":"https://api.github.com/repos/angular/protractor/issues/1797/comments","events_url":"https://api.github.com/repos/angular/protractor/issues/1797/events","html_url":"https://github.com/angular/protractor/issues/1797","id":57178824,"number":1797,"title":"BeforeEach not executed for following specs if a Jasmine spec timed out.","user":{"login":"bastijns-jeroen","id":4682089,"avatar_url":"https://avatars.githubusercontent.com/u/4682089?v=3","gravatar_id":"","url":"https://api.github.com/users/bastijns-jeroen","html_url":"https://github.com/bastijns-jeroen","followers_url":"https://api.github.com/users/bastijns-jeroen/followers","following_url":"https://api.github.com/users/bastijns-jeroen/following{/other_user}","gists_url":"https://api.github.com/users/bastijns-jeroen/gists{/gist_id}","starred_url":"https://api.github.com/users/bastijns-jeroen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bastijns-jeroen/subscriptions","organizations_url":"https://api.github.com/users/bastijns-jeroen/orgs","repos_url":"https://api.github.com/users/bastijns-jeroen/repos","events_url":"https://api.github.com/users/bastijns-jeroen/events{/privacy}","received_events_url":"https://api.github.com/users/bastijns-jeroen/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/protractor/labels/status:%20needs%20investigation","name":"status: needs investigation","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/angular/protractor/milestones/14","html_url":"https://github.com/angular/protractor/milestones/Upcoming","labels_url":"https://api.github.com/repos/angular/protractor/milestones/14/labels","id":694982,"number":14,"title":"Upcoming","description":"Features or issues that are not blocked and reasonable to work on.","creator":{"login":"juliemr","id":2081709,"avatar_url":"https://avatars.githubusercontent.com/u/2081709?v=3","gravatar_id":"","url":"https://api.github.com/users/juliemr","html_url":"https://github.com/juliemr","followers_url":"https://api.github.com/users/juliemr/followers","following_url":"https://api.github.com/users/juliemr/following{/other_user}","gists_url":"https://api.github.com/users/juliemr/gists{/gist_id}","starred_url":"https://api.github.com/users/juliemr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juliemr/subscriptions","organizations_url":"https://api.github.com/users/juliemr/orgs","repos_url":"https://api.github.com/users/juliemr/repos","events_url":"https://api.github.com/users/juliemr/events{/privacy}","received_events_url":"https://api.github.com/users/juliemr/received_events","type":"User","site_admin":false},"open_issues":21,"closed_issues":32,"state":"open","created_at":"2014-06-18T17:27:02Z","updated_at":"2015-12-21T19:55:41Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2015-02-10T14:08:38Z","updated_at":"2015-12-23T12:12:29Z","closed_at":null,"body":"#### Explanation\r\n\r\nCurrently we are having issues with asynchronous behavour in Protractor tests.\r\n\r\nWhen an asynchronous beforeEach exceeds the default timeout interval, the first test (it-block) fails as expected and an error is thrown:\r\n> A Jasmine spec timed out. Resetting the WebDriver Control Flow.\r\n\r\nHowever the beforeEach isn't executed anymore before the second test is executed and we get the same error as with the first test. It seems to us that this is unwanted behaviour, it should be normal to execute the beforeEach before executing the second test.\r\n\r\nThe same applies for tests in other subsequent spec-files. The beforeEach isn't executed before executing tests and we get the same error as in the first failing test.\r\n\r\nIs this a bug in Jasmine / Protractor?\r\n\r\nI've included a code sample below which fails every time.\r\n\r\n*Version of Protractor: protractor@1.6.1*\r\n*Version of Jasmine in protractor 2.1*\r\n\r\n#### Code example\r\n\r\n##### Snippet of our Protractor configuration:\r\n```javascript\r\n{\r\n   framework: 'jasmine2',\r\n\r\n   // Options to be passed to Jasmine-node.\r\n   jasmineNodeOpts : {\r\n      showColors: true,\r\n      defaultTimeoutInterval : 3000\r\n   }\r\n```\r\n\r\n##### Specs\r\nSpec-files are stored in the same folder (tests).\r\n\r\n###### atest_spec.js:\r\n```javascript\r\ndescribe('atest', function() {\r\n\t\r\n\tbeforeEach(function(done) {\r\n\t\tconsole.log('atest start beforeEach');\r\n\t\tsetTimeout(function () {\r\n\t\t\tconsole.log('atest stop beforeEach');\r\n\t\t\tdone();\r\n\t\t}, 2000)\r\n\t});\r\n\t\r\n\tit('atest test one', function() {\r\n\t\tconsole.log('atest test one started');\r\n\t\texpect('atest').toEqual('test one')\r\n\t});\r\n\r\n\tit('atest test two', function() {\r\n\t\tconsole.log('atest test two started');\r\n\t\texpect('atest').toEqual('test two')\r\n\t});\r\n});\r\n```\r\n\r\n###### btest_spec.js:\r\n```javascript\r\ndescribe('btest', function() {\r\n\t\r\n\tbeforeEach(function(done) {\r\n\t\tconsole.log('btest start beforeEach');\r\n\t\tsetTimeout(function () {\r\n\t\t\tconsole.log('btest stop beforeEach');\r\n\t\t\tdone();\r\n\t\t}, 4000)\r\n\t});\r\n\t\r\n\tit('btest test one', function() {\r\n\t\tconsole.log('btest test one started');\r\n\t\texpect('btest').toEqual('test one')\r\n\t});\r\n\r\n\tit('btest test two', function() {\r\n\t\tconsole.log('btest test two started');\r\n\t\texpect('btest').toEqual('test one')\r\n\t});\r\n});\r\n```\r\n\r\n###### ctest_spec.js:\r\n```javascript\r\ndescribe('ctest', function() {\r\n\t\r\n\tbeforeEach(function(done) {\r\n\t\tconsole.log('ctest start beforeEach');\r\n\t\tsetTimeout(function () {\r\n\t\t\tconsole.log('ctest stop beforeEach');\r\n\t\t\tdone();\r\n\t\t}, 2000)\r\n\t});\r\n\t\r\n\tit('ctest test one', function() {\r\n\t\tconsole.log('ctest test one started');\r\n\t\texpect('ctest').toEqual('test one')\r\n\t});\r\n\r\n\tit('ctest test two', function() {\r\n\t\tconsole.log('ctest test two started');\r\n\t\texpect('ctest').toEqual('test one')\r\n\t});\r\n});\r\n```\r\n\r\n##### Console output\r\n```\r\nUsing ChromeDriver directly...\r\n[launcher] Running 1 instances of WebDriver\r\nStarted\r\natest start beforeEach\r\natest stop beforeEach\r\natest test one started\r\natest start beforeEach\r\natest stop beforeEach\r\natest test two started\r\nbtest start beforeEach\r\nbtest test one started\r\nA Jasmine spec timed out. Resetting the WebDriver Control Flow.\r\nThe last active task was: \r\nunknown\r\nbtest stop beforeEach\r\nbtest test two started\r\nA Jasmine spec timed out. Resetting the WebDriver Control Flow.\r\nThe last active task was: \r\nunknown\r\nctest test one started\r\nA Jasmine spec timed out. Resetting the WebDriver Control Flow.\r\nThe last active task was: \r\nunknown\r\nctest test two started\r\nA Jasmine spec timed out. Resetting the WebDriver Control Flow.\r\nThe last active task was: \r\nunknown\r\n\r\nFailures:\r\n1) atest atest test one\r\n  Message:\r\n\u001B[31m    Expected 'atest' to equal 'test one'.\u001B[0m\r\n  Stack:\r\n    Error: Failed expectation\r\n        at Env.<anonymous> (tests/atest_spec.js:13:19)\r\n        at node_modules/protractor/node_modules/jasminewd2/index.js:95:14\r\n        at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)\r\n        at [object Object].webdriver.promise.ControlFlow.runEventLoop_ (node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1518:8)\r\n        at [object Object].wrapper [as _onTimeout] (timers.js:252:14)\r\n        at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)\r\n\r\n2) atest atest test two\r\n  Message:\r\n\u001B[31m    Expected 'atest' to equal 'test two'.\u001B[0m\r\n  Stack:\r\n    Error: Failed expectation\r\n        at Env.<anonymous> (tests/atest_spec.js:18:19)\r\n        at node_modules/protractor/node_modules/jasminewd2/index.js:95:14\r\n        at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)\r\n        at [object Object].webdriver.promise.ControlFlow.runEventLoop_ (node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1518:8)\r\n        at [object Object].wrapper [as _onTimeout] (timers.js:252:14)\r\n        at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)\r\n\r\n3) btest btest test one\r\n  Message:\r\n\u001B[31m    Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.\u001B[0m\r\n  Stack:\r\n    Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.\r\n        at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)\r\n  Message:\r\n\u001B[31m    Expected 'btest' to equal 'test one'.\u001B[0m\r\n  Stack:\r\n    Error: Failed expectation\r\n        at Env.<anonymous> (tests/btest_spec.js:13:19)\r\n        at node_modules/protractor/node_modules/jasminewd2/index.js:95:14\r\n        at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)\r\n        at [object Object].webdriver.promise.ControlFlow.runEventLoop_ (node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1518:8)\r\n        at [object Object].wrapper [as _onTimeout] (timers.js:252:14)\r\n        at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)\r\n\r\n4) btest btest test two\r\n  Message:\r\n\u001B[31m    Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.\u001B[0m\r\n  Stack:\r\n    Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.\r\n        at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)\r\n  Message:\r\n\u001B[31m    Expected 'btest' to equal 'test one'.\u001B[0m\r\n  Stack:\r\n    Error: Failed expectation\r\n        at Env.<anonymous> (tests/btest_spec.js:18:19)\r\n        at node_modules/protractor/node_modules/jasminewd2/index.js:95:14\r\n        at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)\r\n        at [object Object].webdriver.promise.ControlFlow.runEventLoop_ (node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1518:8)\r\n        at [object Object].wrapper [as _onTimeout] (timers.js:252:14)\r\n        at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)\r\n\r\n5) ctest ctest test one\r\n  Message:\r\n\u001B[31m    Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.\u001B[0m\r\n  Stack:\r\n    Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.\r\n        at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)\r\n  Message:\r\n\u001B[31m    Expected 'ctest' to equal 'test one'.\u001B[0m\r\n  Stack:\r\n    Error: Failed expectation\r\n        at Env.<anonymous> (tests/ctest_spec.js:13:19)\r\n        at node_modules/protractor/node_modules/jasminewd2/index.js:95:14\r\n        at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)\r\n        at [object Object].webdriver.promise.ControlFlow.runEventLoop_ (node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1518:8)\r\n        at [object Object].wrapper [as _onTimeout] (timers.js:252:14)\r\n        at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)\r\n\r\n6) ctest ctest test two\r\n  Message:\r\n\u001B[31m    Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.\u001B[0m\r\n  Stack:\r\n    Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.\r\n        at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)\r\n  Message:\r\n\u001B[31m    Expected 'ctest' to equal 'test one'.\u001B[0m\r\n  Stack:\r\n    Error: Failed expectation\r\n        at Env.<anonymous> (tests/ctest_spec.js:18:19)\r\n        at node_modules/protractor/node_modules/jasminewd2/index.js:95:14\r\n        at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)\r\n        at [object Object].webdriver.promise.ControlFlow.runEventLoop_ (node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1518:8)\r\n        at [object Object].wrapper [as _onTimeout] (timers.js:252:14)\r\n        at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)\r\n\r\n6 specs, 6 failures\r\nFinished in 17.291 seconds\r\n[launcher] 0 instance(s) of WebDriver still running\r\n[launcher] chrome #1 failed 6 test(s)\r\n[launcher] overall: 6 failed spec(s)\r\n[launcher] Process exited with error code 1\r\n```"},"comment":{"url":"https://api.github.com/repos/angular/protractor/issues/comments/166878493","html_url":"https://github.com/angular/protractor/issues/1797#issuecomment-166878493","issue_url":"https://api.github.com/repos/angular/protractor/issues/1797","id":166878493,"user":{"login":"pedrro","id":4137355,"avatar_url":"https://avatars.githubusercontent.com/u/4137355?v=3","gravatar_id":"","url":"https://api.github.com/users/pedrro","html_url":"https://github.com/pedrro","followers_url":"https://api.github.com/users/pedrro/followers","following_url":"https://api.github.com/users/pedrro/following{/other_user}","gists_url":"https://api.github.com/users/pedrro/gists{/gist_id}","starred_url":"https://api.github.com/users/pedrro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedrro/subscriptions","organizations_url":"https://api.github.com/users/pedrro/orgs","repos_url":"https://api.github.com/users/pedrro/repos","events_url":"https://api.github.com/users/pedrro/events{/privacy}","received_events_url":"https://api.github.com/users/pedrro/received_events","type":"User","site_admin":false},"created_at":"2015-12-23T12:12:29Z","updated_at":"2015-12-23T12:12:29Z","body":"Hey guys, did u have some fix to this timeout error? I'm already have this error, but only fail one test, I don't know what I have to do to fix this... This error only occurs sometimes, so, it's hard to debug to know what is happening. This is my class, and the test that fails is the first it. [protractor spec](https://github.com/ThoughtWorksInc/registrolivre/blob/master/src/test/resources/functional/tests/register-company-spec.js)\r\n"}}