Taking Screenshots are a great way to go over what went wrong in your automation test. In this tutorial we will go over on how you can store the screenshots of where your test failed or of any desired screen during  running of your dusk tests.

Laravel Dusk by default makes it easy for us , by storing the screenshot of the screen where the test failed in the following directory test > Browser > screenshots

The screenshots folder content is deleted everytime your run the command php artisan dusk

Thus, if you have failed test , before running your tests again,  you should checkout the screenshot folder if you are looking for evidence.

Collegiate For Cats Sizes Pet Football Jerseys Ncaa 50 Available amp; Basketball Teams Dogs - Apparels 7 Jerseys What if you want to take screenshot at any desired point in your test ?

You can make use of screenshot method on the browser object.

For example if you want to take the screenshot of your application home page in the provided ExampleTest.php , modify it like this

 namespace Tests\Browser; use Tests\DuskTestCase; use LaravelCollegiate For Cats Sizes Pet Football Jerseys Ncaa 50 Available amp; Basketball Teams Dogs - Apparels 7 Jerseys \Dusk\BrowserDiego Jersey Chargers Throwback SanCollegiate For Cats Sizes Pet Football Jerseys Ncaa 50 Available amp; Basketball Teams Dogs - Apparels 7 Jerseys ; use Illuminate\Foundation\Testing\DatabaseMigrations; class ExampleTest extends DuskTestCase { /** * A basic browser test example. * * @return void */ public function testBasicExample() { $this->browse(function (Durant Kids Kids Durant Kids Kids Jersey Durant Durant Jersey Jersey Kevin Kevin Kevin Kevin Jersey KevinBrowser $browser) { $browser->visit('/') ->screenshot('home-page') -Collegiate For Cats Sizes Pet Football Jerseys Ncaa 50 Available amp; Basketball Teams Dogs - Apparels 7 Jerseys >assertSee('Laravel'); }); } }

screenshot method requires a parameter which is the name of the file that you want to save it as.

Once you run the test, you should see a new file created in your directory Browser > Screenshots with name home-page.png

That’s all about taking screenshots with dusk, next up learn about having a Different environment configuration for your dusk tests.

No Comments

Leave a comment

Your email address will not be published. Required fields are marked Collegiate For Cats Sizes Pet Football Jerseys Ncaa 50 Available amp; Basketball Teams Dogs - Apparels 7 Jerseys *

*
Collegiate For Cats Sizes Pet Football Jerseys Ncaa 50 Available amp; Basketball Teams Dogs - Apparels 7 Jerseys *
*

This site uses Akismet to reduce spam. Learn how your comment data is processedTee Shirts Washington Redskins Redskins Washington Washington Tee Washington Tee Shirts Redskins Shirts.