behat/mink-zombie-driver
Mink driver powered by Zombie.js for fast, headless browser testing with Node.js. Install Zombie via npm (v2+) and the driver via Composer, then run Mink sessions against real pages to interact with DOM, click, fill forms, and assert content.
zombie.js (v2+).sockets extension.composer require --dev behat/mink behat/mink-zombie-driver.behat.yml or a custom FeatureContext.TestCase to initialize Mink with the Zombie driver.use Behat\Mink\Mink;
use Behat\Mink\Session;
use Behat\Mink\Driver\ZombieDriver;
class ZombieTestCase extends TestCase {
protected function createZombieSession(): Session {
$driver = new ZombieDriver(new \Behat\Mink\Driver\NodeJS\Server\ZombieServer(
'127.0.0.1',
'8124',
'/usr/local/bin/node'
));
return new Session($driver);
}
}
| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Deprecated Zombie.js | High | Evaluate Playwright/Puppeteer PHP bindings (e.g., puppeteer-php) as a long-term replacement. |
| PHP/Mink Version Lock | Medium | Test rigorously with PHP 8.x and Mink 2.x; avoid edge-case dependencies. |
| Node.js Runtime Dependency | Medium | Containerize Node.js in CI (e.g., node:16 Docker image) to isolate dependencies. |
| Limited JavaScript Support | High | Restrict usage to static or semi-static UI elements; avoid SPAs or WebSocket apps. |
| No Laravel Native Support | Medium | Build a custom Laravel test trait to abstract Mink/Zombie initialization. |
| Test Flakiness | High | Implement retry logic for flaky tests; avoid reliance on timing-sensitive JS. |
| Archived Package | Medium | Monitor for forks or alternatives; prepare to migrate if Zombie.js breaks. |
Strategic Alignment:
Technical Trade-offs:
puppeteer-php) be preferable?Operational Impact:
Migration Path:
Alternatives:
| Phase | Action Items | Dependencies |
|---|---|---|
| Assessment | Audit existing tests to identify Zombie.js-specific scenarios. | Behat/Mink tests, Laravel test suite. |
| Pilot Integration | Set up Mink + Zombie in a dedicated test suite (e.g., tests/ZombieTest). |
Node.js, behat/mink-zombie-driver. |
| Hybrid Adoption | Use Zombie for simple UI tests and reserve Dusk for complex interactions. | Laravel Dusk, PHPUnit. |
| CI/CD Setup | Containerize Node.js in CI (e.g., Docker) and configure test parallelization. | GitHub Actions/GitLab CI, Docker. |
| Abstraction Layer | Create a custom test trait to abstract Mink/Zombie initialization. | Laravel TestCase, Mink. |
| Deprecation Plan | Document migration paths to Playwright/Puppeteer if Zombie.js fails. | puppeteer-php, Playwright PHP bindings. |
How can I help you explore Laravel packages today?