diff --git a/composer.json b/composer.json index d3f591b..f9259c7 100644 --- a/composer.json +++ b/composer.json @@ -45,6 +45,7 @@ "phpunit/phpunit": "^10.0", "rector/rector": "^0.19", "symfony/framework-bundle": "^6.4|^7.0", + "symfony/panther": "^2.1", "symfony/phpunit-bridge": "^6.4|^7.0", "symplify/easy-coding-standard": "^12.0" }, diff --git a/src/Command/SectionProcessor/ApplicationScreenshotsSectionProcessor.php b/src/Command/SectionProcessor/ApplicationScreenshotsSectionProcessor.php index a43a6e9..8c92c74 100644 --- a/src/Command/SectionProcessor/ApplicationScreenshotsSectionProcessor.php +++ b/src/Command/SectionProcessor/ApplicationScreenshotsSectionProcessor.php @@ -4,11 +4,12 @@ namespace SpomkyLabs\PwaBundle\Command\SectionProcessor; -use SpomkyLabs\PwaBundle\Command\Client; +use Facebook\WebDriver\WebDriverDimension; use SpomkyLabs\PwaBundle\ImageProcessor\ImageProcessor; use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\Panther\Client; use function is_int; final class ApplicationScreenshotsSectionProcessor implements SectionProcessor @@ -22,10 +23,10 @@ public function __construct( #[Autowire('%spomky_labs_pwa.dest%')] private readonly array $dest, #[Autowire('@pwa.web_client')] - null|Client $webClient, + null|Client $webClient = null, private readonly null|ImageProcessor $imageProcessor = null, ) { - if ($webClient === null && class_exists(Client::class)) { + if ($webClient === null && class_exists(Client::class) && class_exists(WebDriverDimension::class)) { $webClient = Client::createChromeClient(); } $this->webClient = $webClient; diff --git a/src/Command/SectionProcessor/ScreenshotsProcessorTrait.php b/src/Command/SectionProcessor/ScreenshotsProcessorTrait.php index 19a396b..781856d 100644 --- a/src/Command/SectionProcessor/ScreenshotsProcessorTrait.php +++ b/src/Command/SectionProcessor/ScreenshotsProcessorTrait.php @@ -4,11 +4,11 @@ namespace SpomkyLabs\PwaBundle\Command\SectionProcessor; -use SpomkyLabs\PwaBundle\Command\Client; -use SpomkyLabs\PwaBundle\Command\WebDriverDimension; +use Facebook\WebDriver\WebDriverDimension; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Finder\Finder; +use Symfony\Component\Panther\Client; trait ScreenshotsProcessorTrait { diff --git a/src/Command/SectionProcessor/Windows10WidgetsSectionProcessor.php b/src/Command/SectionProcessor/Windows10WidgetsSectionProcessor.php index aa4b92b..a516dbc 100644 --- a/src/Command/SectionProcessor/Windows10WidgetsSectionProcessor.php +++ b/src/Command/SectionProcessor/Windows10WidgetsSectionProcessor.php @@ -4,11 +4,12 @@ namespace SpomkyLabs\PwaBundle\Command\SectionProcessor; -use SpomkyLabs\PwaBundle\Command\Client; +use Facebook\WebDriver\WebDriverDimension; use SpomkyLabs\PwaBundle\ImageProcessor\ImageProcessor; use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\Panther\Client; use Symfony\Component\Routing\RouterInterface; final class Windows10WidgetsSectionProcessor implements SectionProcessor @@ -27,7 +28,7 @@ public function __construct( private readonly null|ImageProcessor $imageProcessor = null, private readonly null|RouterInterface $router = null, ) { - if ($webClient === null && class_exists(Client::class)) { + if ($webClient === null && class_exists(Client::class) && class_exists(WebDriverDimension::class)) { $webClient = Client::createChromeClient(); } $this->webClient = $webClient;