Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Dusk Laravel Package

laravel/dusk

Laravel Dusk is Laravel’s browser automation and end-to-end testing tool, offering a clean, expressive API for driving real browsers. Runs with a bundled standalone Chromedriver by default (no Selenium/JDK required), but supports other drivers too.

View on GitHub
Deep Wiki
Context7

Laravel Dusk is a browser automation and end-to-end testing package for Laravel, offering an expressive API to drive real browsers and verify your application’s UI. It ships with a standalone Chromedriver by default—no JDK or Selenium required—while still allowing you to use other Selenium drivers if needed.

Designed for readable, maintainable tests, Dusk helps you cover critical user flows with confidence and integrates cleanly into typical Laravel workflows.

  • End-to-end browser testing with a fluent, Laravel-friendly API
  • Standalone Chromedriver setup out of the box
  • Optional support for custom Selenium drivers
  • Ideal for validating UI interactions and full user journeys
  • Works well in CI pipelines for reliable regression coverage
Frequently asked questions about Dusk
How do I install Laravel Dusk in a Laravel 13 project?
Run `composer require --dev laravel/dusk` and publish the config with `php artisan dusk:install`. This sets up the `Tests/Browser` directory and configures Dusk to use Chrome by default. Ensure your `php.ini` includes `pdo_sqlite` and `fileinfo` extensions.
Can I use Laravel Dusk with Pest instead of PHPUnit?
Yes, Dusk fully supports Pest. Replace `uses(DuskTestCase)` with `uses(DuskTestCase)->in('pest')` in your test classes. Pest’s syntax (e.g., `test('login', fn () => ...)`) works seamlessly with Dusk’s browser methods like `browse()` and `visit()`.
What Laravel versions does Dusk support?
Dusk officially supports Laravel 10–13. For Laravel 9.x, use Dusk v7.x; older versions may require manual Chromedriver configuration. Check the [Laravel docs](https://laravel.com/docs/dusk) for version-specific setup guides.
How do I run Dusk tests in GitHub Actions without flakiness?
Use a Docker container with Chrome and Chromedriver pre-installed (e.g., `mcr.microsoft.com/playwright/chromium`). Add `--headless=new` to your Chrome flags and use `waitFor()` assertions to handle dynamic content. Example: `DUSK_DRIVER_CHROME_OPTIONS='--no-sandbox --disable-gpu'`.
Can I test Firefox or Edge with Dusk?
Yes, but you’ll need to install the respective Selenium drivers (e.g., `geckodriver` for Firefox). Configure the driver in `.env` with `DUSK_DRIVER=firefox` and set `DUSK_DRIVER_URL` to the driver’s path. Firefox requires additional flags like `--marionette`.
How do I compare screenshots for visual regression testing?
Use `screenshot()` in your test to capture an element or page, then compare it against a baseline (e.g., `assertScreenshotMatches($path)`). Tools like Applitools or custom scripts can automate baseline updates. Store baselines in `tests/Browser/screenshots/`.
Why are my Dusk tests failing intermittently in CI?
Flakiness often stems from race conditions or slow network requests. Use `waitFor()` with selectors (e.g., `waitFor('.button')->toBeVisible()`) and disable animations with Chrome flags (`--disable-gpu --no-sandbox`). Run tests in headless mode for consistency.
Do I need JDK or Selenium Server for Dusk?
No, Dusk bundles Chromedriver by default and doesn’t require JDK or a standalone Selenium Server. It uses a direct WebDriver connection. For other browsers (Firefox/Edge), you’ll need their respective drivers but no Selenium Server.
How can I parallelize Dusk tests to speed up CI?
Use Pest’s `--parallel` flag or PHPUnit’s `--group` to split tests across workers. Configure your CI to run multiple containers with shared storage for screenshots. Example: `pest --parallel --workers=4`. Avoid parallelizing tests that modify shared state.
What’s the best alternative to Dusk for Laravel E2E testing?
Consider **Playwright** (via `laravel-playwright`) for cross-browser testing with better mobile emulation, or **Cypress** (with custom Laravel integration). Playwright supports Chromium, Firefox, and WebKit natively, while Cypress offers real-time debugging. Dusk remains simpler for Laravel-specific workflows.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport