Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

TobiasS's avatar
Level 10

Dusk or Cypress

Hi!

I'm about to start writing front-end tests. I've watched the first episodes on laracasts regarding testing with cypress.

What I do not know (since I haven't used the tools)...

What is the big difference between Laravel Dusk and Cypress? Are there any pros, cons using either of these?

Thx in advanced!

0 likes
2 replies
automica's avatar
automica
Best Answer
Level 54

@tobiass I don't think theres a lot in it TBH. If you know a bit of cypress, spin up some tests and give it a go.

Then have a look at https://laravel.com/docs/8.x/dusk

and see which one you prefer.

The cons are If you use neither.

2 likes
Bartestro's avatar

@tobiass actually there are some important differences between Cypress and Laravel Dusk.

The main difference is that if you run Cypress you won't have access to phpunit nor laravel functions like for example db:seed or User::factory()->create();.

You just act like a real-world user.

However with Cypress you will need to prepare initial state DB with some set of records to test, or you need to build user workflow from scratch for example register->activate(here you'll face the first real problem - how to change state to verified) ->do_some_action.

This approach has pros and cons.

Please understand me right, I am not voting towards any of them.

Cypress is great and really performant, and easy to use.

Conclusion:

  1. If you want to simply test working URLs, forms, or UX - use Cypress
  2. If you want to dig deeper and test what is happening on the lower level with each request - use Dusk

Side note: https://github.com/laracasts/cypress - please check this repo, as it solves few mentioned problems with Cypress.

7 likes

Please or to participate in this conversation.