What is Laravel Dusk ?

Answer

Laravel Dusk has been most awaited futures that added in laravel 5.4 as its provides an expressive, easy-to-use browser automation and testing API. By default, Dusk does not require we to install JDK or Selenium on our machine. Instead, Dusk uses a standalone ChromeDriver installation. However, wer are free to utilize any other Selenium compatible driver we wish.

Since Dusk operates using a real browser, we are able to easily test and interact with our applications that heavily use JavaScript:

A simaple example like below

public function testPcds()
{
    $user = factory(User::class)->create([
        'email' => 'rom@pcds.co.in',
    ]);

    $this->browse(function ($browser) use ($user) {
        $browser->loginAs($user)
                ->visit('/home')
                ->press('Create Playlist')
                ->whenAvailable('.playlist-modal', function ($modal) {
                    $modal->type('name', 'My Playlist')
                          ->press('Create');
                });

        $browser->waitForText('Playlist Created');
    });
}

All laravel Questions

Ask your interview questions on laravel

Write Your comment or Questions if you want the answers on laravel from laravel Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---