1. Go to this page and download the library: Download drevops/behat-screenshot library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
drevops / behat-screenshot example snippets
declare(strict_types=1);
use Behat\Config\Config;
use Behat\Config\Extension;
use Behat\Config\Profile;
use Behat\Config\Suite;
use DrevOps\BehatScreenshotExtension\Context\ScreenshotContext;
use DrevOps\BehatScreenshotExtension\ServiceContainer\BehatScreenshotExtension;
$suite = (new Suite('default'))
->withContexts(ScreenshotContext::class, 'FeatureContext');
$profile = (new Profile('default'))
->withSuite($suite)
->withExtension(new Extension(BehatScreenshotExtension::class));
return (new Config())->withProfile($profile);
declare(strict_types=1);
use Behat\Config\Config;
use Behat\Config\Extension;
use Behat\Config\Profile;
use Behat\Config\Suite;
use DrevOps\BehatScreenshotExtension\Context\ScreenshotContext;
use DrevOps\BehatScreenshotExtension\ServiceContainer\BehatScreenshotExtension;
$suite = (new Suite('default'))
->withContexts(ScreenshotContext::class, 'FeatureContext');
$extension = new Extension(BehatScreenshotExtension::class, [
'dir' => '%paths.base%/screenshots',
'on_failed' => TRUE,
'purge' => FALSE,
'always_fullscreen' => FALSE,
]);
$profile = (new Profile('default'))
->withSuite($suite)
->withExtension($extension);
return (new Config())->withProfile($profile);
$extension = new Extension(BehatScreenshotExtension::class, [
'always_fullscreen' => TRUE,
]);
$extension = new Extension(BehatScreenshotExtension::class, [
'on_every_step' => TRUE,
]);