atk4/behat-mink-selenium2-driver
Selenium2 driver for Behat Mink (ATK4 fork), enabling browser-based acceptance tests via Selenium/WebDriver. Use it to run Mink test suites against real browsers for end-to-end UI testing in PHP projects.
Use Case Alignment: This package is a Selenium2 WebDriver driver for Mink, a BDD (Behavior-Driven Development) testing framework for PHP. It is not a standalone application but rather a dependency for automated browser testing (e.g., UI regression, acceptance testing).
Laravel Compatibility:
tests/Behat/.mink/mink) and Behat (behat/behat).create(), assertDatabaseHas()).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Flaky Tests | High | Use explicit waits, avoid hardcoded selectors. |
| Selenium Maintenance | Medium | Containerize Selenium server (Docker). |
| Slow Execution | Medium | Limit test scope, use headless browsers. |
| Laravel Test Gaps | Low | Supplement with Pest/Unit tests for backend. |
| Dependency Bloat | Low | Only use if frontend testing is critical. |
laravel-behat package).composer require mink/mink behat/behat atk4/behat-mink-selenium2-driver
behat.yml with Selenium2 driver.default:
extensions:
Behat\MinkExtension:
base_url: 'http://laravel.test'
selenium2: ~
// features/bootstrap/FeatureContext.php
use Facebook\WebDriver\WebDriverBy;
use Facebook\WebDriver\WebDriverExpectedCondition;
$this->getSession()->wait(5000, 100)->until(
WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::id('login-form'))
);
- name: Start Selenium
run: docker run -d -p 4444:4444 selenium/standalone-chrome
| Component | Compatibility Notes |
|---|---|
| Laravel | No native integration; requires manual setup. |
| PHP 8.0+ | May need ext-selenium or polyfills for older Mink versions. |
| Selenium 4+ | This driver is for Selenium 2/3; check if your Selenium server is outdated. |
| Headless Browsers | Works with Chrome/Gecko in headless mode (faster CI runs). |
session_timeout in Behat).behat --tags=@smoke).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Selenium Server Crash | CI pipeline blocks | Health checks, retries, fallback to Docker. |
| Flaky Tests | Unreliable releases | Use @retry tags in Behat. |
| Browser Driver Mismatch | Tests fail silently | CI validation of driver versions. |
| Laravel Session Invalidation | Auth tests break | Custom context for Laravel auth. |
| Dependency Security Vulns | Supply chain risk | Dependabot + manual audits. |
How can I help you explore Laravel packages today?