From Laravel Dusk Testing To Pest
August 29, 2025
laravelI recently saw that Laravel Dusk was being sunsetted :) and the modern way to test laravel (and any websites) was with Pest 4. It uses Playwright under the hood, and this video by Nuno Maduro at Laracon US 2025 really shows its power.
To install in an existing laravel 12 repository, i ran these commands to remove the old phpunit, install pest and upgrade and initialise the pest testing framework.
composer remove phpunit/phpunit
composer require pestphp/pest --dev --with-all-dependencies
./vendor/bin/pest --init
composer upgrade # i needed to update the packages
./vendor/bin/pest # run the tests
the output of the first run was thus:
PASS Tests\Unit\ExampleTest
✓ that true is true
PASS Tests\Feature\ExampleTest
✓ the application returns a successful response 0.11s
Tests: 2 passed (2 assertions)
Duration: 0.16s
now to install the browser test bits
composer require pestphp/pest-plugin-browser --dev
npm install playwright@latest
npx playwright install
If you would like to contact me with this form on londinium.com, ilminster.net or via Twitter @andylondon