Download the PHP package metadrop/behat-contexts without Composer

On this page you can find all versions of the php package metadrop/behat-contexts. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package behat-contexts

Behat Contexts for Drupal

Contexts that we use with Behat 3.x tests on Drupal sites.

This repository is based on Nuvole drupal extension.

Install

Install with Composer:

composer require metadrop/behat-contexts

Configure

Each context may have its own configuration. Here is an example with all the contexts added.

Contexts

Cache context

Steps to clear caches.

Steps

Content authored context

Allow created content owned by logged in user.

Steps

Cron context

Helpers to execute cron.

Steps

DebugContext

Simple context to help debugging tests with some steps. Additionally, it hooks in the after step event to add a step that generates an error report on failed steps.

This report includes:

Cookie compliance context

Allows checking that the sites are cookie GDPR compliant. This context works with any cookie banner integration : onetrust, cookies, eu cookie compliance...

It checks that before accepting cookies there are not cookies saved in the browser, and when the cookies are accepted, the expected cookies appears.

The context parameters are:

Example configuration:

Steps included in this context:

Steps

Configuration

Add DebugContext to your suite.

This is an example when bootstrap directorty is in DRUPALROOT/sites/all/tests/behat/bootstrap.

Parameters

Entity Context

Agnostic steps related with entities.

Steps

File context

Create files in drupal.

Steps

Form Context

Steps for form elements.

Steps

Node Access context

Steps related with node access system. Only for D7.

Steps

Paragraphs context

Steps to attach paragraphs to content.

Steps

Url Context

Steps to check url values

Steps

UIContext

This context provides steps for certain UI elements.

Steps

Example of how to use internal method elementShouldBeInPosition

/**
* Example of implementation elementShouldBeInPosition on a custom step.
*
* @Then the card on the infinite scroll view with title :title should be in position :position.
*/
public function theCardWithTitleShouldBeInPositionExample(string $title, string $position) {
  $this->elementShouldBeInPosition('item-list-css-selector', $title, 'views-infinite-scroll-content-wrapper', $position);
}

WaitingContext

This context provides waiting time after defined steps, and extra waiting steps.

Waiting steps - Sometimes steps are running faster than our site, if this is the case you can delay them a few seconds. Don't abuse of this functionality, if Behat is running slow maybe there is a performance global site issue that needs to be solved first!

Steps

- Then I wait for :seconds second(s)
  Step wait a defined seconds before execute next step.

Configure some waiting time before execute next step

Set on behat.yml step action with wait time in seconds before execute next step.

Configuration
Action

Wait 1 second before the next step to Then I press "Log in" (Then the url should match "/example-page")

Configuration

No configuration needed.


All versions of behat-contexts with dependencies

PHP Build Version
Package Version
Requires nuvoleweb/drupal-behat Version ^1.3
symfony/console Version ^4 || ^5 || ^6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package metadrop/behat-contexts contains the following files

Loading the files please wait ....