{"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"},{"url":"https://api.github.com/repos/webdriverio/webdriverio/labels/v3","name":"v3","color":"5319e7"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/webdriverio/webdriverio/milestones/1","html_url":"https://github.com/webdriverio/webdriverio/milestones/v3","labels_url":"https://api.github.com/repos/webdriverio/webdriverio/milestones/1/labels","id":1073418,"number":1,"title":"v3","description":"WIP https://github.com/webdriverio/webdriverio/tree/v3\r\n\r\n- new core (chaining thru promises, only basic callback support)\r\n- TBD","creator":{"login":"christian-bromann","id":731337,"avatar_url":"https://avatars.githubusercontent.com/u/731337?v=3","gravatar_id":"","url":"https://api.github.com/users/christian-bromann","html_url":"https://github.com/christian-bromann","followers_url":"https://api.github.com/users/christian-bromann/followers","following_url":"https://api.github.com/users/christian-bromann/following{/other_user}","gists_url":"https://api.github.com/users/christian-bromann/gists{/gist_id}","starred_url":"https://api.github.com/users/christian-bromann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christian-bromann/subscriptions","organizations_url":"https://api.github.com/users/christian-bromann/orgs","repos_url":"https://api.github.com/users/christian-bromann/repos","events_url":"https://api.github.com/users/christian-bromann/events{/privacy}","received_events_url":"https://api.github.com/users/christian-bromann/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":4,"state":"open","created_at":"2015-04-18T17:28:15Z","updated_at":"2015-04-18T17:39:50Z","due_on":null,"closed_at":null},"comments":40,"created_at":"2015-01-30T11:07:25Z","updated_at":"2015-04-18T17:39:50Z","closed_at":"2015-04-18T17:39:50Z","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/94186655","html_url":"https://github.com/webdriverio/webdriverio/issues/402#issuecomment-94186655","issue_url":"https://api.github.com/repos/webdriverio/webdriverio/issues/402","id":94186655,"user":{"login":"christian-bromann","id":731337,"avatar_url":"https://avatars.githubusercontent.com/u/731337?v=3","gravatar_id":"","url":"https://api.github.com/users/christian-bromann","html_url":"https://github.com/christian-bromann","followers_url":"https://api.github.com/users/christian-bromann/followers","following_url":"https://api.github.com/users/christian-bromann/following{/other_user}","gists_url":"https://api.github.com/users/christian-bromann/gists{/gist_id}","starred_url":"https://api.github.com/users/christian-bromann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christian-bromann/subscriptions","organizations_url":"https://api.github.com/users/christian-bromann/orgs","repos_url":"https://api.github.com/users/christian-bromann/repos","events_url":"https://api.github.com/users/christian-bromann/events{/privacy}","received_events_url":"https://api.github.com/users/christian-bromann/received_events","type":"User","site_admin":false},"created_at":"2015-04-18T17:39:50Z","updated_at":"2015-04-18T17:39:50Z","body":"@syzer thanks for all your input! Feel free to help @Robinfr and me moving the `v3` branch forward. As of today I got a pretty stable promise support implemented using a monadic approach and Q promises. Any help from your site is highly appreciated! Hit us up on [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/webdriverio/webdriverio?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)"}}