I saw this post on the Behat group on g.d.o:

https://groups.drupal.org/node/381608

Which had some steps for checking the visibility of form elements:

https://gist.github.com/pbuyle/7698675

These would be super useful in the Behat Drupal extension!

The original author uses them for testing '#states' and I've personally needed something similar for making sure that each role only has access to the form elements they should on entity edit forms.

Would you consider accepting this? If so, I'll write a patch for you to review. I just wanted to see if there was interest first - I don't know what your policy is on accepting new steps that aren't completely Drupal-related.

Thanks!

Comments

pbuyle’s picture

IMHO, for my steps to be included into the extension they would need more work. They currently heavily rely on, what I think is, the default Drupal form markup and have only been tested in a single custon theme. The code to retrieve a form element or its label should abstracted to easily overwriteable methods. One of these methods should be used to retrieve the form labels on the page. Once you have a form label element, you can retrieve its form element using its for attribute (requiring this attribute is a reasonable requirments). Another method should be used to retrieve the type (ie. the Drupal form API #type) of a form element.

fgm’s picture

Issue tags: +license issues

Hi @mongolito404. Thanks for the steps. Until they are committed to d.o., they are just available as a Gist without any licensing info, theoretically preventing anyone from using them, which is probably not what you want.... but the Github terms of service do not specify any fallback license when none is specified :-(

Would you mind updating the gist to include a licensing clause, preferably compatible with Drupal, like : "This code is released under the GNU General Public License version 2 or later", just like Drupal itself.

This might encourage reuse and updates, likely as a patch on this issue.

pbuyle’s picture

Hi, I added a LICENSE file to the Gist. The code is now distributed under a MIT-style licence. The licence is compatible with the GPL v2. In addition to this licence, if the code is included in a software distributed on drupal.org, the copyright notice may be removed.

jhedstrom’s picture

Status: Active » Postponed

I've linked this Gist in the README and on the project page. Thanks!

Marking postponed for now, if it gets generalized as a patch, please re-open for consideration.

alex.skrypnyk’s picture

Status: Postponed » Closed (won't fix)
Issue tags: -

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.