{"action":"created","issue":{"url":"https://api.github.com/repos/jhedstrom/drupalextension/issues/342","repository_url":"https://api.github.com/repos/jhedstrom/drupalextension","labels_url":"https://api.github.com/repos/jhedstrom/drupalextension/issues/342/labels{/name}","comments_url":"https://api.github.com/repos/jhedstrom/drupalextension/issues/342/comments","events_url":"https://api.github.com/repos/jhedstrom/drupalextension/issues/342/events","html_url":"https://github.com/jhedstrom/drupalextension/issues/342","id":202168752,"number":342,"title":"Testing Views","user":{"login":"jonathanjfshaw","id":3512385,"avatar_url":"https://avatars.githubusercontent.com/u/3512385?v=3","gravatar_id":"","url":"https://api.github.com/users/jonathanjfshaw","html_url":"https://github.com/jonathanjfshaw","followers_url":"https://api.github.com/users/jonathanjfshaw/followers","following_url":"https://api.github.com/users/jonathanjfshaw/following{/other_user}","gists_url":"https://api.github.com/users/jonathanjfshaw/gists{/gist_id}","starred_url":"https://api.github.com/users/jonathanjfshaw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonathanjfshaw/subscriptions","organizations_url":"https://api.github.com/users/jonathanjfshaw/orgs","repos_url":"https://api.github.com/users/jonathanjfshaw/repos","events_url":"https://api.github.com/users/jonathanjfshaw/events{/privacy}","received_events_url":"https://api.github.com/users/jonathanjfshaw/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-01-20T15:32:19Z","updated_at":"2017-01-22T00:03:49Z","closed_at":null,"body":"Drupal Views can be complex and critical features of a site, good candidates surely for some BDD testing.\r\n\r\nTesting Views currently is hard, no ready-made steps offer much to help with testing views. I've been working on a step to do just this. The step I have created is:\r\n@Then I should see :elements_css (elements ):\r\n\r\nGiven HTML like this:\r\n```\r\n<div class =\"views-myview\">\r\n  <div class=\"views-row,active\">\r\n    <span class=\"field--name-title\"> Item1 </span>\r\n    <span class=\"field--name-field-color\"> Blue </span>\r\n    <span> Something else here </span>\r\n  </div>\r\n  <div class=\"views-row\">\r\n    <span class=\"field--name-title\"> Item2 </span>\r\n    <span class=\"field--name-field-color\"> Yellow </span>\r\n    <span class=\"special\"> This one is special </span>\r\n  </div>\r\n  <div class=\"views-row\">\r\n    <span class=\"field--name-title\">Item3</span>\r\n  </div>\r\n</div>\r\n```\r\n\r\nThen the following step would pass:\r\n```\r\nThen I should see \"div.views-myview > div.views-row\" elements:\r\n| contains            | .field--name-title:contains | .field-name-field-color:contains | .special | .active |\r\n| Something else | Item1                                 | Blue                                             |              | Yes      |\r\n|                           | Item2                                 | Yellow                                          | Yes        | No      |\r\n|                           | Item3                                 |                                                     |  Yes       | No      |\r\n```\r\n\r\nOr equivalently, if behat.yml has:\r\n```\r\nregion_map:\r\n  Articles: \"div.views-myview > div.views-row\"\r\n  Title field:  \".field--name-title\"\r\n  Color field: \".field-name-field-color\"\r\n```\r\n```\r\nThen I should see \"articles\":\r\n| contains            | Title field: contains | Color field: contains | .special | .active |\r\n| Something else | Item1                      | Blue                          |             | Yes      |\r\n|                           | Item2                      | Yellow                       | Yes       | No      |\r\n|                           | Item3                      |                                  | Yes       | No      |\r\n```\r\n\r\nIs this step something that you would be interested in adding to the Drupal extension? If it is, I will prepare a PR."},"comment":{"url":"https://api.github.com/repos/jhedstrom/drupalextension/issues/comments/274296835","html_url":"https://github.com/jhedstrom/drupalextension/issues/342#issuecomment-274296835","issue_url":"https://api.github.com/repos/jhedstrom/drupalextension/issues/342","id":274296835,"user":{"login":"pfrenssen","id":442924,"avatar_url":"https://avatars.githubusercontent.com/u/442924?v=3","gravatar_id":"","url":"https://api.github.com/users/pfrenssen","html_url":"https://github.com/pfrenssen","followers_url":"https://api.github.com/users/pfrenssen/followers","following_url":"https://api.github.com/users/pfrenssen/following{/other_user}","gists_url":"https://api.github.com/users/pfrenssen/gists{/gist_id}","starred_url":"https://api.github.com/users/pfrenssen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfrenssen/subscriptions","organizations_url":"https://api.github.com/users/pfrenssen/orgs","repos_url":"https://api.github.com/users/pfrenssen/repos","events_url":"https://api.github.com/users/pfrenssen/events{/privacy}","received_events_url":"https://api.github.com/users/pfrenssen/received_events","type":"User","site_admin":false},"created_at":"2017-01-22T00:03:49Z","updated_at":"2017-01-22T00:03:49Z","body":"This is not likely to be accepted since this is not valid from a BDD standpoint. Behat scenarios are using a domain language that is intended to be understandable by non-technical people like clients, product owners and helpdesk employees.\r\n\r\nRemember that BDD is not about testing, it is intended to be able to effectively communicate the expected user behavior between all stakeholders of a project. If the only people that can understand the scenario are web developers then this goal is not met.\r\n\r\nThe Wikipedia page on BDD explains it pretty well, see https://en.wikipedia.org/wiki/Behavior-driven_development"}}
{"actor":{"display_login":"pfrenssen"}}