Skip to content

Commit

Permalink
Merge pull request #347 from jhedstrom/no-tags-for-hooks
Browse files Browse the repository at this point in the history
BeforeStep and AfterStep no longer support tags in Behat 3
  • Loading branch information
pfrenssen committed Jan 30, 2017
2 parents c08daab + 754097f commit f3c1f46
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/Drupal/DrupalExtension/Context/MinkContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,14 @@ public function assertEnterField($field, $value) {
/**
* For javascript enabled scenarios, always wait for AJAX before clicking.
*
* @BeforeStep @javascript
* @BeforeStep
*/
public function beforeJavascriptStep($event) {
/** @var \Behat\Behat\Hook\Scope\BeforeStepScope $event */
$tags = $event->getFeature()->getTags();
if (!in_array('javascript', $tags)) {
return;
}
$text = $event->getStep()->getText();
if (preg_match('/(follow|press|click|submit)/i', $text)) {
$this->iWaitForAjaxToFinish();
Expand All @@ -94,9 +99,14 @@ public function beforeJavascriptStep($event) {
/**
* For javascript enabled scenarios, always wait for AJAX after clicking.
*
* @AfterStep @javascript
* @AfterStep
*/
public function afterJavascriptStep($event) {
/** @var \Behat\Behat\Hook\Scope\BeforeStepScope $event */
$tags = $event->getFeature()->getTags();
if (!in_array('javascript', $tags)) {
return;
}
$text = $event->getStep()->getText();
if (preg_match('/(follow|press|click|submit)/i', $text)) {
$this->iWaitForAjaxToFinish();
Expand Down

0 comments on commit f3c1f46

Please sign in to comment.