Permalink
Browse files

- Merge [4586].

  • Loading branch information...
1 parent 43852ec commit 42c7fed36eb84d929293ead021b946939532adc3 @sebastianbergmann committed Jan 31, 2009
Showing with 24 additions and 0 deletions.
  1. +24 −0 PHPUnit/Extensions/SeleniumTestCase.php
@@ -115,6 +115,21 @@
protected $verificationErrors = array();
/**
+ * @var boolean
+ */
+ protected $captureScreenshotOnFailure = FALSE;
+
+ /**
+ * @var string
+ */
+ protected $screenshotPath = '';
+
+ /**
+ * @var string
+ */
+ protected $screenshotUrl = '';
+
+ /**
* @param string $name
* @param array $data
* @param string $dataName
@@ -366,6 +381,15 @@ protected function runTest()
$buffer = 'Current URL: ' . $this->drivers[0]->getLocation() . "\n";
$message = $e->getCustomMessage();
+ if ($this->captureScreenshotOnFailure &&
+ !empty($this->screenshotPath) && !empty($this->screenshotUrl)) {
+ $this->captureScreenshot(
+ $this->screenshotPath . DIRECTORY_SEPARATOR . $this->testId . '.png'
+ );
+
+ $buffer .= 'Screenshot: ' . $this->screenshotUrl . '/' . $this->testId . ".png\n";
+ }
+
if (!empty($message)) {
$buffer .= "\n" . $message;
}

0 comments on commit 42c7fed

Please sign in to comment.