|
@@ 30-51 (lines=22) @@
|
| 27 |
|
{ |
| 28 |
|
$this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'visualdiff'); |
| 29 |
|
|
| 30 |
|
TestResponse::macro('visualDiff', function ($name = null, $resolutions = null) { |
| 31 |
|
|
| 32 |
|
if (is_null($name)) { |
| 33 |
|
// Guess the test name from the backtrace |
| 34 |
|
$name = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 5)[4]['function']; |
| 35 |
|
} |
| 36 |
|
|
| 37 |
|
$testResolutions = config('visualdiff.resolutions'); |
| 38 |
|
|
| 39 |
|
if (! is_null($resolutions)) { |
| 40 |
|
$testResolutions = $resolutions; |
| 41 |
|
} |
| 42 |
|
|
| 43 |
|
$tester = new VisualDiffTester($this->content(), $name, $testResolutions); |
| 44 |
|
|
| 45 |
|
$tester->setScreenshotOutputPath(config('visualdiff.screenshot_path')); |
| 46 |
|
$tester->setDiffOutputPath(config('visualdiff.diff_path')); |
| 47 |
|
|
| 48 |
|
$tester->createDiffs(); |
| 49 |
|
|
| 50 |
|
return $this; |
| 51 |
|
}); |
| 52 |
|
|
| 53 |
|
TestResponse::macro('visualDiffForResolutions', function (array $resolutions, $name = null) { |
| 54 |
|
if (is_null($name)) { |
|
@@ 63-85 (lines=23) @@
|
| 60 |
|
}); |
| 61 |
|
|
| 62 |
|
if (class_exists(Browser::class)) { |
| 63 |
|
Browser::macro('visualDiff', function ($name = null, $resolutions = null) { |
| 64 |
|
|
| 65 |
|
if (is_null($name)) { |
| 66 |
|
// Guess the test name from the backtrace |
| 67 |
|
$name = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 7)[6]['function']; |
| 68 |
|
} |
| 69 |
|
|
| 70 |
|
$testResolutions = config('visualdiff.resolutions'); |
| 71 |
|
|
| 72 |
|
if (! is_null($resolutions)) { |
| 73 |
|
$testResolutions = $resolutions; |
| 74 |
|
} |
| 75 |
|
|
| 76 |
|
$tester = new DuskVisualDiffTester('', $name, $testResolutions); |
| 77 |
|
$tester->setBrowser($this); |
| 78 |
|
|
| 79 |
|
$tester->setScreenshotOutputPath(config('visualdiff.screenshot_path')); |
| 80 |
|
$tester->setDiffOutputPath(config('visualdiff.diff_path')); |
| 81 |
|
|
| 82 |
|
$tester->createDiffs(); |
| 83 |
|
|
| 84 |
|
return $this; |
| 85 |
|
}); |
| 86 |
|
|
| 87 |
|
Browser::macro('visualDiffForResolutions', function (array $resolutions, $name = null) { |
| 88 |
|
if (is_null($name)) { |