diff --git a/src/Drupal/DrupalExtension/Context/MinkContext.php b/src/Drupal/DrupalExtension/Context/MinkContext.php index b729b516..612b0652 100644 --- a/src/Drupal/DrupalExtension/Context/MinkContext.php +++ b/src/Drupal/DrupalExtension/Context/MinkContext.php @@ -98,7 +98,7 @@ public function beforeJavascriptStep($event) } $text = $event->getStep()->getText(); if (preg_match('/(follow|press|click|submit)/i', $text)) { - $this->iWaitForAjaxToFinish(); + $this->iWaitForAjaxToFinish($event); } } @@ -116,7 +116,7 @@ public function afterJavascriptStep($event) } $text = $event->getStep()->getText(); if (preg_match('/(follow|press|click|submit)/i', $text)) { - $this->iWaitForAjaxToFinish(); + $this->iWaitForAjaxToFinish($event); } } @@ -127,7 +127,7 @@ public function afterJavascriptStep($event) * * @Given I wait for AJAX to finish */ - public function iWaitForAjaxToFinish() + public function iWaitForAjaxToFinish($event = null) { $condition = <<getSession()->wait(1000 * $this->getMinkParameter('ajax_timeout'), $condition); if (!$result) { - throw new \RuntimeException('Unable to complete AJAX request.'); + if ($event) { + /** @var \Behat\Behat\Hook\Scope\BeforeStepScope $event */ + $event_data = ' ' . json_encode([ + 'name' => $event->getName(), + 'feature' => $event->getFeature()->getTitle(), + 'step' => $event->getStep()->getText(), + 'suite' => $event->getSuite()->getName(), + ]); + } else { + $event_data = ''; + } + throw new \RuntimeException('Unable to complete AJAX request.' . $event_data); } } /**