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


  1. Introducing Laravel Dusk

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

    Enrise - Code Cuisine » Top contributor Laracasts » Creator of https://markdownmail.com
  3. None
  4. 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
  5. Let's talk Laravel Dusk

  6. 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.”
  7. What is Browser testing? » Testing to enruse application works

    as expected in a given browser » Test JavaScript based application functionality » Checking links, popups, menus
  8. Manual vs Automated » Developer, product owner, user/customer clicking around

    » Automated using some tool
  9. 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
  10. 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
  11. 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)
  12. When to apply it » Our responsibility as developers to

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

    Oauth flows with other parties » Making screenshots/videos » Automating processes on websites
  16. None
  17. Introducing Laravel Dusk

  18. 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
  19. History of Laravel Dusk » Laravel 5.2: Symfony BrowserKit »

    Laravel 5.4: Laravel Dusk
  20. None
  21. None
  22. None
  23. None
  24. None
  25. None
  26. None
  27. None
  28. None
  29. None
  30. None
  31. None
  32. None
  33. None
  34. None
  35. None
  36. None
  37. None
  38. 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
  39. 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
  40. CI integration » php artisan serve » chromedriver

  41. None
  42. Demo time

  43. 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
  44. A good use case » Monthly payments » Screenshots »

    Sending emails
  45. Laravel Dusk caveats

  46. Thank you! https://gitlab.com/bobbybouwmann/vault