2017 © Pedro Peláez
 

behat-extension drupal-more-extensions

Extended Drupal extensions for Behat

image

dman-coders/drupal-more-extensions

Extended Drupal extensions for Behat

  • Tuesday, February 20, 2018
  • by dman-coders
  • Repository
  • 1 Watchers
  • 4 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

drupal-more-extensions

Extended Drupal extensions for Behat, (*1)

For setup instructions on getting testing for Drupal running, see the drupal-extension docs https://behat-drupal-extension.readthedocs.io/, (*2)

This set of 'Contexts' provides a few more sets of actions we can test., (*3)

Install

To include these contexts in your project:, (*4)

  • Include this library in your behat test project composer.json, (*5)

    { "require": { /* Other stuff */ "dman-coders/drupal-more-extensions": "~1.0@dev" }, "repositories": [ { "type": "vcs", "url": "git@github.com:jhedstrom/drupalextension.git" } ], }, (*6)

    And run composer update., (*7)

  • Include the DrupalMoreExtensions Context(s) in your behat.yml, (*8)

    default: suites: default: contexts: - FeatureContext - Drupal\DrupalExtension\Context\DrupalContext /* Other Stuff */ - Drupal\DrupalMoreExtensions\Context\BrowserContext - Drupal\DrupalMoreExtensions\Context\ScreenshotContext: params: path: 'screenshots' timestamped: false, (*9)

    And you should see the new commands become available., (*10)

Features

The actions listed here may be incomplete. Run: behat -dl to list the real state of available definitions. behat -di to show the associated action help., (*11)

Screenshotting actions.

Drupal\DrupalMoreExtensions\Context\ScreenshotContext
  • @Given the viewport is :arg1
  • @Given the viewport is wide/medium/narrow/mobile
  • @Then I take a screenshot and save as :arg1
  • @Then /^take a screenshot of "([^"])" and save as "([^"])"$/

And some runtime debug additions:, (*12)

  • @Then /^show me a screenshot$/
  • @Then /^show me the HTML page$/

Some additional utility actions for interacting with a web page.

Drupal\DrupalMoreExtensions\Context\BrowserContext
  • @Given I wait :arg1 seconds
  • I select vertical tab "#edit-options"
  • @Then /^I fill in ckeditor on field "([^"])" with "([^"])"$/
  • @Then /^I fill in tinymce on field "([^"])" with "([^"])"$/

Some additional utility actions for logging in to Drupal

Drupal\DrupalMoreExtensions\Context\DrupalLoginContext
  • @Given I log in to Drupal as :arg1 with password :arg2
  • @Given I log in to OpenID as :arg1 with password :arg2
  • @Given I remember cookies
  • @Given I am logged in as user :name
  • @Given I am authenticated with Drupal as (user) :arg1 with password :arg2
  • @Given I reset the admin password to :arg1
  • @Given I am logged in as the superuser

Installation

To include these new steps and actions,, (*13)

In behat.yml, include:, (*14)

default:
  suites:
    default:
      contexts:
        - Drupal\DrupalMoreExtensions\Context\DrupalLoginContext

If you want to use the "I am logged in as user :name" action, pre-configure some users as below. This will NOT create these users, use this to leverage existing accounts., (*15)

      ...
        - Drupal\DrupalMoreExtensions\Context\DrupalLoginContext:
            users:
              admin:
                name: admin
                pass: adminpass
              member:
                name: "tester"
                pass: "tester"

The Versions

20/02 2018

1.0.x-dev

1.0.9999999.9999999-dev https://github.com/dman-coders/drupal-more-extensions

Extended Drupal extensions for Behat

  Sources   Download

GPL-2.0+

The Requires

 

by Dan Morrison

test drupal web