Skip to content

Instantly share code, notes, and snippets.

@ratajczak
Last active May 3, 2019 15:11
Show Gist options
  • Save ratajczak/8596929 to your computer and use it in GitHub Desktop.
Save ratajczak/8596929 to your computer and use it in GitHub Desktop.
Behat for Drupal

Behat Drupal Extension
https://drupal.org/project/drupalextension
http://dspeak.com/drupalextension/

https://github.com/Behatch/contexts/blob/master/src/Context/BrowserContext.php

Saucelabs integration module
https://github.com/alnutile/behat_editor/tree/master/modules

Examples:

Tag1
https://github.com/tag1consulting/behat-drupalextension/blob/master/src/Drupal/DrupalExtension/Context/Tag1Context.php

Drupal.org BDD https://drupal.org/project/doobie http://drupalcode.org/project/doobie.git/tree/refs/heads/7.x-1.x

Panopoly http://drupalcode.org/project/panopoly.git/tree/refs/heads/7.x-1.x:/tests/behat/features

Kickstart https://github.com/nlisgo/drupal-kickstart-behat

AJAX callback support for Behat with Mink (and jQuery) http://blog.scur.pl/2012/06/ajax-callback-support-behat-mink/

Step-definition for complex node structure (field collection + entity reference). https://gist.github.com/jhedstrom/5708233

Behat step-definition to verify visibility (not just presence) of Drupal form elements. https://gist.github.com/pbuyle/7698675

Open scholar
https://github.com/openscholar/openscholar/blob/SCHOLAR-3.x/openscholar/behat/features/bootstrap/FeatureContext.php
https://github.com/openscholar/openscholar/tree/SCHOLAR-3.x/openscholar/behat/features

Examples from DrupalCon Prague session
http://drupalcode.org/sandbox/tizzo/2088877.git

Steps for Drupal form elements visibility
https://gist.github.com/pbuyle/7698675

Switching to an Iframe with no name or id
https://gist.github.com/alnutile/8365567

Finding a Submit button on the page when there are 2 with the same name and ID
https://gist.github.com/alnutile/8365581

Clicking Submit on a form with no button
https://gist.github.com/alnutile/8365610

Switching to a popup window that has no namecreate link in gist
https://gist.github.com/alnutile/8365741

Dealing with Alerts
https://gist.github.com/alnutile/8365634

Comparing the Size of an element to the Window
https://gist.github.com/alnutile/8365794

Using Behat and DrupalDriver? Beware pathauto
http://previousnext.com.au/blog/using-behat-and-drupaldriver-beware-pathauto

Documentation:

http://docs.behat.org/
http://mink.behat.org/

profiles: http://docs.behat.org/guides/7.config.html#profiles
filters: http://docs.behat.org/guides/6.cli.html#gherkin-filters
subcontexts: http://dspeak.com/drupalextension/subcontexts.html

http://drupalwatchdog.com/2/2/behat-mink

https://groups.google.com/forum/#!forum/behat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment