Initial Commit
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Process;
|
||||
|
||||
abstract class RunsPlaywrightScript extends Command
|
||||
{
|
||||
protected string $script;
|
||||
protected int $processTimeout = 300;
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$this->info("Running {$this->script}...");
|
||||
|
||||
$result = Process::path(base_path('playwright'))
|
||||
->timeout($this->processTimeout)
|
||||
->run("npx playwright test {$this->script} --reporter=line");
|
||||
|
||||
$this->line($result->output());
|
||||
|
||||
if (! $result->successful()) {
|
||||
$this->error($result->errorOutput());
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
$this->afterRun();
|
||||
|
||||
$this->info('Done.');
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
protected function afterRun(): void
|
||||
{
|
||||
// no-op by default
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user