Behat package to transform human readable labels into selectors or page paths.
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.
$ composer require openeuropa/behat-transformation-context
Add the extension and context to your test suite in
default: suites: default: contexts: - OpenEuropa\Behat\TransformationContext: elements: header: 'div#header' pages: home: 'index.php'
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*"
Running tests locally:
$ git clone email@example.com:openeuropa/behat-transformation-context.git $ cd behat-transformation-context $ composer install $ ./vendor/bin/behat
The setup procedure described above can be sensitively simplified by using Docker Compose.
$ docker-compose up -d
$ 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
To enable step debugging from the command line, pass the
XDEBUG_SESSION environment variable with any value to
docker-compose exec -e XDEBUG_SESSION=1 web <your command>
Please note that, starting from XDebug 3, a connection error message will be outputted in the console if the variable is set but your client is not listening for debugging connections. The error message will cause false negatives for PHPUnit tests.
To initiate step debugging from the browser, set the correct cookie using a browser extension or a bookmarklet like the ones generated at https://www.jetbrains.com/phpstorm/marklets/.