Debug extension for Behat

Installs: 874 398

Dependents: 257

Suggesters: 0

Security: 0

Stars: 158

Watchers: 10

Forks: 10


v1.2.3 2016-10-27 15:30 UTC

This package is not auto-updated.

Last update: 2020-11-11 05:16:56 UTC


License Version Total Downloads Build status... Scrutinizer Quality Score

MinkDebugExtension is a Behat extension made for debugging and logging Mink related data after every failed step. It is especially useful while running tests on continuous integration server like Travis. While using Selenium2 driver, you can also save screenshots just after the failure.

Moreover, it comes bundled with some useful scripts, that will make uploading logs and screenshots extremely easy.


Assuming you already have Composer:

composer require lakion/mink-debug-extension

Then you only need to configure your Behat profile:

            directory: directory-where-to-save-logs

Configuration reference

Under Lakion\Behat\MinkDebugExtension there are three options to be configured:

  • directory (required to enable extension) - contains path to directory that will contain generated logs. Use the variable %paths.base% to refer to the directory where your behat.yml is
  • screenshot (default false) - whether to save screenshots if using Selenium2Driver
  • clean_start (default true) - whether to clean your existing logs on each Behat execution


MinkDebugExtension comes with three tiny, but powerful scripts. They will be installed to your config.bin-dir directory, which is vendor/bin by default.

Uploading textfiles

vendor/bin/upload-textfiles "<glob_path>" - uploades file contents to and returns a list of file names and urls to uploaded content.

Glob paths must be quoted to work correctly. Usage:

$ vendor/bin/upload-textfiles "logs/*.log"
$ vendor/bin/upload-textfiles

Uploading screenshots

vendor/bin/upload-screenshots "<glob_path>" - uploades images to and returns a list of file names and theirs urls.

Glob paths must be quoted to work correctly. Requires Imgur API key to be set as environmental variable $IMGUR_API_KEY. Usage:

$ export IMGUR_API_KEY="imgur api key"

$ vendor/bin/upload-screenshots "logs/*.png"
$ vendor/bin/upload-screenshots favicon.ico

Waiting for port to be taken

vendor/bin/wait-for-port <port> [limit = 15] [interval = 1] - waits for service to appear at localhost at a given port, useful while waiting for Selenium or webserver to warm up.

Limit is the number of tries, interval is the delay in seconds between another tries. Usage:

$ java -jar selenium.jar &

$ vendor/bin/wait-for-port 4444


In order to test the extensions run:

composer install
bin/phpspec run
bin/behat --strict


MinkDebugExtension was originally created by Kamil Kokot. See the list of contributors.