{"action":"created","issue":{"url":"https://api.github.com/repos/angular/jasminewd/issues/59","repository_url":"https://api.github.com/repos/angular/jasminewd","labels_url":"https://api.github.com/repos/angular/jasminewd/issues/59/labels{/name}","comments_url":"https://api.github.com/repos/angular/jasminewd/issues/59/comments","events_url":"https://api.github.com/repos/angular/jasminewd/issues/59/events","html_url":"https://github.com/angular/jasminewd/issues/59","id":186263792,"number":59,"title":"ES6 Promises and webdriver promises/control flow don't play well together","user":{"login":"sjelin","id":4841675,"avatar_url":"https://avatars.githubusercontent.com/u/4841675?v=3","gravatar_id":"","url":"https://api.github.com/users/sjelin","html_url":"https://github.com/sjelin","followers_url":"https://api.github.com/users/sjelin/followers","following_url":"https://api.github.com/users/sjelin/following{/other_user}","gists_url":"https://api.github.com/users/sjelin/gists{/gist_id}","starred_url":"https://api.github.com/users/sjelin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjelin/subscriptions","organizations_url":"https://api.github.com/users/sjelin/orgs","repos_url":"https://api.github.com/users/sjelin/repos","events_url":"https://api.github.com/users/sjelin/events{/privacy}","received_events_url":"https://api.github.com/users/sjelin/received_events","type":"User","site_admin":false},"labels":[{"id":104283303,"url":"https://api.github.com/repos/angular/jasminewd/labels/type:%20bug","name":"type: bug","color":"fc2929","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-31T11:42:29Z","updated_at":"2016-11-02T01:53:07Z","closed_at":"2016-11-02T01:53:07Z","body":"Take a look at this test:\r\n\r\n```ts\r\nvar webdriver = require('selenium-webdriver');\r\nvar common = require('./common.js');\r\nlet flowWrap = (promise: any) => {\r\n  return common.getFakeDriver().controlFlow().execute(() => {\r\n    return promise;\r\n  });\r\n};\r\n\r\ndescribe('mixed promises + control flow', function() {\r\n  let val: number;\r\n  it('should wait for it() to finish', function() {\r\n    val = 1;\r\n    return new Promise((resolve: Function) => {\r\n      resolve(webdriver.promise.fulfilled(7));\r\n    }).then((seven: any) => {\r\n      flowWrap(webdriver.promise.delayed(1000).then(() => {\r\n        val = seven;\r\n      }));\r\n    });\r\n  });\r\n\r\n  it('should have waited for setter in previous it()', function() {\r\n    expect(val).toBe(7);\r\n  });\r\n});\r\n```\r\n\r\nThis results in the error:\r\n```\r\n Expected 1 to be 7.\r\n```\r\nMeaning that the `val = seven` line wasn't run (I have verified this in other ways too).  You need all three of the following to make this bug happen:\r\n\r\n1) An ES6 promise (or possibly a `q` promise though I haven't tried)\r\n2) A webdriver promise\r\n3) `controlFlow.execute()` synchronization\r\n\r\nIt's as though the combination of webdriver and ES6 promises just makes the control flow fall over."},"comment":{"url":"https://api.github.com/repos/angular/jasminewd/issues/comments/257750947","html_url":"https://github.com/angular/jasminewd/issues/59#issuecomment-257750947","issue_url":"https://api.github.com/repos/angular/jasminewd/issues/59","id":257750947,"user":{"login":"sjelin","id":4841675,"avatar_url":"https://avatars.githubusercontent.com/u/4841675?v=3","gravatar_id":"","url":"https://api.github.com/users/sjelin","html_url":"https://github.com/sjelin","followers_url":"https://api.github.com/users/sjelin/followers","following_url":"https://api.github.com/users/sjelin/following{/other_user}","gists_url":"https://api.github.com/users/sjelin/gists{/gist_id}","starred_url":"https://api.github.com/users/sjelin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjelin/subscriptions","organizations_url":"https://api.github.com/users/sjelin/orgs","repos_url":"https://api.github.com/users/sjelin/repos","events_url":"https://api.github.com/users/sjelin/events{/privacy}","received_events_url":"https://api.github.com/users/sjelin/received_events","type":"User","site_admin":false},"created_at":"2016-11-02T01:53:07Z","updated_at":"2016-11-02T01:53:07Z","body":"Closing in favor of https://github.com/SeleniumHQ/selenium/issues/3037"}}
{"actor":{"display_login":"sjelin"}}