Skip to content

Commit cecb359

Browse files
committed
Fix Chrome session crash in E2E tests
Two bugs were causing "session not created: Chrome instance exited": 1. createPantherClient() was called with [] and a ChromeOptions object as plain array values (integer keys 0/1) inside the first argument, so the options were never applied. Remove the dead ChromeOptions code and call createPantherClient correctly. 2. --disable-gpu was missing from PANTHER_CHROME_ARGUMENTS. This flag is required for stable headless Chrome in CI environments (GitHub Actions / Docker) alongside --disable-dev-shm-usage. https://claude.ai/code/session_018f3bgBj7bQd4XmWVDPnDtb
1 parent a3d604b commit cecb359

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<server name="PANTHER_ERROR_SCREENSHOT_DIR" value="tests/Application/var/panther" />
3131
<server name="PANTHER_WEB_SERVER_DIR" value="./tests/Application/public" />
3232
<server name="PANTHER_NO_SANDBOX" value="1" />
33-
<server name="PANTHER_CHROME_ARGUMENTS" value="--disable-dev-shm-usage --window-size=1400,900" />
33+
<server name="PANTHER_CHROME_ARGUMENTS" value="--disable-dev-shm-usage --disable-gpu --window-size=1400,900" />
3434
<server name="FIXTURES_DIR" value="../Api/DataFixtures" /> <!-- relative to tests/Application dir -->
3535
<server name="EXPECTED_RESPONSE_DIR" value="../Api/Responses" /> <!-- relative to tests/Application dir -->
3636

tests/E2E/E2ETestCase.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
88
use Doctrine\ORM\EntityManager;
99
use Doctrine\ORM\EntityManagerInterface;
10-
use Facebook\WebDriver\Chrome\ChromeOptions;
1110
use Facebook\WebDriver\WebDriverDimension;
1211
use Fidry\AliceDataFixtures\LoaderInterface;
1312
use Symfony\Component\Panther\Client;
@@ -24,11 +23,7 @@ abstract class E2ETestCase extends PantherTestCase
2423

2524
protected function setUp(): void
2625
{
27-
$options = new ChromeOptions();
28-
29-
$this->client = static::createPantherClient([
30-
'browser' => self::CHROME, [], $options,
31-
]);
26+
$this->client = static::createPantherClient(['browser' => self::CHROME]);
3227
$this->client->manage()->window()->setSize(
3328
new WebDriverDimension(1500, 4000),
3429
);

0 commit comments

Comments
 (0)