MinkDebugExtension
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.
Installation
Assuming you already have Composer:
composer require lakion/mink-debug-extension
Then you only need to configure your Behat profile:
default:
extensions:
Lakion\Behat\MinkDebugExtension:
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 yourbehat.yml
isscreenshot
(defaultfalse
) - whether to save screenshots if usingSelenium2Driver
clean_start
(defaulttrue
) - whether to clean your existing logs on each Behat execution
Scripts
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 termbin.com 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 README.md
Uploading screenshots
vendor/bin/upload-screenshots "<glob_path>"
- uploades images to imgur.com 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
Testing
In order to test the extensions run:
composer install
bin/phpspec run
bin/behat --strict
Authors
MinkDebugExtension was originally created by Kamil Kokot. See the list of contributors.