Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Mink Zombie Driver Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Headless Browser Testing for PHP: The package provides a Zombie.js-backed driver for Mink, enabling headless browser automation in PHP environments (e.g., Laravel with Behat). This is a targeted solution for:
    • Legacy PHP applications requiring lightweight UI testing without GUI dependencies.
    • API-driven workflows where UI interactions (e.g., form submissions, redirects) must be validated but full E2E frameworks (Selenium/Playwright) are unnecessary.
    • CI/CD pipelines where Node.js is already supported, and faster test execution is prioritized over modern browser features.
  • Laravel-Specific Fit:
    • Complements Laravel’s testing ecosystem by enabling JavaScript-heavy UI validation (e.g., Livewire, Inertia.js) without requiring full Selenium infrastructure.
    • Not a replacement for Laravel Dusk or Pest: Best suited for supplemental UI testing where HTTP clients (Guzzle) or Dusk’s WebDriver are overkill.
    • Ideal for hybrid stacks: PHP backends with client-side logic (e.g., jQuery plugins, AJAX workflows) that need validation beyond API-level tests.

Integration Feasibility

  • Dependencies:
    • Hard Requirements:
      • Node.js (v10+) and zombie.js (v2+).
      • PHP 7.2+ with sockets extension.
      • Symfony Process v4.4+ (for process management).
      • Mink framework (v1.7+ for full compatibility).
    • Soft Requirements:
      • Behat for BDD workflows (optional but recommended).
      • Docker or CI environment with Node.js pre-installed.
  • Laravel Integration Paths:
    1. Behat Integration:
      • Install via Composer: composer require --dev behat/mink behat/mink-zombie-driver.
      • Configure Mink in behat.yml or a custom FeatureContext.
      • Use for UI-centric Gherkin scenarios (e.g., "Given I fill the form, When I submit, Then the success message appears").
    2. Custom PHPUnit Test Wrapper:
      • Extend Laravel’s TestCase to initialize Mink with the Zombie driver.
      • Example:
        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);
            }
        }
        
    3. Laravel Dusk Hybrid:
      • Use Zombie for lightweight UI tests and reserve Dusk for complex interactions (e.g., file uploads, WebDriver-specific features).
  • Key Challenges:
    • Zombie.js Limitations:
      • No WebDriver protocol (cannot interact with DevTools or modern APIs).
      • Limited JavaScript execution (e.g., no WebSockets, Service Workers).
      • Outdated Chromium engine (Blink-based but lacks evergreen features).
    • Node.js Dependency:
      • Requires Node.js installation in test environments (Docker recommended).
      • Potential version conflicts with other npm packages in CI.
    • Fragility:
      • Tests may fail on dynamic content (e.g., SPAs with frequent AJAX updates).
      • No native support for modern Laravel features (e.g., Livewire’s Alpine.js interactions).

Technical Risk

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.

Key Questions for TPM

  1. Strategic Alignment:

    • Does this package align with the long-term testing strategy? If modern E2E testing is a priority, consider Playwright/Puppeteer instead.
    • Are there existing Mink/Behat tests that justify this integration, or is this a greenfield effort?
  2. Technical Trade-offs:

    • What specific UI scenarios (e.g., Livewire form validation) require Zombie.js that Laravel Dusk cannot handle?
    • Is the Node.js dependency acceptable, or would a pure PHP solution (e.g., puppeteer-php) be preferable?
  3. Operational Impact:

    • How will Node.js maintenance (updates, security patches) be managed in CI/CD?
    • What’s the ramp-up time for QA/engineers to adopt Mink/Zombie for testing?
  4. Migration Path:

    • If Zombie.js becomes unsustainable, what’s the easiest way to extract tests and migrate to another driver (e.g., Playwright)?
    • Are there abstraction layers (e.g., a test runner wrapper) that could simplify future migrations?
  5. Alternatives:

    • Have Laravel Dusk or Puppeteer/Puppeteer-php been evaluated for the same use cases? What are the trade-offs?
    • Is there a hybrid approach (e.g., Zombie for simple tests + Dusk for complex ones)?

Integration Approach

Stack Fit

  • Target Stack:
    • Primary: Laravel + PHP 8.x + Behat/Mink + Node.js 16+.
    • Secondary: Custom PHPUnit test suites with Mink integration.
  • Where It Fits:
    • Lightweight UI Testing: Validating form submissions, redirects, or client-side logic (e.g., jQuery plugins) without full E2E overhead.
    • Legacy System Modernization: Testing monolithic PHP apps with embedded JavaScript (e.g., old jQuery workflows) that lack modern test coverage.
    • CI/CD Optimization: Faster than Selenium for parallelized test suites where Node.js is already available.
  • Where It Doesn’t Fit:
    • Modern SPAs: React/Vue apps with complex client-side routing or state management.
    • WebDriver-Dependent Features: File uploads, WebSockets, or DevTools interactions.
    • Cross-Browser Testing: Only supports Chromium (Blink engine); no IE/Edge/Firefox support.

Migration Path

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.

Compatibility

  • PHP Compatibility:
    • Supported: PHP 7.2–8.1 (tested in CI).
    • Unsupported: PHP <7.2 (removed in v1.6.0).
    • Recommendation: Use PHP 8.0+ for best compatibility with Laravel 9+.
  • Laravel Compatibility:
    • No native integration: Requires **custom setup
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours