A demo Laravel 12 application showcasing browser testing with Laravel Dusk and Laravel Herd. This repo provides a working example for testing Dusk compatibility with Herd setups.
This is a minimal Laravel application built specifically to demonstrate and test Laravel Dusk browser testing functionality with Laravel Herd. It includes:
- ✅ 5 Browser Tests covering navigation and form submission
- 🎨 Tailwind CSS 4 for modern, beautiful UI
- 📝 Contact Form with validation
- 🧪 Full Dusk Setup with ChromeDriver configured
Perfect for support testing, learning Dusk, or as a starter template for browser testing.
- Laravel Herd installed
- PHP 8.2+ (included with Herd)
- Composer (included with Herd)
- Node.js 18+ and npm
- Google Chrome browser
git clone <your-repo-url> dusk-tests
cd dusk-tests
composer install
npm install
cp .env.example .env
php artisan key:generate
The .env
file is already configured with:
APP_URL=http://dusk-tests.test
DB_CONNECTION=sqlite
touch database/database.sqlite
php artisan migrate
npm run build
Open Laravel Herd and:
- Click "Add Path" or "Park Directory"
- Select the parent directory containing your
dusk-tests
folder - The site should now be accessible at
http://dusk-tests.test
Verify by visiting: http://dusk-tests.test in your browser
Laravel Dusk requires ChromeDriver to match your Chrome version:
php artisan dusk:chrome-driver --detect
This will automatically download the correct ChromeDriver version for your installed Chrome browser.
Run all browser tests:
php artisan dusk
Expected output:
PASS Tests\Browser\ExampleTest
✓ can visit home page
✓ can visit about page
✓ can navigate between pages
✓ can view contact form
✓ can submit contact form
Tests: 5 passed (15 assertions)
To see the browser while tests run (useful for debugging):
php artisan dusk --without-tty
dusk-tests/
├── routes/web.php # Application routes
├── resources/views/ # Blade templates
│ ├── welcome.blade.php # Home page
│ ├── about.blade.php # About page
│ ├── contact.blade.php # Contact form
│ └── contact-success.blade.php
├── tests/
│ ├── Browser/
│ │ └── ExampleTest.php # 5 Dusk browser tests
│ └── DuskTestCase.php # Dusk test configuration
└── public/build/ # Compiled assets
The application includes 5 browser tests in tests/Browser/ExampleTest.php
:
- can visit home page - Verifies homepage loads with "Laravel" text
- can visit about page - Checks about page content
- can navigate between pages - Tests navigation links work
- can view contact form - Verifies form fields are present
- can submit contact form - Tests form submission and success message
- Modern UI with Tailwind CSS 4 and gradient backgrounds
- Responsive Design that works on all screen sizes
- Form Validation on the contact form
- Navigation System across all pages
- Success Page with user feedback after form submission
If you see errors about Chrome/ChromeDriver version mismatches:
php artisan dusk:chrome-driver --detect
This downloads the correct ChromeDriver for your Chrome version.
If dusk-tests.test
doesn't load:
- Check Laravel Herd is running (menu bar icon)
- Verify the project directory is parked in Herd
- Try restarting Herd
- Check permissions:
chmod -R 755 storage bootstrap/cache
- Ensure assets are built:
npm run build
- Clear Laravel cache:
php artisan config:clear
- Check ChromeDriver:
php artisan dusk:chrome-driver --detect
- Verify site loads: Open http://dusk-tests.test in browser
- Check Herd is serving the site:
herd list
If ChromeDriver port is occupied:
lsof -ti:9515 | xargs kill -9
To completely reset the application:
rm -rf vendor node_modules public/build
composer install
npm install
npm run build
php artisan dusk:chrome-driver --detect
Found an issue or want to improve this example? PRs are welcome!
This project is open-sourced software licensed under the MIT license.
Built with ❤️ for Laravel Herd customer support and testing.