- How do I install orchestra/testbench-dusk for Laravel package testing?
- Add the package via Composer with `composer require --dev orchestra/testbench-dusk`, then extend `TestbenchDuskTestCase` in your test class. Ensure you’re using Laravel 10/11/13, Testbench v11+, and Dusk v8.3.5+ for compatibility. The package integrates directly with your existing Testbench setup.
- Can I use Testbench Dusk with Laravel 12 or older versions?
- No, this package requires Laravel 10/11/13 due to dependencies on Testbench v11+ and Dusk v8.3.5+. If you’re on Laravel 12 or earlier, consider alternatives like native Dusk or wait for updated compatibility. Check the [documentation](https://packages.tools/testbench-dusk.html) for version-specific guidance.
- What’s the difference between Testbench Dusk and running Dusk tests directly?
- Testbench Dusk abstracts Dusk’s setup for package testing, providing helpers like `beforeServingApplication()` to mock or tweak Laravel’s bootstrapping without maintaining a full Dusk project. It’s designed to work alongside Testbench’s unit/package testing, reducing duplication for package developers.
- How do I configure ChromeDriver for CI with Testbench Dusk?
- Set up ChromeDriver in CI by running `google-chrome --headless --disable-gpu --remote-debugging-port=9222 &` before tests, then configure `DUSK_DRIVER=chrome`. For GitHub Actions, use the example snippet in the README. Alternatively, migrate to Playwright if your package supports it, as Dusk may deprecate ChromeDriver.
- Is Testbench Dusk compatible with PestPHP for Laravel testing?
- Yes, but only for Dusk-specific tests. Testbench Dusk extends Testbench’s core functionality, which works alongside PestPHP. Use Pest for unit/package tests and Testbench Dusk for browser tests. Ensure your `phpunit.xml` or `pest.php` config includes Dusk’s dependencies.
- What happens if Dusk migrates to Playwright? Will Testbench Dusk break?
- The package is in early development, so Playwright migration could introduce breaking changes. Monitor Orchestra’s updates or contribute to adapt the package. For now, ChromeDriver is required, but the team may align with Dusk’s future direction. Check the [GitHub repo](https://github.com/orchestral/testbench-dusk) for announcements.
- How do I mock services or providers in Testbench Dusk tests?
- Use Testbench’s built-in methods like `withPackage()` or override `getPackageProviders()` in your test class. Testbench Dusk inherits these features, so you can mock services or providers just like in standard Testbench tests. Example: `protected function getPackageProviders() { return ['MyPackage\ServiceProvider']; }`
- Are there performance issues running Dusk tests in CI with Testbench Dusk?
- Dusk tests can be slow due to ChromeDriver overhead, but Testbench Dusk minimizes setup time. Parallelize tests in CI by splitting Dusk suites or combining them with unit tests. Use headless mode and optimize browser resources to reduce execution time.
- What’s the long-term roadmap for Testbench Dusk? Will it replace native Dusk?
- Testbench Dusk is designed to complement native Dusk, not replace it. The focus is on package-specific testing workflows. Orchestra plans to maintain it, but adoption is low (0 dependents). For roadmap updates, watch the [GitHub repo](https://github.com/orchestral/testbench-dusk) or join the Orchestra community for discussions.
- Can I use Testbench Dusk for API-only Laravel packages?
- No, Testbench Dusk is for browser-based testing and requires Dusk. For API-only packages, stick to Testbench’s core unit/package testing or Laravel’s native HTTP tests. Dusk is unnecessary unless your package has frontend interactions or requires browser automation.