2017 © Pedro Peláez
 

library behat-screenshot

Behat Context to capture screenshots from failed tests

image

integratedexperts/behat-screenshot

Behat Context to capture screenshots from failed tests

  • Friday, June 15, 2018
  • by alexdesignworks
  • Repository
  • 2 Watchers
  • 8 Stars
  • 32,383 Installations
  • PHP
  • 5 Dependents
  • 0 Suggesters
  • 4 Forks
  • 1 Open issues
  • 18 Versions
  • 33 % Grown

The README.md

Behat Screenshot Extension

Behat extension and a step definition to create HTML and image screenshots on demand or test fail., (*1)

CircleCI Latest Stable Version Total Downloads License, (*2)

Features

  • Create a screenshot using I save screenshot or save screenshot step definition.
  • Create a screenshot when test fails.
  • Screenshot is saved as HTML page for Goutte driver.
  • Screenshot is saved as both HTML and PNG image for Selenium driver.
  • Screenshot directory can be specified through environment variable BEHAT_SCREENSHOT_DIR (useful for CI systems to override values in behat.yml).
  • Screenshots can be purged after every test run by setting purge: true (useful during test debugging).

Installation

composer require integratedexperts/behat-screenshot, (*3)

Usage

Example behat.yml:, (*4)

default:
  suites:
    default:
      contexts:
        - IntegratedExperts\BehatScreenshotExtension\Context\ScreenshotContext
        - FeatureContext
  extensions:
    IntegratedExperts\BehatScreenshotExtension:
      dir: %paths.base%/screenshots
      fail: true
      purge: false

In your feature:, (*5)

  Given I am on "http://google.com"  
  Then I save screenshot

Options

  • dir: path/to/dir, (*6)

    Path to directory to save scereenshots. Directory structure will be created if the directory does not exist., (*7)

  • fail: true or false, (*8)

    Prefix failed screenshots with 'fail_' string. Useful to distinguish failed and intended screenshots., (*9)

  • purge: false or false, (*10)

    Remove all files from the screenshots directory on each test run. Useful during debugging of tests., (*11)

Maintenance

Local development setup

  1. Install Docker.
  2. Start environment: composer docker:start.
  3. Install dependencies: composer docker:cli -- composer install --ansi --no-suggest.

Lint code

composer docker:cli -- composer lint

Run tests

composer docker:cli -- composer test

Cleanup an environment

composer cleanup

The Versions

15/06 2018
30/05 2018

dev-feature/remove-drupal-extension

dev-feature/remove-drupal-extension

Behat Context to capture screenshots from failed tests

  Sources   Download

GPL-2.0-or-later

The Requires

 

The Development Requires

by Alex Skrypnyk
by Alexander Sharkov

26/03 2018

dev-feature/fix-selenium-version

dev-feature/fix-selenium-version

Behat Context to capture screenshots from failed tests

  Sources   Download

GPL-2.0-or-later

The Requires

 

The Development Requires

by Alex Skrypnyk
by Alexander Sharkov

08/01 2018

dev-feature/driver-support

dev-feature/driver-support

Behat Context to capture screenshots from failed tests

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Alex Skrypnyk
by Alexander Sharkov

07/08 2017

dev-revert-14-htmlpngoptions

dev-revert-14-htmlpngoptions

Behat Context to capture screenshots from failed tests

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Alex Skrypnyk
by Alexander Sharkov