I am following the Laravel Documentation (https://laravel.com/docs/5.4/dusk) to create browser tests for my application.
After some trials, I got Dusk to run. It runs only when --headless
mode is used -- otherwise, PHP unit hangs without any output.
Anyway, I got the following error message when trying to test the login page:
Facebook\WebDriver\Exception\UnknownServerException: unknown error:
an X display is required for keycode conversions, consider using Xvfb
The code is nothing special, just typing in the fields:
$this->browse(function ($browser) use ($user) {
$browser->visit('/login')
->type('email', $user->email)
->type('password', 'secret')
->press('Login')
->assertPathIs('/home');
});
I am new to testing and any help would be appreciated.