You are here

public function SocialMinkContext::takeScreenShotAfterFailedStep in Open Social 10.3.x

Same name and namespace in other branches
  1. 8.9 tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::takeScreenShotAfterFailedStep()
  2. 8.3 tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::takeScreenShotAfterFailedStep()
  3. 8.4 tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::takeScreenShotAfterFailedStep()
  4. 8.5 tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::takeScreenShotAfterFailedStep()
  5. 8.6 tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::takeScreenShotAfterFailedStep()
  6. 8.7 tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::takeScreenShotAfterFailedStep()
  7. 8.8 tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::takeScreenShotAfterFailedStep()
  8. 10.0.x tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::takeScreenShotAfterFailedStep()
  9. 10.1.x tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::takeScreenShotAfterFailedStep()
  10. 10.2.x tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::takeScreenShotAfterFailedStep()

@AfterStep

File

tests/behat/features/bootstrap/SocialMinkContext.php, line 122

Class

SocialMinkContext
Defines application features from the specific context.

Namespace

Drupal\social\Behat

Code

public function takeScreenShotAfterFailedStep(AfterStepScope $scope) {
  if (99 === $scope
    ->getTestResult()
    ->getResultCode()) {
    $driver = $this
      ->getSession()
      ->getDriver();
    if (!$driver instanceof Selenium2Driver) {
      return;
    }
    $feature = $scope
      ->getFeature();
    $title = $feature
      ->getTitle();
    $filename = date("Ymd-H_i_s");
    if (!empty($title)) {
      $filename .= '-' . str_replace(' ', '-', strtolower($title));
    }
    $filename .= '-error';
    $this
      ->iMakeAScreenshotWithFileName($filename);
  }
}