1 / 5

Laravel Automation, Browse Testing using Laravel Dusk

Introduction Laravel Dusk is one of the tool for browser automation testing for your laravel project. Laravel dusk is introduced in version of Laravel 5.4. We are a Laravel Development Company. Read more: https://bit.ly/2CBFdfJ

Download Presentation

Laravel Automation, Browse Testing using Laravel Dusk

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Laravel Automation, Browse Testing using Laravel Dusk Introduction Laravel Dusk is one of the tool for browser automation testing for your laravel project. Laravel dusk is introduced in version of ​Laravel 5.4. Using the laravel dusk​ is a easy way to test you application or web. It does not required to install JDK or Selenium on your machine. Using Dusk we can automate repetitive tasks, test to make sure your app always works in the real browser. Installation:​ Install laravel dusk using following command in your command line. NOTE: Make sure that your web/application is not in production mode. Step 1: Download the package using composer

  2. require –dev laravel/dusk Laravel Automation, Browse Testing using Laravel Dusk Step 2: Install the package in your project. php artisan dusk: install The effect of this command, Browser directory is created inside of test directory. Next step to set your APP_URL environment variable in .env file. Step 3: Run dusk using following command php artisan dusk Browser Configuration & Examples​ After step 3, It will generate DustTestCase.php file in your test folder. There is a one method startChromeDriver​ in your prepare function. By default it gets the from browse. If you want to run any other browser you can also remove this method. Example: public static function prepare() { static::startChromeDriver(); } You can modify in driver function in same file.

  3. Example: protected function driver() { return RemoteWebDriver::create( 'http://localhost:4444/wd/hub', DesiredCapabilities::​phantomjs​() ); } Login test example: <?php namespace Tests\Browser; use App\User; use Tests\DuskTestCase; use Laravel\Dusk\Chrome; use Illuminate\Foundation\Testing\DatabaseMigrations; class ExampleTest extends DuskTestCase { use DatabaseMigrations; /** * A basic browser test example. * * @return void */ public function testBasicExample() { $user = factory(User::class)->create([ 'email' => 'taylor@laravel.com', ]); $this->browse(function ($browser) use ($user)

  4. { $browser->visit('/login') ->type('email', $user->email) ->type('password', 'secret') ->press('Login') ->assertPathIs('/home'); }); } } Conclusion: Using the Laravel dusk you can develop your project with more accuracy and quality. It reduces the work for QA, and easy way for developers to check errors and fix the bugs. It’s an amazing tool which provided by ​laravel Development​ for developing and unit testing. For any queries !! Just fill up the ​contact form​ and our experts will get back to you soon.   Visit Our Social Profile    ​

  5. Contact Us Company Name​: Elsner Technologies Pvt Ltd Address​: 305,306 Iscon Center, Shivranjani Cross Road, Satellite, Ahmedabad, India. Email Address​: ​sales@elsner.com Website​: ​https://www.elsner.com/

More Related