openeuropa/behat-transformation-context

Behat package to transform human readable labels into selectors or page paths.

0.1.2 2019-05-07 12:59 UTC

This package is auto-updated.

Last update: 2021-04-14 12:51:18 UTC


README

Build Status Packagist

This package provides a Behat context allowing to transform human readable labels to selectors or page paths. Such functionality improves the readability of the Behat tests.

Installation

$ composer require openeuropa/behat-transformation-context

Configuration

Add the extension and context to your test suite in behat.yml:

default:
  suites:
    default:
      contexts:
        - OpenEuropa\Behat\TransformationContext:
            elements:
              header: 'div#header'
            pages:
              home: 'index.php'

Usage

We can use steps such as these:

    Given I point to *the home page*
    Then previous step targets "*index.php*"
    When I point to the "*header*" element
    Then previous step targets "*div#header*"

Development

Running tests locally:

$ git clone git@github.com:openeuropa/behat-transformation-context.git
$ cd behat-transformation-context
$ composer install
$ ./vendor/bin/behat

Using Docker Compose

The setup procedure described above can be sensitively simplified by using Docker Compose.

Requirements:

Run:

$ docker-compose up -d

Then:

$ docker-compose exec web composer install

GrumPHP tasks will be ran at every commit, if you with to run them without performing a commit use the following command:

$ ./vendor/bin/grumphp run

If you want to simulate a commit message use:

$ ./vendor/bin/grumphp git:pre-commit