1. Go to this page and download the library: Download konsulting/dusk-standalone library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
konsulting / dusk-standalone example snippets
namespace Application\Tests;
use Konsulting\DuskStandalone\TestCase;
abstract class DuskTestCase extends TestCase
{
// Set the base url for the browser requests
protected function baseUrl()
{
return 'https://www.klever.co.uk';
}
// Set the path for browser tests, this is where screenshots/console logs
// are stored. The default is [app root]/tests/Browser based on the
// vendor folder location as per a normal Composer install.
protected function browserTestsPath()
{
return parent::browserTestsPath();
}
// Set the default user - however... this is only useful if you will be
// using the Dusk type login. It's worth reviewing the Laravel Dusk
// trait InteractsWithAuthentication to combine with your app.
protected function user()
{
return parent::user();
}
}
namespace Application\Tests\Browser;
use Laravel\Dusk\Browser;
use Konsulting\DuskStandalone\Tests\DuskTestCase;
class ExampleTest extends DuskTestCase
{
/** @test * */
public function it_can_browse_a_site()
{
$this->browse(function (Browser $browser) {
$browser->visit('/')->assertSee('Klever');
});
}
}
// In your testing bootstrap file.
\Laravel\Dusk\Browser::macro('customLoginAs', function ($user, $pass) {
$this->browse('login_url')
->type('username', $user)
->type('pasword', $pass)
->press('Login');
});
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.