{"action":"created","comment":{"url":"https://api.github.com/repos/appium/appium-espresso-driver/pulls/comments/231711837","pull_request_review_id":172741725,"id":231711837,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMTcxMTgzNw==","diff_hunk":"@@ -0,0 +1,80 @@\n+import chai from 'chai';\n+import chaiAsPromised from 'chai-as-promised';\n+import { initSession, deleteSession, MOCHA_TIMEOUT } from '../helpers/session';\n+import { APIDEMO_CAPS, GENERIC_CAPS } from '../desired';\n+\n+\n+chai.should();\n+chai.use(chaiAsPromised);\n+\n+describe('web', function () {\n+  describe('WebView', function () {\n+    this.timeout(MOCHA_TIMEOUT);\n+\n+    let driver;\n+    before(async function () {\n+      driver = await initSession({\n+        ...APIDEMO_CAPS,\n+        appPackage: 'io.appium.android.apis',\n+        appActivity: 'io.appium.android.apis.view.WebView1',\n+        autoWebview: true,\n+      });\n+    });\n+    after(async function () {\n+      await deleteSession();\n+    });\n+    it('should get the title of a webview page', async function () {\n+      await driver.title().should.eventually.equal('I am a page title');\n+    });\n+    it('should find one native and one web context', async function () {\n+      let contexts = await driver.contexts();\n+      contexts.length.should.equal(2);\n+      contexts[0].should.match(/^native/i);\n+      contexts[1].should.match(/^webview/i);\n+    });\n+    it('should send text to html text inputs', async function () {\n+      const html = await driver.source();\n+      html.should.match(/Selenium/);\n+      const textbox = await driver.elementById('i_am_a_textbox');\n+      await textbox.clear();\n+      await textbox.type(\"Text contents\");\n+      await textbox.getAttribute('value').should.eventually.equal(\"Text contents\");\n+      await textbox.clear();\n+      await textbox.text().should.eventually.equal(\"\");\n+    });\n+    it('should navigate between webview pages', async function () {\n+      const anchorLink = await driver.elementById('i am a link');\n+      await anchorLink.click();\n+      const bodyEl = await driver.elementByTagName('body');\n+      bodyEl.getAttribute('value').should.eventually.equal(/I am some other page content/);\n+      await driver.back();\n+      await driver.elementById('i am a link').should.eventually.exist;\n+    });\n+    it('should be able to switch from webview back to native, navigate to a different webview and then switch back to web context', async function () {\n+      // Switch to webview\n+      let contexts = await driver.contexts();\n+      await driver.context(contexts[1]);\n+      await driver.title().should.eventually.equal('I am a page title');\n+\n+      // Switch to native and go to different activity\n+      await driver.context(contexts[0]);\n+      await driver.startActivity({appActivity: 'io.appium.android.apis.view.WebView3', appPackage: 'io.appium.android.apis'});\n+      contexts = await driver.contexts();\n+      await driver.elementById('android:id/content').should.eventually.exist;\n+\n+      // Switch to webview again\n+      await driver.context(contexts[1]);\n+      await driver.title().should.eventually.equal('I am a page title');\n+    });\n+  });\n+\n+  describe('Chrome Browser', function () {\n+    it('should reject \"browserName=Chrome\" sessions with a helpful error message (Chrome is not available in Espresso automation context)', async function () {\n+      await initSession({\n+        ...GENERIC_CAPS,\n+        browserName: 'Chrome',\n+      }).should.eventually.be.rejectedWith(/unavailable/);","path":"test/functional/webview/web-e2e-specs.js","position":76,"original_position":76,"commit_id":"a63ce660236a8af18673f621701ee942ad549507","original_commit_id":"a63ce660236a8af18673f621701ee942ad549507","user":{"login":"dpgraham","id":852574,"node_id":"MDQ6VXNlcjg1MjU3NA==","avatar_url":"https://avatars2.githubusercontent.com/u/852574?v=4","gravatar_id":"","url":"https://api.github.com/users/dpgraham","html_url":"https://github.com/dpgraham","followers_url":"https://api.github.com/users/dpgraham/followers","following_url":"https://api.github.com/users/dpgraham/following{/other_user}","gists_url":"https://api.github.com/users/dpgraham/gists{/gist_id}","starred_url":"https://api.github.com/users/dpgraham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpgraham/subscriptions","organizations_url":"https://api.github.com/users/dpgraham/orgs","repos_url":"https://api.github.com/users/dpgraham/repos","events_url":"https://api.github.com/users/dpgraham/events{/privacy}","received_events_url":"https://api.github.com/users/dpgraham/received_events","type":"User","site_admin":false},"body":"When attempting to access an app that's not the AUT, Espresso throws an 'unavailable' error.\r\n\r\nI was originally going to just throw an error if `browserName` was present, but @mykola-mokhnach wants to not fail sessions with `browserName` present just in case a client (like Selenium Grid) adds a `browserName` automatically.","created_at":"2018-11-07T23:03:31Z","updated_at":"2018-11-07T23:03:31Z","html_url":"https://github.com/appium/appium-espresso-driver/pull/285#discussion_r231711837","pull_request_url":"https://api.github.com/repos/appium/appium-espresso-driver/pulls/285","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/appium/appium-espresso-driver/pulls/comments/231711837"},"html":{"href":"https://github.com/appium/appium-espresso-driver/pull/285#discussion_r231711837"},"pull_request":{"href":"https://api.github.com/repos/appium/appium-espresso-driver/pulls/285"}},"in_reply_to_id":231710367},"pull_request":{"url":"https://api.github.com/repos/appium/appium-espresso-driver/pulls/285","id":228516289,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI4NTE2Mjg5","html_url":"https://github.com/appium/appium-espresso-driver/pull/285","diff_url":"https://github.com/appium/appium-espresso-driver/pull/285.diff","patch_url":"https://github.com/appium/appium-espresso-driver/pull/285.patch","issue_url":"https://api.github.com/repos/appium/appium-espresso-driver/issues/285","number":285,"state":"open","locked":false,"title":"Support webviews","user":{"login":"dpgraham","id":852574,"node_id":"MDQ6VXNlcjg1MjU3NA==","avatar_url":"https://avatars2.githubusercontent.com/u/852574?v=4","gravatar_id":"","url":"https://api.github.com/users/dpgraham","html_url":"https://github.com/dpgraham","followers_url":"https://api.github.com/users/dpgraham/followers","following_url":"https://api.github.com/users/dpgraham/following{/other_user}","gists_url":"https://api.github.com/users/dpgraham/gists{/gist_id}","starred_url":"https://api.github.com/users/dpgraham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpgraham/subscriptions","organizations_url":"https://api.github.com/users/dpgraham/orgs","repos_url":"https://api.github.com/users/dpgraham/repos","events_url":"https://api.github.com/users/dpgraham/events{/privacy}","received_events_url":"https://api.github.com/users/dpgraham/received_events","type":"User","site_admin":false},"body":"Looks like we weren't supporting webviews on Espresso ¯ \\_(ツ)_/¯\r\n\r\nThis PR ports over the exact same context-handling from `appium-uiautomator2-driver` and has webview tests that test switching to web context and running ChromeDriver commands and has a test for switching between webview _and_ native.\r\n\r\nAlso, we can't make use of the `browserName=Chrome` capability from Espresso because Chrome is a separate application and can't be accessed in an Espresso context. I updated it to throw an error if user tries using that capability.","created_at":"2018-11-05T22:42:07Z","updated_at":"2018-11-07T23:03:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d274902b63fb1a2ae5fa1bbcd95fe8cc0d91c1bd","assignee":null,"assignees":[],"requested_reviewers":[{"login":"imurchie","id":2614354,"node_id":"MDQ6VXNlcjI2MTQzNTQ=","avatar_url":"https://avatars2.githubusercontent.com/u/2614354?v=4","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}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/appium/appium-espresso-driver/pulls/285/commits","review_comments_url":"https://api.github.com/repos/appium/appium-espresso-driver/pulls/285/comments","review_comment_url":"https://api.github.com/repos/appium/appium-espresso-driver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/appium/appium-espresso-driver/issues/285/comments","statuses_url":"https://api.github.com/repos/appium/appium-espresso-driver/statuses/a63ce660236a8af18673f621701ee942ad549507","head":{"label":"appium:dpgraham-webview-testing","ref":"dpgraham-webview-testing","sha":"a63ce660236a8af18673f621701ee942ad549507","user":{"login":"appium","id":3221291,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyMjEyOTE=","avatar_url":"https://avatars2.githubusercontent.com/u/3221291?v=4","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":92194544,"node_id":"MDEwOlJlcG9zaXRvcnk5MjE5NDU0NA==","name":"appium-espresso-driver","full_name":"appium/appium-espresso-driver","private":false,"owner":{"login":"appium","id":3221291,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyMjEyOTE=","avatar_url":"https://avatars2.githubusercontent.com/u/3221291?v=4","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},"html_url":"https://github.com/appium/appium-espresso-driver","description":"Espresso integration for Appium","fork":false,"url":"https://api.github.com/repos/appium/appium-espresso-driver","forks_url":"https://api.github.com/repos/appium/appium-espresso-driver/forks","keys_url":"https://api.github.com/repos/appium/appium-espresso-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/appium/appium-espresso-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/appium/appium-espresso-driver/teams","hooks_url":"https://api.github.com/repos/appium/appium-espresso-driver/hooks","issue_events_url":"https://api.github.com/repos/appium/appium-espresso-driver/issues/events{/number}","events_url":"https://api.github.com/repos/appium/appium-espresso-driver/events","assignees_url":"https://api.github.com/repos/appium/appium-espresso-driver/assignees{/user}","branches_url":"https://api.github.com/repos/appium/appium-espresso-driver/branches{/branch}","tags_url":"https://api.github.com/repos/appium/appium-espresso-driver/tags","blobs_url":"https://api.github.com/repos/appium/appium-espresso-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/appium/appium-espresso-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/appium/appium-espresso-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/appium/appium-espresso-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/appium/appium-espresso-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/appium/appium-espresso-driver/languages","stargazers_url":"https://api.github.com/repos/appium/appium-espresso-driver/stargazers","contributors_url":"https://api.github.com/repos/appium/appium-espresso-driver/contributors","subscribers_url":"https://api.github.com/repos/appium/appium-espresso-driver/subscribers","subscription_url":"https://api.github.com/repos/appium/appium-espresso-driver/subscription","commits_url":"https://api.github.com/repos/appium/appium-espresso-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/appium/appium-espresso-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/appium/appium-espresso-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/appium/appium-espresso-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/appium/appium-espresso-driver/contents/{+path}","compare_url":"https://api.github.com/repos/appium/appium-espresso-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/appium/appium-espresso-driver/merges","archive_url":"https://api.github.com/repos/appium/appium-espresso-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/appium/appium-espresso-driver/downloads","issues_url":"https://api.github.com/repos/appium/appium-espresso-driver/issues{/number}","pulls_url":"https://api.github.com/repos/appium/appium-espresso-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/appium/appium-espresso-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/appium/appium-espresso-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/appium/appium-espresso-driver/labels{/name}","releases_url":"https://api.github.com/repos/appium/appium-espresso-driver/releases{/id}","deployments_url":"https://api.github.com/repos/appium/appium-espresso-driver/deployments","created_at":"2017-05-23T16:18:54Z","updated_at":"2018-11-07T22:52:11Z","pushed_at":"2018-11-07T22:52:09Z","git_url":"git://github.com/appium/appium-espresso-driver.git","ssh_url":"git@github.com:appium/appium-espresso-driver.git","clone_url":"https://github.com/appium/appium-espresso-driver.git","svn_url":"https://github.com/appium/appium-espresso-driver","homepage":null,"size":960,"stargazers_count":49,"watchers_count":49,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":18,"mirror_url":null,"archived":false,"open_issues_count":13,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":18,"open_issues":13,"watchers":49,"default_branch":"master"}},"base":{"label":"appium:master","ref":"master","sha":"00298b23c64021d7af7c1a959d2d9f0b9a4c1f84","user":{"login":"appium","id":3221291,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyMjEyOTE=","avatar_url":"https://avatars2.githubusercontent.com/u/3221291?v=4","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":92194544,"node_id":"MDEwOlJlcG9zaXRvcnk5MjE5NDU0NA==","name":"appium-espresso-driver","full_name":"appium/appium-espresso-driver","private":false,"owner":{"login":"appium","id":3221291,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyMjEyOTE=","avatar_url":"https://avatars2.githubusercontent.com/u/3221291?v=4","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},"html_url":"https://github.com/appium/appium-espresso-driver","description":"Espresso integration for Appium","fork":false,"url":"https://api.github.com/repos/appium/appium-espresso-driver","forks_url":"https://api.github.com/repos/appium/appium-espresso-driver/forks","keys_url":"https://api.github.com/repos/appium/appium-espresso-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/appium/appium-espresso-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/appium/appium-espresso-driver/teams","hooks_url":"https://api.github.com/repos/appium/appium-espresso-driver/hooks","issue_events_url":"https://api.github.com/repos/appium/appium-espresso-driver/issues/events{/number}","events_url":"https://api.github.com/repos/appium/appium-espresso-driver/events","assignees_url":"https://api.github.com/repos/appium/appium-espresso-driver/assignees{/user}","branches_url":"https://api.github.com/repos/appium/appium-espresso-driver/branches{/branch}","tags_url":"https://api.github.com/repos/appium/appium-espresso-driver/tags","blobs_url":"https://api.github.com/repos/appium/appium-espresso-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/appium/appium-espresso-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/appium/appium-espresso-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/appium/appium-espresso-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/appium/appium-espresso-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/appium/appium-espresso-driver/languages","stargazers_url":"https://api.github.com/repos/appium/appium-espresso-driver/stargazers","contributors_url":"https://api.github.com/repos/appium/appium-espresso-driver/contributors","subscribers_url":"https://api.github.com/repos/appium/appium-espresso-driver/subscribers","subscription_url":"https://api.github.com/repos/appium/appium-espresso-driver/subscription","commits_url":"https://api.github.com/repos/appium/appium-espresso-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/appium/appium-espresso-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/appium/appium-espresso-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/appium/appium-espresso-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/appium/appium-espresso-driver/contents/{+path}","compare_url":"https://api.github.com/repos/appium/appium-espresso-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/appium/appium-espresso-driver/merges","archive_url":"https://api.github.com/repos/appium/appium-espresso-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/appium/appium-espresso-driver/downloads","issues_url":"https://api.github.com/repos/appium/appium-espresso-driver/issues{/number}","pulls_url":"https://api.github.com/repos/appium/appium-espresso-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/appium/appium-espresso-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/appium/appium-espresso-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/appium/appium-espresso-driver/labels{/name}","releases_url":"https://api.github.com/repos/appium/appium-espresso-driver/releases{/id}","deployments_url":"https://api.github.com/repos/appium/appium-espresso-driver/deployments","created_at":"2017-05-23T16:18:54Z","updated_at":"2018-11-07T22:52:11Z","pushed_at":"2018-11-07T22:52:09Z","git_url":"git://github.com/appium/appium-espresso-driver.git","ssh_url":"git@github.com:appium/appium-espresso-driver.git","clone_url":"https://github.com/appium/appium-espresso-driver.git","svn_url":"https://github.com/appium/appium-espresso-driver","homepage":null,"size":960,"stargazers_count":49,"watchers_count":49,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":18,"mirror_url":null,"archived":false,"open_issues_count":13,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":18,"open_issues":13,"watchers":49,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/appium/appium-espresso-driver/pulls/285"},"html":{"href":"https://github.com/appium/appium-espresso-driver/pull/285"},"issue":{"href":"https://api.github.com/repos/appium/appium-espresso-driver/issues/285"},"comments":{"href":"https://api.github.com/repos/appium/appium-espresso-driver/issues/285/comments"},"review_comments":{"href":"https://api.github.com/repos/appium/appium-espresso-driver/pulls/285/comments"},"review_comment":{"href":"https://api.github.com/repos/appium/appium-espresso-driver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/appium/appium-espresso-driver/pulls/285/commits"},"statuses":{"href":"https://api.github.com/repos/appium/appium-espresso-driver/statuses/a63ce660236a8af18673f621701ee942ad549507"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"dpgraham"}}