Checking Out Laravel Dusk

Was trying to figure out why should I use Dusk over PHPunit where Dusk also uses PHPunit for test, so I found out that the different between PHPunit and Dusk is that when your application uses Javascript, those javascript aren't being tested because isn't a browser, but with Dusk it will be tested to...

composer require laravel/dusk --dev
// AppServiceProvider
use Laravel\Dusk\DuskServiceProvider;
public function register()
{
if ($this->app->environment('local', 'testing')) {
$this->app->register(DuskServiceProvider::class);
}
}

Then install vendor

php artisan dusk:install

try to run it

php artisan dusk

If it works then start your magic

More info

Troubleshooting

Facebook\WebDriver\Exception\SessionNotCreatedException: session not created: This version of ChromeDriver only supports Chrome version 80

To check current version of chrome

vendor/laravel/dusk/bin/chromedriver-linux --version

if it's on my current post is higher than 80, so what I did that works is

https://chromedriver.storage.googleapis.com/index.html?path=79.0.3945.36/
then copy it to vendor/laravel/dusk/bin/chromedriver-linux .
change the name to chromedriver-linux if the name is only chromedriver

Subscribe to You Live What You Learn

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]
Subscribe