Skip to content
Open
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
23 changes: 9 additions & 14 deletions tests/Unit/PlaywrightFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,18 @@
use Playwright\PlaywrightFactory;
use Psr\Log\LoggerInterface;

/**
* Every test here must pass an explicit nodePath.
*
* TransportFactory only calls NodeBinaryResolver when the config leaves nodePath
* null, and resolving spawns "node --version" against the real machine. A unit
* test doing that depends on the environment and fails whenever the binary is
* slow to answer. The environment-dependent cases live in
* tests/Integration/PlaywrightFactoryTest.php, where CI installs Node.
*/
#[CoversClass(PlaywrightFactory::class)]
final class PlaywrightFactoryTest extends TestCase
{
public function testCreateWithDefaultConfig(): void
{
$this->assertInstanceOf(PlaywrightClient::class, PlaywrightFactory::create());
}

public function testCreateWithCustomConfig(): void
{
$config = new PlaywrightConfig(
Expand All @@ -43,15 +47,6 @@ public function testCreateWithCustomConfig(): void
$this->assertInstanceOf(PlaywrightClient::class, $client);
}

public function testCreateWithLogger(): void
{
$logger = $this->createMock(LoggerInterface::class);

$client = PlaywrightFactory::create(logger: $logger);

$this->assertInstanceOf(PlaywrightClient::class, $client);
}

public function testCreateWithConfigAndLogger(): void
{
$config = new PlaywrightConfig(
Expand Down
Loading