Pros:
testing facade (e.g., actingAs(), followRedirects()) via custom Mink contexts or hooks.Cons:
assertDatabaseHas()), requiring manual workarounds.High: The package is designed as a Behat extension, which Laravel projects can adopt without modifying core Laravel code. Key integration points:
behat.yml (parallel to Laravel’s phpunit.xml).MinkContext or RawMinkContext in app/Features/Context/ (mirroring Laravel’s tests/Feature/ structure).Challenges:
RefreshDatabase, Mink lacks built-in DB reset. Workaround: Use Behat hooks or Laravel’s DatabaseMigrations trait.| Risk Area | Severity | Mitigation |
|---|---|---|
| Driver Deprecation | High | Migrate to behat/mink-browserkit-driver (modern alternative to Goutte) and Selenium4. |
| Laravel-Specific Gaps | Medium | Create custom contexts to bridge Laravel helpers (e.g., AuthContext for actingAs()). |
| Performance Overhead | Medium | Use Goutte for non-JS tests; reserve Selenium2 for critical paths. |
| Maintenance Burden | Low | Fork the package if needed (MIT license permits this). |
| CI/CD Complexity | Low | Containerize Behat tests (Docker) to isolate dependencies. |
UserFeatureTest ↔ UserContext)?parallel package?)assertDatabaseHas(), followRedirects(), etc.Phase 1: Proof of Concept (2–4 weeks)
friends-of-behat/mink-extension and behat/mink-selenium2-driver (for JS) in a dev container.actingAs() via custom context).Phase 2: CI/CD Integration (1–2 weeks)
phpunit.xml or .github/workflows/.--tags or Laravel’s parallel package).Phase 3: Adoption (Ongoing)
@test annotations in favor of Behat features.| Component | Compatibility | Workaround |
|---|---|---|
| Laravel Auth | ✅ Works via custom contexts (e.g., setMinkParameters to inject auth cookies). |
Use MinkAwareContext to wrap Auth::loginUsingId(). |
| Laravel Mix/Vite | ⚠️ May block requests. | Configure Mink to use Laravel’s public path or mock assets. |
| Database Testing | ❌ No built-in support. | Use Behat hooks to call Artisan::call('migrate:fresh') or Laravel’s RefreshDatabase. |
| Queue Workers | ❌ No native support. | Mock queues or use Laravel’s Queue::fake() in contexts. |
| API Testing | ⚠️ Goutte/BrowserKit can test APIs, but lacks Laravel’s JsonAssertions. |
Extend MinkContext to include Laravel’s assertJson() helpers. |
POST /login endpoint with attachFileToField for file uploads.@javascript tagged scenarios.--tags to split test suites (e.g., @smoke, @regression).behat.yml, feature files, and contexts alongside LaravelHow can I help you explore Laravel packages today?