Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Configuration/PlaywrightConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public function __construct(

public readonly ?array $proxy = null,

public readonly ?string $wsEndpoint = null,
public readonly ?LoggerInterface $logger = null,
) {
}
Expand Down Expand Up @@ -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,
);
}
Expand Down Expand Up @@ -150,6 +152,7 @@ public function toArray(): array
'traceScreenshots' => $this->traceScreenshots,
'traceSnapshots' => $this->traceSnapshots,
'proxy' => $this->proxy,
'wsEndpoint' => $this->wsEndpoint,
'loggerProvided' => null !== $this->logger,
];
}
Expand Down
14 changes: 14 additions & 0 deletions src/Configuration/PlaywrightConfigBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -309,6 +322,7 @@ public function build(): PlaywrightConfig
traceScreenshots: $this->traceScreenshots,
traceSnapshots: $this->traceSnapshots,
proxy: $this->proxy,
wsEndpoint: $this->wsEndpoint,
logger: $this->logger
);
}
Expand Down
Loading