Skip to content

Instantly share code, notes, and snippets.

@sam452
Created April 24, 2018 14:41
Show Gist options
  • Save sam452/5a4d8240fe02965c1feaf59da43964ae to your computer and use it in GitHub Desktop.
Save sam452/5a4d8240fe02965c1feaf59da43964ae to your computer and use it in GitHub Desktop.
default:
suites:
default:
contexts:
- FeatureContext
- Drupal\DrupalExtension\Context\DrupalContext
- Drupal\DrupalExtension\Context\MinkContext
- Drupal\DrupalExtension\Context\MessageContext
- Drupal\DrupalExtension\Context\DrushContext
extensions:
Behat\MinkExtension:
goutte: ~
selenium2: ~
base_url: http://newhabi.biz
# wd_host: http://newhabit.biz:4444
# capabilities: {"browser": "firefox"}
Drupal\DrupalExtension:
blackbox: ~
api_driver: 'drush'
drush:
alias: 'newhabi.biz'
region_map:
region: '#footer'
@api
Feature: Drush driver
In order to show functionality added by the Drush driver
As a trainer
I need to use the step definitions it supports
Scenario: Drush alias
Given I am logged in as a user with the "authenticated user" role
When I click "My account"
Then I should see the heading "History"
Scenario: Target links within table rows
Given I am logged in as a user with the "administrator" role
When I am at "admin/structure/types"
And I click "manage fields" in the "Article" row
Then I should be on "admin/structure/types/manage/article/fields"
And I should see text matching "Add new field"
Scenario: Clear cache
Given the cache has been cleared
When I am on the homepage
Then I should get a "200" HTTP response
Scenario: Create and log in as a user
Given I am logged in as a user with the "authenticated user" role
When I click "My account"
Then I should see the heading "History"
Scenario: Target links within table rows
Given I am logged in as a user with the "administrator" role
When I am at "admin/structure/types"
And I click "manage fields" in the "Article" row
Then I should be on "admin/structure/types/manage/article/fields"
And I should see text matching "Add new field"
<?php
use Drupal\DrupalExtension\Context\RawDrupalContext;
use Behat\Behat\Context\SnippetAcceptingContext;
use Behat\Gherkin\Node\PyStringNode;
use Behat\Gherkin\Node\TableNode;
use Behat\Behat\Tester\Exception\PendingException;
/**
* Defines application features from the specific context.
*/
class FeatureContext extends RawDrupalContext implements SnippetAcceptingContext {
/**
* Initializes context.
*
* Every scenario gets its own context instance.
* You can also pass arbitrary arguments to the
* context constructor through behat.yml.
*/
public function __construct() {
}
/**
* @Given I am loggin in as a user with the :arg1 role
*/
public function iAmLogginInAsAUserWithTheRole($arg1)
{
throw new PendingException();
}
/**
* @Then I should see text :arg1
*/
public function iShouldSeeText($arg1)
{
throw new PendingException();}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment