Laravel Dusk Testing A Responsive Website
January 23, 2022
laravel londiniumI wanted to setup Laravel Dusk testing to enable me to make screenshots of a website at all different screensizes. To install laravel in an existing repo run:
php artisan dusk:install
to run the 1st test
php artisan dusk
First I am going to create a test for the frontpage to load and then resize to the 4 main sizes which tailwind css uses tailwindcss.com/docs/responsive-design
This is the comprenhsive manual for laravel dusk laravel.com/docs/8.x/dusk
$browser->visit('http://www.londinium.com/')
->waitForText('Londinium');
->assertSee('Londinium');
$browser->resize(1920, 1080);
$browser->screenshot('home-1920');
$browser->resize(1280, 720);
$browser->screenshot('home-1280');
$browser->resize(768, 720);
$browser->screenshot('home-768');
$browser->resize(320, 720);
$browser->screenshot('home-320');
If you would like to contact me with this form on londinium.com, ilminster.net or via Twitter @andylondon