valthebald/behat-screenshot-image-driver-rsync

bex/behat-screenshot 扩展的图像驱动程序,使用 rsync 协议将文件上传到远程服务器

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

This package is auto-updated.

Last update: 2024-09-19 09:57:04 UTC


README

此包是 bex/behat-screenshot behat 扩展的图像驱动程序,使用 rsync 协议将截图上传到远程服务器。

安装

通过在 composer.json 中添加来安装

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

配置

behat.yml 中 Behat-ScreenshotExtension 的配置中启用图像驱动程序,如下所示

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

必填参数

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!

可选参数

      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

用法

当你运行 behat 并且某个步骤失败时,Behat-ScreenshotExtension 将自动捕获截图并将其传递给图像驱动程序,该程序将上传它并返回上传图像的 URL。所以你将看到类似以下的内容

  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()