valthebald/behat-screenshot-image-driver-rsync

Image driver for bex/behat-screenshot extension that uploads files to remote server using rsync

dev-master 2018-12-18 21:15 UTC

This package is auto-updated.

Last update: 2024-04-19 08:57:07 UTC


README

This package is an image driver for the bex/behat-screenshot behat extension which uploads screenshots to remote server using rsync protocol.

Installation

Install by adding to your composer.json:

composer require --dev valthebald/behat-screenshot-image-driver-rsync

Configuration

Enable the image driver in the Behat-ScreenshotExtension's config in behat.yml like this:

default:
  extensions:
    Bex\Behat\ScreenshotExtension:
      active_image_drivers: rsync

Required parameters:

default:
  extensions:
    Bex\Behat\ScreenshotExtension:
      active_image_drivers: rsync
      image_drivers:
        rsync:
          server: remote.example.com
          username: username
          path: /full/path/to/screenshots/folder # No trailing slash here!

Optional parameters:

      image_drivers:
        rsync:
          ssh_options: "ssh -i private_file.pem -p 2222" # This parameter will be passed as -e to rsync command
          preview_url: "https://remote.example.com/scheenshots/folder" # If screenshots folder is accessible via HTTP/S

Usage

When you run behat and a step fails then the Behat-ScreenshotExtension will automatically take the screenshot and will pass it to the image driver, which will upload it and returns the URL of the uploaded image. So you will see something like this:

  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 https://remote.example.com/scheenshots/folder/feature88_step2.png
    Then I should have a skipped step # FeatureContext::skippedStep()