// Laravel Dusk - Browser automation and testing API for Laravel applications. Use when writing browser tests, automating UI testing, testing JavaScript interactions, or implementing end-to-end tests in Laravel.
| name | laravel-dusk |
| description | Laravel Dusk - Browser automation and testing API for Laravel applications. Use when writing browser tests, automating UI testing, testing JavaScript interactions, or implementing end-to-end tests in Laravel. |
This skill should be triggered when:
Dusk selectors (recommended) use HTML dusk attributes that won't change with UI updates:
@ prefix in tests: $browser->click('@submit-button')<button dusk="submit-button">Submit</button>CSS selectors are more brittle but sometimes necessary:
.class-name, #id, div > buttonAlways wait explicitly rather than using arbitrary pauses:
waitFor('.selector') - Wait for element to existwaitUntilMissing('.selector') - Wait for element to disappearwaitForText('text') - Wait for text to appearwaitUntil('condition') - Wait for JavaScript conditionwhenAvailable('.selector', callback) - Run callback when availableOrganize complex test logic into Page classes:
php artisan dusk:page PageNameDefine reusable browser methods for common patterns:
boot() methodvisit(), type(), press(), and assertSee() methodsdusk attributes to your HTML for stable selectorswaitFor() instead of pause() for reliable testsphp artisan dusk to see resultsDatabaseMigrations or DatabaseTruncationloginAs() to bypass login screenswaitUntil() for dynamic content and AJAXwaitUsing() for complex conditionsother.md for complete API reference# Install Laravel Dusk
composer require laravel/dusk --dev
# Run installation
php artisan dusk:install
# Update ChromeDriver
php artisan dusk:chrome-driver
# Make binaries executable (Unix)
chmod -R 0755 vendor/laravel/dusk/bin/
# Run tests
php artisan dusk
# Generate new test
php artisan dusk:make LoginTest
# Generate page object
php artisan dusk:page Dashboard
# Generate component
php artisan dusk:component Modal
# Run all tests
php artisan dusk
# Run specific test
php artisan dusk tests/Browser/LoginTest.php
# Run failed tests only
php artisan dusk:fails
# Run with filter
php artisan dusk --group=authentication
# Update ChromeDriver
php artisan dusk:chrome-driver --detect
references/other.md for complete method listingsThe reference documentation includes:
dusk attributes) instead of CSS classes for stabilitywaitFor() methods instead of arbitrary pause()with() or elsewhere() for specific page regionsloginAs() to skip login flowsscreenshot() for debugging failures--group flag for targeted executiontests/Browser directorytests/Browser/Pagestests/Browser/screenshots on failuretests/Browser/console for debuggingQuick Reference: read .claude/skills/laravel-dusk/references/quick-reference.md
Reference Files: read .claude/skills/laravel-dusk/references/reference-files.md
Troubleshooting: read .claude/skills/laravel-dusk/references/troubleshooting.md