{"action":"created","comment":{"url":"https://api.github.com/repos/appium/appium-android-driver/pulls/comments/62584957","id":62584957,"diff_hunk":"@@ -129,21 +129,45 @@ describe('Android Helpers', () => {\n   }));\n \n   describe('getDeviceInfoFromCaps', () => {\n+    // list of device/emu udids to their os versions\n+    // using list instead of map to preserve order\n+    let devices = [\n+      {udid: 'emulator-1234', os: '4.9.2'},\n+      {udid: 'rotalume-1339', os: '5.1.5'},\n+      {udid: 'rotalume-1338', os: '5.0.1'},\n+      {udid: 'rotalume-1337', os: '5.0.1'},\n+      {udid: 'roamulet-9000', os: '6.0'},\n+      {udid: 'roamulet-0', os: '2.3'},\n+      {udid: '0123456789', os: 'wellhellothere'}\n+    ];\n+    let curDeviceId = '';\n+\n     before(() => {\n       sinon.stub(ADB, 'createADB', async () => {\n         return {\n           getDevicesWithRetry: async () => {\n-            return [\n-              {udid: 'emulator-1234'},\n-              {udid: 'rotalume-1337'}\n-            ];\n+            let udids = [];\n+            for (let device of devices) {\n+              udids.push({udid: device.udid});\n+            }\n+            return udids;\n           },\n           getPortFromEmulatorString: () => {\n             return 1234;\n           },\n           getRunningAVD: () => {\n             return {'udid': 'emulator-1234', 'port': 1234};\n           },\n+          setDeviceId: (udid) => {\n+            curDeviceId = udid;\n+          },\n+          getPlatformVersion: () => {\n+            for (let device of devices) {","path":"test/unit/android-helper-specs.js","position":41,"original_position":41,"commit_id":"ba098c3af5ac53f20b7e6649f2af86ff5f177dbc","original_commit_id":"ba098c3af5ac53f20b7e6649f2af86ff5f177dbc","user":{"login":"imurchie","id":2614354,"avatar_url":"https://avatars.githubusercontent.com/u/2614354?v=3","gravatar_id":"","url":"https://api.github.com/users/imurchie","html_url":"https://github.com/imurchie","followers_url":"https://api.github.com/users/imurchie/followers","following_url":"https://api.github.com/users/imurchie/following{/other_user}","gists_url":"https://api.github.com/users/imurchie/gists{/gist_id}","starred_url":"https://api.github.com/users/imurchie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imurchie/subscriptions","organizations_url":"https://api.github.com/users/imurchie/orgs","repos_url":"https://api.github.com/users/imurchie/repos","events_url":"https://api.github.com/users/imurchie/events{/privacy}","received_events_url":"https://api.github.com/users/imurchie/received_events","type":"User","site_admin":false},"body":"Similarly, this can be\r\n\r\n```js\r\nreturn _.filter(devices, {udid: curDeviceId})[0].os;\r\n```","created_at":"2016-05-09T22:35:45Z","updated_at":"2016-05-09T22:35:45Z","html_url":"https://github.com/appium/appium-android-driver/pull/141#discussion_r62584957","pull_request_url":"https://api.github.com/repos/appium/appium-android-driver/pulls/141","_links":{"self":{"href":"https://api.github.com/repos/appium/appium-android-driver/pulls/comments/62584957"},"html":{"href":"https://github.com/appium/appium-android-driver/pull/141#discussion_r62584957"},"pull_request":{"href":"https://api.github.com/repos/appium/appium-android-driver/pulls/141"}}},"pull_request":{"url":"https://api.github.com/repos/appium/appium-android-driver/pulls/141","id":69104678,"html_url":"https://github.com/appium/appium-android-driver/pull/141","diff_url":"https://github.com/appium/appium-android-driver/pull/141.diff","patch_url":"https://github.com/appium/appium-android-driver/pull/141.patch","issue_url":"https://api.github.com/repos/appium/appium-android-driver/issues/141","number":141,"state":"open","locked":false,"title":"Auto-select devices based on platform version","user":{"login":"midopa","id":1522141,"avatar_url":"https://avatars.githubusercontent.com/u/1522141?v=3","gravatar_id":"","url":"https://api.github.com/users/midopa","html_url":"https://github.com/midopa","followers_url":"https://api.github.com/users/midopa/followers","following_url":"https://api.github.com/users/midopa/following{/other_user}","gists_url":"https://api.github.com/users/midopa/gists{/gist_id}","starred_url":"https://api.github.com/users/midopa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/midopa/subscriptions","organizations_url":"https://api.github.com/users/midopa/orgs","repos_url":"https://api.github.com/users/midopa/repos","events_url":"https://api.github.com/users/midopa/events{/privacy}","received_events_url":"https://api.github.com/users/midopa/received_events","type":"User","site_admin":false},"body":"Here's a draft implementation for appium/appium#6473.\r\n\r\nTested with an Android 6.0 device and a 4.0 emulator running.\r\n\r\nSpun up an Appium instance from the Java client with PLATFORM_VERSION = 4 and got the emulator. 6 got my phone. 5 got nothing and the server returned an error response and remained online.\r\n\r\nLet me know what you think. Once we have quorum I'll add tests.","created_at":"2016-05-06T04:44:54Z","updated_at":"2016-05-09T22:35:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3254bbd7d7d650c06a181b3b6d98c171d92d5f28","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/appium/appium-android-driver/pulls/141/commits","review_comments_url":"https://api.github.com/repos/appium/appium-android-driver/pulls/141/comments","review_comment_url":"https://api.github.com/repos/appium/appium-android-driver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/appium/appium-android-driver/issues/141/comments","statuses_url":"https://api.github.com/repos/appium/appium-android-driver/statuses/ba098c3af5ac53f20b7e6649f2af86ff5f177dbc","head":{"label":"midopa:auto-select","ref":"auto-select","sha":"ba098c3af5ac53f20b7e6649f2af86ff5f177dbc","user":{"login":"midopa","id":1522141,"avatar_url":"https://avatars.githubusercontent.com/u/1522141?v=3","gravatar_id":"","url":"https://api.github.com/users/midopa","html_url":"https://github.com/midopa","followers_url":"https://api.github.com/users/midopa/followers","following_url":"https://api.github.com/users/midopa/following{/other_user}","gists_url":"https://api.github.com/users/midopa/gists{/gist_id}","starred_url":"https://api.github.com/users/midopa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/midopa/subscriptions","organizations_url":"https://api.github.com/users/midopa/orgs","repos_url":"https://api.github.com/users/midopa/repos","events_url":"https://api.github.com/users/midopa/events{/privacy}","received_events_url":"https://api.github.com/users/midopa/received_events","type":"User","site_admin":false},"repo":{"id":58105090,"name":"appium-android-driver","full_name":"midopa/appium-android-driver","owner":{"login":"midopa","id":1522141,"avatar_url":"https://avatars.githubusercontent.com/u/1522141?v=3","gravatar_id":"","url":"https://api.github.com/users/midopa","html_url":"https://github.com/midopa","followers_url":"https://api.github.com/users/midopa/followers","following_url":"https://api.github.com/users/midopa/following{/other_user}","gists_url":"https://api.github.com/users/midopa/gists{/gist_id}","starred_url":"https://api.github.com/users/midopa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/midopa/subscriptions","organizations_url":"https://api.github.com/users/midopa/orgs","repos_url":"https://api.github.com/users/midopa/repos","events_url":"https://api.github.com/users/midopa/events{/privacy}","received_events_url":"https://api.github.com/users/midopa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/midopa/appium-android-driver","description":"Android Driver for Appium","fork":true,"url":"https://api.github.com/repos/midopa/appium-android-driver","forks_url":"https://api.github.com/repos/midopa/appium-android-driver/forks","keys_url":"https://api.github.com/repos/midopa/appium-android-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/midopa/appium-android-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/midopa/appium-android-driver/teams","hooks_url":"https://api.github.com/repos/midopa/appium-android-driver/hooks","issue_events_url":"https://api.github.com/repos/midopa/appium-android-driver/issues/events{/number}","events_url":"https://api.github.com/repos/midopa/appium-android-driver/events","assignees_url":"https://api.github.com/repos/midopa/appium-android-driver/assignees{/user}","branches_url":"https://api.github.com/repos/midopa/appium-android-driver/branches{/branch}","tags_url":"https://api.github.com/repos/midopa/appium-android-driver/tags","blobs_url":"https://api.github.com/repos/midopa/appium-android-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/midopa/appium-android-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/midopa/appium-android-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/midopa/appium-android-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/midopa/appium-android-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/midopa/appium-android-driver/languages","stargazers_url":"https://api.github.com/repos/midopa/appium-android-driver/stargazers","contributors_url":"https://api.github.com/repos/midopa/appium-android-driver/contributors","subscribers_url":"https://api.github.com/repos/midopa/appium-android-driver/subscribers","subscription_url":"https://api.github.com/repos/midopa/appium-android-driver/subscription","commits_url":"https://api.github.com/repos/midopa/appium-android-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/midopa/appium-android-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/midopa/appium-android-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/midopa/appium-android-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/midopa/appium-android-driver/contents/{+path}","compare_url":"https://api.github.com/repos/midopa/appium-android-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/midopa/appium-android-driver/merges","archive_url":"https://api.github.com/repos/midopa/appium-android-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/midopa/appium-android-driver/downloads","issues_url":"https://api.github.com/repos/midopa/appium-android-driver/issues{/number}","pulls_url":"https://api.github.com/repos/midopa/appium-android-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/midopa/appium-android-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/midopa/appium-android-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/midopa/appium-android-driver/labels{/name}","releases_url":"https://api.github.com/repos/midopa/appium-android-driver/releases{/id}","deployments_url":"https://api.github.com/repos/midopa/appium-android-driver/deployments","created_at":"2016-05-05T04:50:49Z","updated_at":"2016-05-05T04:50:50Z","pushed_at":"2016-05-07T07:12:32Z","git_url":"git://github.com/midopa/appium-android-driver.git","ssh_url":"git@github.com:midopa/appium-android-driver.git","clone_url":"https://github.com/midopa/appium-android-driver.git","svn_url":"https://github.com/midopa/appium-android-driver","homepage":null,"size":2505,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"appium:master","ref":"master","sha":"54a836b31780247373108ef44fb3b9682e3745b1","user":{"login":"appium","id":3221291,"avatar_url":"https://avatars.githubusercontent.com/u/3221291?v=3","gravatar_id":"","url":"https://api.github.com/users/appium","html_url":"https://github.com/appium","followers_url":"https://api.github.com/users/appium/followers","following_url":"https://api.github.com/users/appium/following{/other_user}","gists_url":"https://api.github.com/users/appium/gists{/gist_id}","starred_url":"https://api.github.com/users/appium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appium/subscriptions","organizations_url":"https://api.github.com/users/appium/orgs","repos_url":"https://api.github.com/users/appium/repos","events_url":"https://api.github.com/users/appium/events{/privacy}","received_events_url":"https://api.github.com/users/appium/received_events","type":"Organization","site_admin":false},"repo":{"id":39916403,"name":"appium-android-driver","full_name":"appium/appium-android-driver","owner":{"login":"appium","id":3221291,"avatar_url":"https://avatars.githubusercontent.com/u/3221291?v=3","gravatar_id":"","url":"https://api.github.com/users/appium","html_url":"https://github.com/appium","followers_url":"https://api.github.com/users/appium/followers","following_url":"https://api.github.com/users/appium/following{/other_user}","gists_url":"https://api.github.com/users/appium/gists{/gist_id}","starred_url":"https://api.github.com/users/appium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appium/subscriptions","organizations_url":"https://api.github.com/users/appium/orgs","repos_url":"https://api.github.com/users/appium/repos","events_url":"https://api.github.com/users/appium/events{/privacy}","received_events_url":"https://api.github.com/users/appium/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/appium/appium-android-driver","description":"Android Driver for Appium","fork":false,"url":"https://api.github.com/repos/appium/appium-android-driver","forks_url":"https://api.github.com/repos/appium/appium-android-driver/forks","keys_url":"https://api.github.com/repos/appium/appium-android-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/appium/appium-android-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/appium/appium-android-driver/teams","hooks_url":"https://api.github.com/repos/appium/appium-android-driver/hooks","issue_events_url":"https://api.github.com/repos/appium/appium-android-driver/issues/events{/number}","events_url":"https://api.github.com/repos/appium/appium-android-driver/events","assignees_url":"https://api.github.com/repos/appium/appium-android-driver/assignees{/user}","branches_url":"https://api.github.com/repos/appium/appium-android-driver/branches{/branch}","tags_url":"https://api.github.com/repos/appium/appium-android-driver/tags","blobs_url":"https://api.github.com/repos/appium/appium-android-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/appium/appium-android-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/appium/appium-android-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/appium/appium-android-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/appium/appium-android-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/appium/appium-android-driver/languages","stargazers_url":"https://api.github.com/repos/appium/appium-android-driver/stargazers","contributors_url":"https://api.github.com/repos/appium/appium-android-driver/contributors","subscribers_url":"https://api.github.com/repos/appium/appium-android-driver/subscribers","subscription_url":"https://api.github.com/repos/appium/appium-android-driver/subscription","commits_url":"https://api.github.com/repos/appium/appium-android-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/appium/appium-android-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/appium/appium-android-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/appium/appium-android-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/appium/appium-android-driver/contents/{+path}","compare_url":"https://api.github.com/repos/appium/appium-android-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/appium/appium-android-driver/merges","archive_url":"https://api.github.com/repos/appium/appium-android-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/appium/appium-android-driver/downloads","issues_url":"https://api.github.com/repos/appium/appium-android-driver/issues{/number}","pulls_url":"https://api.github.com/repos/appium/appium-android-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/appium/appium-android-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/appium/appium-android-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/appium/appium-android-driver/labels{/name}","releases_url":"https://api.github.com/repos/appium/appium-android-driver/releases{/id}","deployments_url":"https://api.github.com/repos/appium/appium-android-driver/deployments","created_at":"2015-07-29T21:07:42Z","updated_at":"2016-04-26T09:13:56Z","pushed_at":"2016-05-07T07:12:32Z","git_url":"git://github.com/appium/appium-android-driver.git","ssh_url":"git@github.com:appium/appium-android-driver.git","clone_url":"https://github.com/appium/appium-android-driver.git","svn_url":"https://github.com/appium/appium-android-driver","homepage":null,"size":2521,"stargazers_count":9,"watchers_count":9,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":8,"forks":20,"open_issues":8,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/appium/appium-android-driver/pulls/141"},"html":{"href":"https://github.com/appium/appium-android-driver/pull/141"},"issue":{"href":"https://api.github.com/repos/appium/appium-android-driver/issues/141"},"comments":{"href":"https://api.github.com/repos/appium/appium-android-driver/issues/141/comments"},"review_comments":{"href":"https://api.github.com/repos/appium/appium-android-driver/pulls/141/comments"},"review_comment":{"href":"https://api.github.com/repos/appium/appium-android-driver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/appium/appium-android-driver/pulls/141/commits"},"statuses":{"href":"https://api.github.com/repos/appium/appium-android-driver/statuses/ba098c3af5ac53f20b7e6649f2af86ff5f177dbc"}}}}