GithubHelp home page GithubHelp logo

mah-sanjay / behat-steps Goto Github PK

View Code? Open in Web Editor NEW

This project forked from drevops/behat-steps

0.0 0.0 0.0 588 KB

A collection of Behat step definitions for Drupal

License: GNU General Public License v3.0

Shell 1.20% PHP 70.49% HTML 5.10% Dockerfile 0.07% Gherkin 23.14%

behat-steps's Introduction

Behat steps logo

A collection of Behat steps for Drupal

GitHub Issues GitHub Pull Requests CircleCI codecov GitHub release (latest by date) LICENSE Renovate

Total Downloads


Installation

composer require --dev drevops/behat-steps:^2

Usage

Add required traits to your FeatureContext.php (example):

<?php

use Drupal\DrupalExtension\Context\DrupalContext;
use DrevOps\BehatSteps\ContentTrait;

/**
 * Defines application features from the specific context.
 */
class FeatureContext extends DrupalContext {

  use ContentTrait;

}

Modification of behat.yml configuration is not required.

Exceptions

  • \Exception is thrown for all assertions.
  • \RuntimeException is thrown for any unfulfilled requirements within a step.

Available steps

Use behat -d l to list all available step definitions.

There are also several pre- and post-scenario hooks that perform data alterations and cleanup.

Skipping before scenario hooks

Some traits provide beforeScenario hook implementations. These can be disabled by adding behat-steps-skip:METHOD_NAME tag to your test.

For example, to skip beforeScenario hook from JsTrait, add @behat-steps-skip:jsBeforeScenarioInit tag to the feature.

Development

Local environment setup

Use ahoy --help to see the list of available commands.

Apple Silicon adjustments

cp docker-compose.override.default.yml docker-compose.override.yml

Running tests

The source code of traits is tested by running Behat tests in the same way they would be run in your project: traits are included into FeatureContext.php and then ran on the pre-configured fixture Drupal site using test features.

Run ahoy build to setup a fixture Drupal site in the build directory.

ahoy test-bdd                # Run all tests

ahoy test-bdd path/to/file   # Run all scenarios in specific feature file

ahoy test-bdd -- --tags=wip  # Run all scenarios tagged with `@wip` tag

Debugging tests

  • ahoy debug
  • Set breakpoint
  • Run tests with ahoy test-bdd - your IDE will pickup an incoming debug connection

Updating fixture site

  • Build the fixture site and make the required changes
  • ahoy drush cex -y
  • ahoy update-fixtures to copy configuration changes from build directory to the fixtures directory

behat-steps's People

Contributors

alexskrypnyk avatar renovate[bot] avatar aieksandr avatar richardgaunt avatar tannguyen04 avatar xurizaemon avatar joshua1234511 avatar piggito avatar jrfnl avatar rosk0 avatar steveworley avatar ericgsmith avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.