{"action":"created","comment":{"url":"https://api.github.com/repos/appfolio/ae_page_objects/pulls/comments/79493733","id":79493733,"diff_hunk":"@@ -77,7 +82,11 @@ def item_xpath\n         #   .//div[contains(./text(), 'Example Text')]\n         # See https://github.com/jnicklas/capybara#exactness for more information.\n         #\n-        query_args += [{:exact => true}] if query_args.first.to_sym == :xpath\n+        if query_args.first.to_sym == :xpath\n+          query_args.pop if query_args.last.is_a?(::Hash)\n+          query_args.push options","path":"lib/ae_page_objects/elements/collection.rb","position":37,"original_position":37,"commit_id":"7847e9bb371b7e24d07151773a8f9c14f0b288a3","original_commit_id":"7847e9bb371b7e24d07151773a8f9c14f0b288a3","user":{"login":"bboe","id":48100,"avatar_url":"https://avatars.githubusercontent.com/u/48100?v=3","gravatar_id":"","url":"https://api.github.com/users/bboe","html_url":"https://github.com/bboe","followers_url":"https://api.github.com/users/bboe/followers","following_url":"https://api.github.com/users/bboe/following{/other_user}","gists_url":"https://api.github.com/users/bboe/gists{/gist_id}","starred_url":"https://api.github.com/users/bboe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bboe/subscriptions","organizations_url":"https://api.github.com/users/bboe/orgs","repos_url":"https://api.github.com/users/bboe/repos","events_url":"https://api.github.com/users/bboe/events{/privacy}","received_events_url":"https://api.github.com/users/bboe/received_events","type":"User","site_admin":false},"body":"And my logic was way off. I like what you suggested on slack.","created_at":"2016-09-19T21:30:19Z","updated_at":"2016-09-19T21:30:19Z","html_url":"https://github.com/appfolio/ae_page_objects/pull/189#discussion_r79493733","pull_request_url":"https://api.github.com/repos/appfolio/ae_page_objects/pulls/189","_links":{"self":{"href":"https://api.github.com/repos/appfolio/ae_page_objects/pulls/comments/79493733"},"html":{"href":"https://github.com/appfolio/ae_page_objects/pull/189#discussion_r79493733"},"pull_request":{"href":"https://api.github.com/repos/appfolio/ae_page_objects/pulls/189"}}},"pull_request":{"url":"https://api.github.com/repos/appfolio/ae_page_objects/pulls/189","id":85627202,"html_url":"https://github.com/appfolio/ae_page_objects/pull/189","diff_url":"https://github.com/appfolio/ae_page_objects/pull/189.diff","patch_url":"https://github.com/appfolio/ae_page_objects/pull/189.patch","issue_url":"https://api.github.com/repos/appfolio/ae_page_objects/issues/189","number":189,"state":"open","locked":false,"title":"Respect options in item_locator when looking up items in collections","user":{"login":"tlconnor","id":37422,"avatar_url":"https://avatars.githubusercontent.com/u/37422?v=3","gravatar_id":"","url":"https://api.github.com/users/tlconnor","html_url":"https://github.com/tlconnor","followers_url":"https://api.github.com/users/tlconnor/followers","following_url":"https://api.github.com/users/tlconnor/following{/other_user}","gists_url":"https://api.github.com/users/tlconnor/gists{/gist_id}","starred_url":"https://api.github.com/users/tlconnor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlconnor/subscriptions","organizations_url":"https://api.github.com/users/tlconnor/orgs","repos_url":"https://api.github.com/users/tlconnor/repos","events_url":"https://api.github.com/users/tlconnor/events{/privacy}","received_events_url":"https://api.github.com/users/tlconnor/received_events","type":"User","site_admin":false},"body":"Currently any options passed in `item_locator` for collections are ignored.\r\n\r\nFor example, given a collection where we only want the visible elements:\r\n```ruby\r\ncollection :children, item_locator: ['li', { visible: true }]\r\n```\r\n\r\nwhere the markup looks something like this:\r\n```html\r\n<ul>\r\n  <li>First Child</li>\r\n  <li style=\"display:none\">Second Child</li>\r\n  <li>Third Child</li>\r\n</ul>\r\n```\r\n\r\nthen `children.size` will run the query `[:xpath, './/li']` to look up children and `[:xpath, './/li[2]']` to find the second child.  This causes two problems:\r\n```ruby\r\n  children.size == 3 # should be 2\r\n  children[1].text == 'Second Child' # shoud be 'Third Child'\r\n```\r\n\r\nThis PR changes the behavior to pass options through when looking up children.  That means now `children.size` will run the query `[:xpath, './/li', { visible: true }]` to look up children and `[:xpath, './/li[2]', { visible: true }]` to find the second child.  So now\r\n```ruby\r\n  1. children.size == 2\r\n  2. children[1].text == 'Third Child'\r\n```","created_at":"2016-09-16T19:30:25Z","updated_at":"2016-09-19T21:30:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"da7267a03497b756671461728d789eb4d70f661c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/appfolio/ae_page_objects/pulls/189/commits","review_comments_url":"https://api.github.com/repos/appfolio/ae_page_objects/pulls/189/comments","review_comment_url":"https://api.github.com/repos/appfolio/ae_page_objects/pulls/comments{/number}","comments_url":"https://api.github.com/repos/appfolio/ae_page_objects/issues/189/comments","statuses_url":"https://api.github.com/repos/appfolio/ae_page_objects/statuses/7847e9bb371b7e24d07151773a8f9c14f0b288a3","head":{"label":"appfolio:cpAddOptionsForCollection","ref":"cpAddOptionsForCollection","sha":"7847e9bb371b7e24d07151773a8f9c14f0b288a3","user":{"login":"appfolio","id":115119,"avatar_url":"https://avatars.githubusercontent.com/u/115119?v=3","gravatar_id":"","url":"https://api.github.com/users/appfolio","html_url":"https://github.com/appfolio","followers_url":"https://api.github.com/users/appfolio/followers","following_url":"https://api.github.com/users/appfolio/following{/other_user}","gists_url":"https://api.github.com/users/appfolio/gists{/gist_id}","starred_url":"https://api.github.com/users/appfolio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appfolio/subscriptions","organizations_url":"https://api.github.com/users/appfolio/orgs","repos_url":"https://api.github.com/users/appfolio/repos","events_url":"https://api.github.com/users/appfolio/events{/privacy}","received_events_url":"https://api.github.com/users/appfolio/received_events","type":"Organization","site_admin":false},"repo":{"id":7102043,"name":"ae_page_objects","full_name":"appfolio/ae_page_objects","owner":{"login":"appfolio","id":115119,"avatar_url":"https://avatars.githubusercontent.com/u/115119?v=3","gravatar_id":"","url":"https://api.github.com/users/appfolio","html_url":"https://github.com/appfolio","followers_url":"https://api.github.com/users/appfolio/followers","following_url":"https://api.github.com/users/appfolio/following{/other_user}","gists_url":"https://api.github.com/users/appfolio/gists{/gist_id}","starred_url":"https://api.github.com/users/appfolio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appfolio/subscriptions","organizations_url":"https://api.github.com/users/appfolio/orgs","repos_url":"https://api.github.com/users/appfolio/repos","events_url":"https://api.github.com/users/appfolio/events{/privacy}","received_events_url":"https://api.github.com/users/appfolio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/appfolio/ae_page_objects","description":"AePageObjects provides a powerful and customizable implementation of the Page Object pattern built on top of Capybara to be used in automated acceptance test suites.","fork":false,"url":"https://api.github.com/repos/appfolio/ae_page_objects","forks_url":"https://api.github.com/repos/appfolio/ae_page_objects/forks","keys_url":"https://api.github.com/repos/appfolio/ae_page_objects/keys{/key_id}","collaborators_url":"https://api.github.com/repos/appfolio/ae_page_objects/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/appfolio/ae_page_objects/teams","hooks_url":"https://api.github.com/repos/appfolio/ae_page_objects/hooks","issue_events_url":"https://api.github.com/repos/appfolio/ae_page_objects/issues/events{/number}","events_url":"https://api.github.com/repos/appfolio/ae_page_objects/events","assignees_url":"https://api.github.com/repos/appfolio/ae_page_objects/assignees{/user}","branches_url":"https://api.github.com/repos/appfolio/ae_page_objects/branches{/branch}","tags_url":"https://api.github.com/repos/appfolio/ae_page_objects/tags","blobs_url":"https://api.github.com/repos/appfolio/ae_page_objects/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/appfolio/ae_page_objects/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/appfolio/ae_page_objects/git/refs{/sha}","trees_url":"https://api.github.com/repos/appfolio/ae_page_objects/git/trees{/sha}","statuses_url":"https://api.github.com/repos/appfolio/ae_page_objects/statuses/{sha}","languages_url":"https://api.github.com/repos/appfolio/ae_page_objects/languages","stargazers_url":"https://api.github.com/repos/appfolio/ae_page_objects/stargazers","contributors_url":"https://api.github.com/repos/appfolio/ae_page_objects/contributors","subscribers_url":"https://api.github.com/repos/appfolio/ae_page_objects/subscribers","subscription_url":"https://api.github.com/repos/appfolio/ae_page_objects/subscription","commits_url":"https://api.github.com/repos/appfolio/ae_page_objects/commits{/sha}","git_commits_url":"https://api.github.com/repos/appfolio/ae_page_objects/git/commits{/sha}","comments_url":"https://api.github.com/repos/appfolio/ae_page_objects/comments{/number}","issue_comment_url":"https://api.github.com/repos/appfolio/ae_page_objects/issues/comments{/number}","contents_url":"https://api.github.com/repos/appfolio/ae_page_objects/contents/{+path}","compare_url":"https://api.github.com/repos/appfolio/ae_page_objects/compare/{base}...{head}","merges_url":"https://api.github.com/repos/appfolio/ae_page_objects/merges","archive_url":"https://api.github.com/repos/appfolio/ae_page_objects/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/appfolio/ae_page_objects/downloads","issues_url":"https://api.github.com/repos/appfolio/ae_page_objects/issues{/number}","pulls_url":"https://api.github.com/repos/appfolio/ae_page_objects/pulls{/number}","milestones_url":"https://api.github.com/repos/appfolio/ae_page_objects/milestones{/number}","notifications_url":"https://api.github.com/repos/appfolio/ae_page_objects/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/appfolio/ae_page_objects/labels{/name}","releases_url":"https://api.github.com/repos/appfolio/ae_page_objects/releases{/id}","deployments_url":"https://api.github.com/repos/appfolio/ae_page_objects/deployments","created_at":"2012-12-10T22:34:14Z","updated_at":"2016-07-27T17:35:42Z","pushed_at":"2016-09-19T21:12:08Z","git_url":"git://github.com/appfolio/ae_page_objects.git","ssh_url":"git@github.com:appfolio/ae_page_objects.git","clone_url":"https://github.com/appfolio/ae_page_objects.git","svn_url":"https://github.com/appfolio/ae_page_objects","homepage":"","size":3246,"stargazers_count":17,"watchers_count":17,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":21,"forks":7,"open_issues":21,"watchers":17,"default_branch":"master"}},"base":{"label":"appfolio:master","ref":"master","sha":"488e50eabddc1a2ce46fffc0ab3f18e0e342e621","user":{"login":"appfolio","id":115119,"avatar_url":"https://avatars.githubusercontent.com/u/115119?v=3","gravatar_id":"","url":"https://api.github.com/users/appfolio","html_url":"https://github.com/appfolio","followers_url":"https://api.github.com/users/appfolio/followers","following_url":"https://api.github.com/users/appfolio/following{/other_user}","gists_url":"https://api.github.com/users/appfolio/gists{/gist_id}","starred_url":"https://api.github.com/users/appfolio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appfolio/subscriptions","organizations_url":"https://api.github.com/users/appfolio/orgs","repos_url":"https://api.github.com/users/appfolio/repos","events_url":"https://api.github.com/users/appfolio/events{/privacy}","received_events_url":"https://api.github.com/users/appfolio/received_events","type":"Organization","site_admin":false},"repo":{"id":7102043,"name":"ae_page_objects","full_name":"appfolio/ae_page_objects","owner":{"login":"appfolio","id":115119,"avatar_url":"https://avatars.githubusercontent.com/u/115119?v=3","gravatar_id":"","url":"https://api.github.com/users/appfolio","html_url":"https://github.com/appfolio","followers_url":"https://api.github.com/users/appfolio/followers","following_url":"https://api.github.com/users/appfolio/following{/other_user}","gists_url":"https://api.github.com/users/appfolio/gists{/gist_id}","starred_url":"https://api.github.com/users/appfolio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appfolio/subscriptions","organizations_url":"https://api.github.com/users/appfolio/orgs","repos_url":"https://api.github.com/users/appfolio/repos","events_url":"https://api.github.com/users/appfolio/events{/privacy}","received_events_url":"https://api.github.com/users/appfolio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/appfolio/ae_page_objects","description":"AePageObjects provides a powerful and customizable implementation of the Page Object pattern built on top of Capybara to be used in automated acceptance test suites.","fork":false,"url":"https://api.github.com/repos/appfolio/ae_page_objects","forks_url":"https://api.github.com/repos/appfolio/ae_page_objects/forks","keys_url":"https://api.github.com/repos/appfolio/ae_page_objects/keys{/key_id}","collaborators_url":"https://api.github.com/repos/appfolio/ae_page_objects/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/appfolio/ae_page_objects/teams","hooks_url":"https://api.github.com/repos/appfolio/ae_page_objects/hooks","issue_events_url":"https://api.github.com/repos/appfolio/ae_page_objects/issues/events{/number}","events_url":"https://api.github.com/repos/appfolio/ae_page_objects/events","assignees_url":"https://api.github.com/repos/appfolio/ae_page_objects/assignees{/user}","branches_url":"https://api.github.com/repos/appfolio/ae_page_objects/branches{/branch}","tags_url":"https://api.github.com/repos/appfolio/ae_page_objects/tags","blobs_url":"https://api.github.com/repos/appfolio/ae_page_objects/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/appfolio/ae_page_objects/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/appfolio/ae_page_objects/git/refs{/sha}","trees_url":"https://api.github.com/repos/appfolio/ae_page_objects/git/trees{/sha}","statuses_url":"https://api.github.com/repos/appfolio/ae_page_objects/statuses/{sha}","languages_url":"https://api.github.com/repos/appfolio/ae_page_objects/languages","stargazers_url":"https://api.github.com/repos/appfolio/ae_page_objects/stargazers","contributors_url":"https://api.github.com/repos/appfolio/ae_page_objects/contributors","subscribers_url":"https://api.github.com/repos/appfolio/ae_page_objects/subscribers","subscription_url":"https://api.github.com/repos/appfolio/ae_page_objects/subscription","commits_url":"https://api.github.com/repos/appfolio/ae_page_objects/commits{/sha}","git_commits_url":"https://api.github.com/repos/appfolio/ae_page_objects/git/commits{/sha}","comments_url":"https://api.github.com/repos/appfolio/ae_page_objects/comments{/number}","issue_comment_url":"https://api.github.com/repos/appfolio/ae_page_objects/issues/comments{/number}","contents_url":"https://api.github.com/repos/appfolio/ae_page_objects/contents/{+path}","compare_url":"https://api.github.com/repos/appfolio/ae_page_objects/compare/{base}...{head}","merges_url":"https://api.github.com/repos/appfolio/ae_page_objects/merges","archive_url":"https://api.github.com/repos/appfolio/ae_page_objects/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/appfolio/ae_page_objects/downloads","issues_url":"https://api.github.com/repos/appfolio/ae_page_objects/issues{/number}","pulls_url":"https://api.github.com/repos/appfolio/ae_page_objects/pulls{/number}","milestones_url":"https://api.github.com/repos/appfolio/ae_page_objects/milestones{/number}","notifications_url":"https://api.github.com/repos/appfolio/ae_page_objects/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/appfolio/ae_page_objects/labels{/name}","releases_url":"https://api.github.com/repos/appfolio/ae_page_objects/releases{/id}","deployments_url":"https://api.github.com/repos/appfolio/ae_page_objects/deployments","created_at":"2012-12-10T22:34:14Z","updated_at":"2016-07-27T17:35:42Z","pushed_at":"2016-09-19T21:12:08Z","git_url":"git://github.com/appfolio/ae_page_objects.git","ssh_url":"git@github.com:appfolio/ae_page_objects.git","clone_url":"https://github.com/appfolio/ae_page_objects.git","svn_url":"https://github.com/appfolio/ae_page_objects","homepage":"","size":3246,"stargazers_count":17,"watchers_count":17,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":21,"forks":7,"open_issues":21,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/appfolio/ae_page_objects/pulls/189"},"html":{"href":"https://github.com/appfolio/ae_page_objects/pull/189"},"issue":{"href":"https://api.github.com/repos/appfolio/ae_page_objects/issues/189"},"comments":{"href":"https://api.github.com/repos/appfolio/ae_page_objects/issues/189/comments"},"review_comments":{"href":"https://api.github.com/repos/appfolio/ae_page_objects/pulls/189/comments"},"review_comment":{"href":"https://api.github.com/repos/appfolio/ae_page_objects/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/appfolio/ae_page_objects/pulls/189/commits"},"statuses":{"href":"https://api.github.com/repos/appfolio/ae_page_objects/statuses/7847e9bb371b7e24d07151773a8f9c14f0b288a3"}}}}
{"actor":{"display_login":"bboe"}}