The Palantir Behat Drupal Extension provides additional step definitions for testing Drupal sites using Behat, Mink Extension.
Drupal 8 is supported using the drupal8
branch, but all of the available steps and methods currently throw a NotUpdatedException
. Please update them as you need them for your projects!
Drupal 7 is supported using the master
branch.
NodeContext
: test viewing and editing nodes by titleDrupalCommentContext
: test commenting functionalityDrupalFileContext
: add files in your tests (see PR #3 for usage details)DrupalOrganicGroupsContext
: test access to Organic GroupsDrupalSetupContext
: test for enabled modules and overridden featuresEntityDataContext
: test field data and properties on nodes, terms, and users directly, without relying on output (or write a simpletest...)
DrupalAutoNodetitleContext
: tag scenarios with@disableAutoNodetitle
to bypass automatic title generation; sometimes this is required in order to have predictable test contentDrupalWorkbenchModerationContext
: tag scenarios with@disableWorkbenchModeration
to bypass moderation
MarkupContext
: extend this class to use theassertRegionElementText
method, and encapsulate complex markup in a custom context rather than in the Gherkin acceptance criteria
If you are already using the Drupal\DrupalExtension
Behat extension, it is very easy to add these contexts--and if not, go set that up before attempting to use these custom contexts.
First, add this package to your composer.json
file:
"repositories": [
{
"type": "vcs",
"url": "[email protected]:palantirnet/palantir-behat-extension.git"
}
],
"require-dev": {
"palantirnet/palantir-behat-extension": "dev-drupal8"
},
Then, add the specific contexts you want to use to your project's behat.yml
file:
default:
suites:
default:
contexts:
- Palantirnet\PalantirBehatExtension\Context\DrupalAutoNodetitleContext
- Palantirnet\PalantirBehatExtension\Context\DrupalCommentContext
- Palantirnet\PalantirBehatExtension\Context\DrupalOrganicGroupsContext
- Palantirnet\PalantirBehatExtension\Context\DrupalSetupContext
- Palantirnet\PalantirBehatExtension\Context\DrupalWorkbenchModerationContext
- Palantirnet\PalantirBehatExtension\Context\EntityDataContext
- Palantirnet\PalantirBehatExtension\Context\MarkupContext
- Palantirnet\PalantirBehatExtension\Context\NodeContext
- Palantirnet\PalantirBehatExtension\Context\SharedDrupalContext
@copyright (c) Copyright 2015 Palantir.net, Inc.