diff --git a/src/Browser.php b/src/Browser.php index 8a9e344cd..bd5f7c1d0 100644 --- a/src/Browser.php +++ b/src/Browser.php @@ -27,6 +27,13 @@ class Browser */ public static $baseUrl; + /** + * The directory to place screenshots. + * + * @var string + */ + public static $screenshotDir; + /** * Get the callback which resolves the default user to authenticate. * @@ -175,7 +182,7 @@ public function resize($width, $height) */ public function screenshot($name) { - $this->driver->takeScreenshot(base_path('tests/Browser/screenshots/'.$name.'.png')); + $this->driver->takeScreenshot(sprintf('%s/%s.png', rtrim(static::$screenshotDir, '/'), $name)); return $this; } diff --git a/src/TestCase.php b/src/TestCase.php index 3ca99fc92..85f2542be 100644 --- a/src/TestCase.php +++ b/src/TestCase.php @@ -38,6 +38,7 @@ abstract class TestCase extends FoundationTestCase public function propagateScaffoldingToBrowser() { Browser::$baseUrl = $this->baseUrl(); + Browser::$screenshotDir = base_path('tests/Browser/screenshots'); Browser::$userResolver = function () { return $this->user();