Files
DatBrowser/app/Browser/JobErrorScreenshot.php
Matthias Guillitte 31c293e4a6
All checks were successful
Push image to registry / build-image (push) Successful in 6m15s
Reverted temporary debugs and fix failure screenshot
2025-06-04 15:59:55 +02:00

28 lines
816 B
PHP

<?php
namespace App\Browser;
use Laravel\Dusk\Browser;
use function rtrim;
class JobErrorScreenshot {
public const IMG_FILE_NAME = "failure-";
public static function getFileName(int $jobId, bool $withExtension = false): string {
return static::IMG_FILE_NAME . $jobId . ($withExtension ? ".png": "");
}
public static function getImgFileAbsolutePath(int $jobId): string {
return rtrim(Browser::$storeScreenshotsAt, '/') . "/" . static::getFileName($jobId, true);
}
public static function getImgFileProjectPath(int $jobId): string {
return app_path("Browser/screenshots/" . static::getFileName($jobId, true));
}
public static function getImgFileExternalPath(int $jobId): string {
return "screenshots/" . static::getFileName($jobId, true);
}
}