robertfausk / behat-screenshot-image-driver-url
bex/behat-screenshot behat 扩展的 URL 图片驱动
v1.0.0
2020-03-30 07:31 UTC
Requires
- php: >=5.6
- bex/behat-screenshot: ^1.2
This package is auto-updated.
Last update: 2024-09-14 01:19:43 UTC
README
此包是 bex/behat-screenshot behat 扩展的图像驱动程序,可以将截图上传到本地 Web 服务器目录并打印上传图像的 URL。如果您在类似 Docker 的环境中,则此扩展将在日志输出中提供 URL。
安装
通过将以下内容添加到您的 composer.json
文件中安装:
composer require --dev robertfausk/behat-screenshot-image-driver-url
配置
在 behat.yml
文件中 Behat-ScreenshotExtension 的配置中启用图像驱动程序
default: extensions: Bex\Behat\ScreenshotExtension: active_image_drivers: url
您需要选择上传文件的位置和 Web 地址
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
用法
当步骤失败时,将捕获截图并将其放入 Web 服务器目录。上传图像的 URL 将在 Behat 日志中显示。因此,您可以直接从日志输出打开它。
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()
如何升级?
请参阅 变更日志 获取详细信息。