{"action":"created","issue":{"url":"https://api.github.com/repos/webdriverio/webdriverio/issues/402","labels_url":"https://api.github.com/repos/webdriverio/webdriverio/issues/402/labels{/name}","comments_url":"https://api.github.com/repos/webdriverio/webdriverio/issues/402/comments","events_url":"https://api.github.com/repos/webdriverio/webdriverio/issues/402/events","html_url":"https://github.com/webdriverio/webdriverio/issues/402","id":56020940,"number":402,"title":"Promise chain error","user":{"login":"syzer","id":1989646,"avatar_url":"https://avatars.githubusercontent.com/u/1989646?v=3","gravatar_id":"","url":"https://api.github.com/users/syzer","html_url":"https://github.com/syzer","followers_url":"https://api.github.com/users/syzer/followers","following_url":"https://api.github.com/users/syzer/following{/other_user}","gists_url":"https://api.github.com/users/syzer/gists{/gist_id}","starred_url":"https://api.github.com/users/syzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syzer/subscriptions","organizations_url":"https://api.github.com/users/syzer/orgs","repos_url":"https://api.github.com/users/syzer/repos","events_url":"https://api.github.com/users/syzer/events{/privacy}","received_events_url":"https://api.github.com/users/syzer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/webdriverio/webdriverio/labels/Bug","name":"Bug","color":"e10c02"},{"url":"https://api.github.com/repos/webdriverio/webdriverio/labels/Project%20Related","name":"Project Related","color":"ffffff"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-01-30T11:07:25Z","updated_at":"2015-01-30T13:23:26Z","closed_at":null,"body":"Promise chain error:\r\n```js\r\nclient\r\n            .url(sid.url)\r\n            .then(client.waitFor('.result', 5000))\r\n            .then(client.getValue('#SSID'))\r\n            .then(function(sid){\r\n                 console.log('resolved', sid);  // here gets resolved ass [].length =4\r\n                 return sid;                          // should be a SINGLE element     \r\n             })\r\n```\r\ni guess in this last promise if the would be \r\n10 calls to webdriverio\r\nthe resolved promise would have array of 10 elements.\r\n\r\nright now i workaround this by flattening an array.\r\n\r\n```js\r\nrespSid = _.isArray(respSid) ? _.first(respSid) : respSid;\r\n```\r\n\r\nhelp is very much appreciated\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/webdriverio/webdriverio/issues/comments/72199693","html_url":"https://github.com/webdriverio/webdriverio/issues/402#issuecomment-72199693","issue_url":"https://api.github.com/repos/webdriverio/webdriverio/issues/402","id":72199693,"user":{"login":"syzer","id":1989646,"avatar_url":"https://avatars.githubusercontent.com/u/1989646?v=3","gravatar_id":"","url":"https://api.github.com/users/syzer","html_url":"https://github.com/syzer","followers_url":"https://api.github.com/users/syzer/followers","following_url":"https://api.github.com/users/syzer/following{/other_user}","gists_url":"https://api.github.com/users/syzer/gists{/gist_id}","starred_url":"https://api.github.com/users/syzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syzer/subscriptions","organizations_url":"https://api.github.com/users/syzer/orgs","repos_url":"https://api.github.com/users/syzer/repos","events_url":"https://api.github.com/users/syzer/events{/privacy}","received_events_url":"https://api.github.com/users/syzer/received_events","type":"User","site_admin":false},"created_at":"2015-01-30T13:23:26Z","updated_at":"2015-01-30T13:23:26Z","body":"Do you need a help with this one?\r\nI kinda need this for my day job :)\r\n\r\nTho `q` was one of first opensource alternative to `async`\r\n`q` was/is? not valid Promise/A+ / monad\r\n`Bluebird`, or `when` I think they are.\r\n\r\nWas trying to use bluebird promisify function, q( has denodefy or sth)\r\nTo use with WDIO\r\nBut \r\n1. u/we have Async? in exported function names\r\n2. some of WDIO function don't resolve to \r\n   cb(err, value)\r\n3. i look into WDIO internals.. and `async` lib is kinda old shool... like 2010/2011?\r\n\r\nhow u abbreviate Webdriver.io? WDIO?\r\n"}}