Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introducing Laravel Dusk

Introducing Laravel Dusk

Laravel Dusk provides an expressive, easy-to-use browser automation and testing API. Dusk makes it possible to run your Browser tests without any installation of drivers on your machine since it uses the standalone ChromeDriver. This talk will learn you the ins and outs of browser testing. We will use Laravel Dusk too test an application that is build with a VueJS frontend and Laravel backend.

Bobby Bouwmann

May 10, 2019

More Decks by Bobby Bouwmann

Other Decks in Programming


  1. About me » Bobby Bouwmann » @bobbybouwmann » Developer @

    Enrise - Code Cuisine » Top contributor Laracasts » Creator of https://markdownmail.com
  2. Agenda » What is Laravel Dusk? » What is Browser

    testing? » When to apply Browser testing? » Why use Laravel Dusk? » Laravel Dusk - the code » Demo Time » Caveats
  3. What is Laravel Dusk? “Laravel Dusk provides an expressive, easy-to-use

    browser automation and testing API. By default, Dusk uses a standalone ChromeDriver installation.”
  4. What is Browser testing? » Testing to enruse application works

    as expected in a given browser » Test JavaScript based application functionality » Checking links, popups, menus
  5. Manual Browser testing » Clicking through application » Testing different

    devices, versions and browsers » Takes a lot of time » Repeating work » Multiple browser versions » Focus on responsive » Error prone
  6. Automated Browser testing » Continious Integration (CI) » Testing multiple

    browsers, versions at the same time » Complex setup (we'll see about that!) » Has to be maintained
  7. Automated Browser testing tools » Laravel Dusk 4.x (since 2017,

    Laravel 5.4) » Selenium 3.x (since 2004) » Cypress.io 3.x (since 2017) » PhantomJS 2.x (since 2011) » Paid services (Selenium as a Service)
  8. When to apply it » Our responsibility as developers to

    make sure the project works for all users, not matter what browser or device
  9. When to apply it » Order or payment flows »

    Oauth flows with other parties » Making screenshots/videos » Automating processes on websites
  10. Introducing Laravel Dusk » Browser testing for web applications »

    Browser abstraction on top of PHP-Webdriver » Doesn't require any JDK or other tool like Selenium » Comes with standalone ChromeDriver executable
  11. Benefits of Dusk » Integrated with Laravel (auth, sessions, cookies)

    » Running seeds per test » Laravel syntax for writing tests » No extra installation of JDK's or Selenium » Can be used with Selenium or other tools as well
  12. Disadvantages of Dusk » Coupled to Laravel, harder to setup

    outside of the ecosystem » Missing a dashboard/tool to see a step-by-step overview of the tests
  13. How to get started » There are tools or ready

    to go containers for you available! » You can use my setup » Start digging into this yourself! » Laravel TestTools