From 8eb21a941ca6f9c7f720625b8e1b4ce9362982f5 Mon Sep 17 00:00:00 2001 From: Gordon Franke Date: Wed, 7 Oct 2026 13:23:55 +0200 Subject: [PATCH] feat: add wsEndpoint to PlaywrightConfig --- src/Configuration/PlaywrightConfig.php | 3 +++ src/Configuration/PlaywrightConfigBuilder.php | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/Configuration/PlaywrightConfig.php b/src/Configuration/PlaywrightConfig.php index 5e78d2e..558ef9a 100644 --- a/src/Configuration/PlaywrightConfig.php +++ b/src/Configuration/PlaywrightConfig.php @@ -57,6 +57,7 @@ public function __construct( public readonly ?array $proxy = null, + public readonly ?string $wsEndpoint = null, public readonly ?LoggerInterface $logger = null, ) { } @@ -120,6 +121,7 @@ public function withNodePath(?string $nodePath): self traceScreenshots: $this->traceScreenshots, traceSnapshots: $this->traceSnapshots, proxy: $this->proxy, + wsEndpoint: $this->wsEndpoint, logger: $this->logger, ); } @@ -150,6 +152,7 @@ public function toArray(): array 'traceScreenshots' => $this->traceScreenshots, 'traceSnapshots' => $this->traceSnapshots, 'proxy' => $this->proxy, + 'wsEndpoint' => $this->wsEndpoint, 'loggerProvided' => null !== $this->logger, ]; } diff --git a/src/Configuration/PlaywrightConfigBuilder.php b/src/Configuration/PlaywrightConfigBuilder.php index 0fbf3af..5e45945 100644 --- a/src/Configuration/PlaywrightConfigBuilder.php +++ b/src/Configuration/PlaywrightConfigBuilder.php @@ -63,6 +63,8 @@ final class PlaywrightConfigBuilder /** @var array{server: string, username?: string, password?: string, bypass?: string}|null */ private ?array $proxy = null; + private ?string $wsEndpoint = null; + private ?LoggerInterface $logger = null; public static function create(): self @@ -126,6 +128,10 @@ public static function fromEnv(): self $b->withVideosDir($vd); } + if ($wsEndpoint = $get('PW_WS_ENDPOINT') ?? $get('PLAYWRIGHT_WS_ENDPOINT')) { + $b->withWsEndpoint($wsEndpoint); + } + if ($proxy = $get('PW_PROXY_SERVER')) { $b->withProxy( server: $proxy, @@ -264,6 +270,13 @@ public function withProxy(?string $server, ?string $username = null, ?string $pa return $this; } + public function withWsEndpoint(?string $wsEndpoint): self + { + $this->wsEndpoint = null !== $wsEndpoint && '' !== trim($wsEndpoint) ? $wsEndpoint : null; + + return $this; + } + public function withLogger(?LoggerInterface $logger): self { $this->logger = $logger; @@ -309,6 +322,7 @@ public function build(): PlaywrightConfig traceScreenshots: $this->traceScreenshots, traceSnapshots: $this->traceSnapshots, proxy: $this->proxy, + wsEndpoint: $this->wsEndpoint, logger: $this->logger ); }