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

aylara's avatar

Laravel Dusk and Vue

Is Laravel Dusk at all relevant to testing a Vue front end/ Laravel back end app?

I understand it simulates browser interactions which by definition does not depend on whether a JS framework is used or not. So should it be used in addition to things like Vitest and Cypress or would that represent overkill/ overlap?

0 likes
1 reply
LaryAI's avatar
Level 58

Yes, Laravel Dusk can be used to test a Vue front end/Laravel back end app. Dusk is a browser automation tool that can simulate user interactions with your application, regardless of whether it uses a JS framework or not.

However, it's worth noting that Dusk is primarily designed for testing the front end of your application, whereas Cypress and Vitest are more focused on end-to-end testing. So, depending on your testing needs, you may want to use Dusk in addition to these other tools, or you may find that Dusk alone is sufficient.

Here's an example of how you can use Dusk to test a Vue component:

// In your Dusk test file
public function testVueComponent()
{
    $this->browse(function (Browser $browser) {
        $browser->visit('/vue-component')
                ->waitFor('.vue-component')
                ->assertSee('Hello, Vue!');
    });
}

In this example, we're visiting a page that contains a Vue component with the class "vue-component". We're then waiting for that component to appear on the page, and asserting that it contains the text "Hello, Vue!".

Please or to participate in this conversation.