-
-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to change/set ajax_timeout #486
Comments
Since the extensions:
Drupal\MinkExtension:
ajax_timeout: 5 Note that |
Thanks @jhedstrom Did you notice the error output above? It seems like the default was null there |
I can see a default of 5 in vendor/drupal/drupal-extension/src/Drupal/MinkExtension/ServiceContainer/MinkExtension.php but I don't think that is used in this context I have vendor/behat/mink-extension/src/Behat/MinkExtension/Context/RawMinkContext.php which provides the public function getMinkParameter($name) which is used by vendor/drupal/drupal-extension/src/Drupal/DrupalExtension/Context/MinkContext.php:iWaitForAjaxToFinish this is in version ^4 (beta1) |
Found I had version spaghetti |
Glad you got it working :) |
I realise this is still happening, independent of behat version. Could someone confirm that in vendor/drupal/drupal-extension/src/Drupal/DrupalExtension/Context/MinkContext.php:153 they actually get a value for $this->getMinkParameter('ajax_timeout')? I only get NULL and hence a "Unable to complete AJAX request. {"name":"step.after","feature":"XXXXXXXX","step":"XXXXXXXXXXXXX","suite":"default"} (RuntimeException) When I set the ajax_timeout as you wrote then the first step in my scenario never runs and just sits there and waits. In the meanwhile I use this workaround and set an ajax_timeout in the suite /**
* Work around https://github.com/jhedstrom/drupalextension/issues/486
*
* @BeforeScenario
*/
public function beforeJavascriptScenario(BeforeScenarioScope $scope) {
$mink_context = $scope->getEnvironment()->getContext('Drupal\DrupalExtension\Context\MinkContext');
if (!$mink_context) {
return;
}
if (!$mink_context->getMinkParameter('ajax_timeout')) {
$suite = $scope->getEnvironment()->getSuite();
if ($suite->hasSetting('ajax_timeout')) {
$mink_context->setMinkParameter('ajax_timeout', $suite->getSetting('ajax_timeout'));
}
}
} |
Hi @miiimooo and @jhedstrom I'm getting the same error for tests that had passed using selenium2 with chrome instead of selenium2 without chrome (I'm not sure which browser is currently configured as it's not in the config). I recently switched to a different platform and am re-configuring behat for javascript tests. The wait timeout occurs at 12 seconds with the My step is using a custom context that uses |
@miiimooo Are you using the Drupal API driver or the drush driver? |
It looks like this is due to using drush without a selenium2 browser, I switched back to configuring selenium2 with chrome, and made sure chrome was running as instructed here: https://packagist.org/packages/dmore/chrome-mink-driver and the behat features requiring javascript worked as usual. |
I think some confusion here comes from it sounds like you only need to follow the instructions in #486 (comment) if you want to specify a custom timeout. But if you don't use Drupal\MinkExtension rather than Behat\MinkExtension in your behat.yml, you will not have the timeout variable at all, and iWaitForAjaxToFinish depends on it being set. Seems like maybe the documentation should change to use only Drupal\MinkExtension, or iWaitForAjaxToFinish should provide a default if one is not present. |
Yes this is a very good point @leevh. I propose we do a check and if the value of |
Thanks @leevh and @pfrenssen . That was exactly the problem! We've changed this in a number of projects now and the problem is gone |
However, when using So where is it? I'm using |
I'm equally confused by all of the above. I get the same error as @stevenlafl |
The |
I found this a bit tricky. To get it working, I had to split some configuration between Drupal\MinkExtension and Behat\MinkExtension:
|
Fwiw, I have come across this and can't seem to get around the issue. A simpler version of the code in miiimooo's post. But this isn't ideal (pt3). I had to remove the checks, as on mine the suite didn't contain the I'm using Acquia BLT which is probably important here. Using grasmash's answer didn't work for me - adding it as posted into my local.yml (only changing the pt1
pt2
pt3
|
For myself, the issue seemed to be due to BLT using drupal-extension 4x rather than 3x. I tried a variety of things, including all of the suggestions in here. The only thing that worked, was the solution @dmgig posted in #486 (comment) I modified this: to this: |
For myself, I find the existing
|
I have found a problem that click/select steps don't wait long enough (or at all?)
Trying to debug it I got this output:
You see I have added some debugging code to display the ajax_timeout.
The reference in master is here https://github.com/jhedstrom/drupalextension/blob/master/src/Drupal/DrupalExtension/Context/MinkContext.php#L153
I can't work out where to set this. I tried in behat.yml
I got
The text was updated successfully, but these errors were encountered: