Debug message when pasting text
All checks were successful
Push image to registry / build-image (push) Successful in 4m46s
All checks were successful
Push image to registry / build-image (push) Successful in 4m46s
This commit is contained in:
@ -5,6 +5,7 @@ namespace App\Browser;
|
|||||||
use App\Models\Job;
|
use App\Models\Job;
|
||||||
use App\Models\JobArtifact;
|
use App\Models\JobArtifact;
|
||||||
use App\Models\JobRun;
|
use App\Models\JobRun;
|
||||||
|
use App\Notification\Notifications\JobDebugNotification;
|
||||||
use App\Notification\Notifications\JobErrorNotification;
|
use App\Notification\Notifications\JobErrorNotification;
|
||||||
use App\Notification\Providers\AllNotification;
|
use App\Notification\Providers\AllNotification;
|
||||||
use Closure;
|
use Closure;
|
||||||
@ -22,6 +23,7 @@ use Illuminate\Queue\SerializesModels;
|
|||||||
use Laravel\Dusk\Browser;
|
use Laravel\Dusk\Browser;
|
||||||
use Laravel\Dusk\Chrome\SupportsChrome;
|
use Laravel\Dusk\Chrome\SupportsChrome;
|
||||||
use Laravel\Dusk\Concerns\ProvidesBrowser;
|
use Laravel\Dusk\Concerns\ProvidesBrowser;
|
||||||
|
use Log;
|
||||||
use PHPUnit\Framework\Attributes\BeforeClass;
|
use PHPUnit\Framework\Attributes\BeforeClass;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
||||||
@ -333,6 +335,7 @@ abstract class BrowserJob implements ShouldQueue
|
|||||||
*/
|
*/
|
||||||
public function pasteText(Browser $browser, string $text, string $querySelector): void
|
public function pasteText(Browser $browser, string $text, string $querySelector): void
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
$text = $this->parseJavaScriptString($text);
|
$text = $this->parseJavaScriptString($text);
|
||||||
$querySelector = $this->parseJavaScriptString($querySelector);
|
$querySelector = $this->parseJavaScriptString($querySelector);
|
||||||
|
|
||||||
@ -347,5 +350,11 @@ abstract class BrowserJob implements ShouldQueue
|
|||||||
});
|
});
|
||||||
el.dispatchEvent(event)
|
el.dispatchEvent(event)
|
||||||
");
|
");
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$errorMessage = "Failed to paste text into element: {$querySelector} - " . $e->getMessage() . "\n With text: {$text}";
|
||||||
|
Log::error($errorMessage);
|
||||||
|
$browser->screenshot(JobDebugScreenshot::getFileName($this->jobId));
|
||||||
|
AllNotification::send(new JobDebugNotification($this->jobId, $errorMessage));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user