Skip to content
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

Throw a helpful exception if the AJAX timeout is missing #528

Merged
merged 4 commits into from
Mar 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Changed
* [#528](https://github.com/jhedstrom/drupalextension/pull/528) Show a more helpful failure when running `@javascript`
scenarios with incorrect configuration.
### Added
* [#527](https://github.com/jhedstrom/drupalextension/pull/527) Provide a step to check that a button is not in a region.
## [4.0.0 beta2] 2018-12-19
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ the [Full documentation](https://behat-drupal-extension.readthedocs.org)
contexts:
- Drupal\DrupalExtension\Context\DrupalContext
extensions:
Behat\MinkExtension:
Drupal\MinkExtension:
goutte: ~
base_url: http://example.org/ # Replace with your site's URL
Drupal\DrupalExtension:
Expand Down
8 changes: 4 additions & 4 deletions behat.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ drupal6:
filters:
tags: "@d6"
extensions:
Behat\MinkExtension:
Drupal\MinkExtension:
base_url: http://127.0.0.1:8888
Drupal\DrupalExtension:
api_driver: "drupal"
Expand All @@ -67,7 +67,7 @@ drupal7:
filters:
tags: "@d7"
extensions:
Behat\MinkExtension:
Drupal\MinkExtension:
base_url: http://127.0.0.1:8888
Drupal\DrupalExtension:
api_driver: "drupal"
Expand All @@ -92,7 +92,7 @@ drush:
filters:
tags: "@drushTest"
extensions:
Behat\MinkExtension:
Drupal\MinkExtension:
base_url: http://127.0.0.1:8888
Drupal\DrupalExtension:
api_driver: "drush"
Expand All @@ -119,7 +119,7 @@ drupal8:
filters:
tags: "@d8&&~@d8wip"
extensions:
Behat\MinkExtension:
Drupal\MinkExtension:
base_url: http://127.0.0.1:8888
Drupal\DrupalExtension:
api_driver: "drupal"
Expand Down
8 changes: 4 additions & 4 deletions doc/environment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Example JSON object:

{
"extensions": {
"Behat\\MinkExtension": {
"Drupal\\MinkExtension": {
"base_url": "http://myproject.localhost"
},
"Drupal\\DrupalExtension": {
Expand All @@ -36,7 +36,7 @@ object into a single line and surround with single quotes:

.. code-block:: bash

$ export BEHAT_PARAMS='{"extensions":{"Behat\\MinkExtension":{"base_url":"http://myproject.localhost"},"Drupal\\DrupalExtension":{"drupal":{"drupal_root":"/var/www/myproject"}}}}'
$ export BEHAT_PARAMS='{"extensions":{"Drupal\\MinkExtension":{"base_url":"http://myproject.localhost"},"Drupal\\DrupalExtension":{"drupal":{"drupal_root":"/var/www/myproject"}}}}'

You must also remove (or comment out) the entries that you use in behat.yml for the values in BEHAT_PARAMS to take affect.

Expand All @@ -52,7 +52,7 @@ You must also remove (or comment out) the entries that you use in behat.yml for
- Drupal\DrupalExtension\Context\MessageContext
- Drupal\DrupalExtension\Context\DrushContext
extensions:
Behat\MinkExtension:
Drupal\MinkExtension:
goutte: ~
selenium2: ~
# Must comment out for BEHAT_PARAMS to be effective.
Expand All @@ -70,7 +70,7 @@ You must also remove (or comment out) the entries that you use in behat.yml for
# bin/behat --profile=local
local:
extensions:
Behat\MinkExtension:
Drupal\MinkExtension:
base_url: 'localhost'
Drupal\DrupalExtension:
drush:
Expand Down
2 changes: 1 addition & 1 deletion features/subcontexts/find.feature
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Feature: Ability to find Drupal sub-contexts
default:
contexts: [Drupal\DrupalExtension\Context\DrupalContext]
extensions:
Behat\MinkExtension:
Drupal\MinkExtension:
goutte: ~
selenium2: ~
base_url: http://drupal.org
Expand Down
6 changes: 5 additions & 1 deletion src/Drupal/DrupalExtension/Context/MinkContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,12 @@ function isAjaxing(instance) {
);
}());
JS;
$result = $this->getSession()->wait(1000 * $this->getMinkParameter('ajax_timeout'), $condition);
$ajax_timeout = $this->getMinkParameter('ajax_timeout');
$result = $this->getSession()->wait(1000 * $ajax_timeout, $condition);
if (!$result) {
if ($ajax_timeout === null) {
throw new \Exception('No AJAX timeout has been defined. Please verify that "Drupal\MinkExtension" is configured in behat.yml (and not "Behat\MinkExtension").');
}
if ($event) {
/** @var \Behat\Behat\Hook\Scope\BeforeStepScope $event */
$event_data = ' ' . json_encode([
Expand Down