Url image driver for bex/behat-screenshot behat extension
This package is an image driver for the bex/behat-screenshot behat extension which can upload the screenshot to local web server dir and print the url of the uploaded image. If you are in a docker like environment then this extension provide the url in log output.
Install by adding to your
composer require --dev robertfausk/behat-screenshot-image-driver-url
Enable the image driver in the Behat-ScreenshotExtension's config in
default: extensions: Bex\Behat\ScreenshotExtension: active_image_drivers: url
You have to choose where to upload files and the web address:
default: extensions: Bex\Behat\ScreenshotExtension: active_image_drivers: url image_drivers: url: screenshot_directory: /var/www/html/public/screenshots # your local web server dir where the image gets saved screenshot_url: https://acme/screenshots # used for creation of web url; could also be something like https://localhost:9000/screenshots # you can use something similar in your ci: # screenshot_url: https://acme.test.my-company.com/screenshots
When a step fails a screenshot will be taken and put into web server directory. URL of the uploaded image will be displayed in the Behat log. So you can open it directly from log output:
Scenario: # features/feature.feature:2 Given I have a step # FeatureContext::passingStep() When I have a failing step # FeatureContext::failingStep() Error (Exception) Screenshot has been taken. Open image at /var/www/html/public/screenshots/IMAGE_LINK.png or https://acme/screenshots/IMAGE_LINK.png Then I should have a skipped step # FeatureContext::skippedStep()
Have a look at CHANGELOG for detailed information.