orchestra/testbench-dusk
Laravel Dusk helper for Laravel package development. Integrates with Orchestra Testbench to run browser tests against a package’s test app, making it easier to write and maintain Dusk suites for packages.
Strengths:
tweakApplication() → beforeServingApplication()) to maintain consistency with Laravel’s testing ecosystem.--disable-search-engine-choice-screen, --disable-smooth-scrolling) for faster test execution.Gaps:
tweakApplication() (replaced by beforeServingApplication()) may require refactoring in existing test suites.Prerequisites:
orchestra/testbench) as a dependency (v11.0.0+ for v11.x of this package).dusk:chrome-driver command).Compatibility Risks:
PackageServiceProvider and Dusk’s DuskTestCase for effective use.Use Case Validation:
Stack Alignment:
Resource Commitment:
Alternatives:
Primary Use Case: Laravel package development requiring end-to-end UI testing (e.g., validating admin interfaces, form submissions, or real-time dashboards).
Stack Compatibility:
| Component | Version Support | Notes |
|---|---|---|
| Laravel | 13.x (v11.0.0+) | Tight coupling; downgrades may break. |
| Testbench | 11.x+ | Core dependency; align versions. |
| Laravel Dusk | 8.3.5+ | Separate install; ChromeDriver needed. |
| PHPUnit | 12.x | Mandatory for v10.x+. |
| PHP | 8.5+ | v10.8.0+ supports PHP 8.5. |
Non-Fit Scenarios:
Assessment Phase:
composer.json.Setup:
composer require --dev orchestra/testbench-dusk orchestra/testbench laravel/dusk
composer require --dev phpunit/phpunit:^12
phpunit.xml to extend Orchestra\TestbenchDusk\TestCase.services:
chrome:
image: chromium/browser:latest
Test Migration:
TestbenchDuskTestCase:
use Orchestra\TestbenchDusk\TestCase;
class ExampleTest extends TestCase {
protected function getPackageProviders($app) {
return ['YourPackage\ServiceProvider'];
}
}
tweakApplication() with beforeServingApplication() in legacy tests.CI/CD Integration:
dusk:chrome-driver setup).- name: Install ChromeDriver
run: |
CHROME_DRIVER_VERSION=$(curl -s https://chromedriver.storage.googleapis.com/LATEST_RELEASE)
wget -O chromedriver https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip
unzip chromedriver -d /usr/bin/
Sequencing:
orchestra/testbench) for non-browser tests.testbench-dusk on top for Dusk-specific scenarios.Conflict Mitigation:
Tests\Dusk\PackageName).refreshApplication()).--headless=new in CI to avoid Chrome UI prompts.| Phase | Priority | Tasks |
|---|---|---|
| Version Alignment | Critical | Pin Testbench, Dusk, and Laravel versions in composer.json. |
| Test Isolation | High | Refactor tests to avoid shared state (e.g., database, routes). |
| CI Setup | High | Containerize ChromeDriver and Dusk dependencies. |
| Deprecation Fixes | Medium | Replace tweakApplication() in legacy test suites. |
| Visual Testing | Low | Evaluate tools like Percy for regression testing (post-MVP). |
Pros:
analyse.yaml).Cons:
orchestra/testbench)laravel/dusk)Mitigation:
How can I help you explore Laravel packages today?