php artisan test with Mink’s PHPUnit bridge.Session and DriverManager can be bound as Laravel services for dependency injection.laravel/browser-kit-testing (complementary for HTTP tests).phpunit --parallel).laravel/browser-kit-testing for hybrid tests.HttpClient, BrowserKit, and DependencyInjection.phpunit/phpunit and Laravel’s TestCase.| Driver | Use Case | Laravel Synergy |
|---|---|---|
| Goutte | Static HTML/Blade tests | Low overhead, no JS needed |
| Selenium | Dynamic JS (SPA, Livewire/Alpine) | Requires WebDriver setup |
| Custom | API-driven or CLI tests | Extend with Laravel services |
friends-of-behat/mink and mink/mink-selenium2-driver (or mink/mink-goutte-driver).TestCase:
use FriendsOfBehat\MinkExtension\MinkExtension;
use FriendsOfBehat\Mink\Session;
class ExampleTest extends \Tests\TestCase {
protected function setUp(): void {
$this->mink = new Session();
$this->mink->setDriver(new \Mink\Driver\Goutte\Driver());
}
public function testHomepage() {
$this->mink->visit('/');
$this->assertSession()->titleEquals('Laravel');
}
}
webdriver.json or Dockerized Selenium Grid.HttpClient.composer.json:
"require-dev": {
"friends-of-behat/mink": "^1.12",
"mink/mink-goutte-driver": "^1.3",
"mink/mink-selenium2-driver": "^1.7"
}
.github/workflows/tests.yml to include Mink tests (with Selenium container if needed).Session to Laravel’s container:
$this->app->singleton(Session::class, function () {
$session = new Session();
$session->setDriver(new \Mink\Driver\Goutte\Driver());
return $session;
});
assertSession() with Mink assertions:
$this->assertSession()->elementTextContains('css', '.alert', 'Success!');
HttpFoundation and BrowserKit under the hood. No conflicts with Laravel’s Symfony components.php-xml and php-curl.php-dom (included in Laravel by default).laravel/browser-kit-testing for HTML/Blade tests..feature files and step definitions.dd($this->mink->getSession()->getPage()->getContent()) for inspection.How can I help you explore Laravel packages today?