protonemedia/inertiajs-events-laravel-dusk
Laravel Dusk helpers for testing Inertia.js events. Adds assertions and utilities so you can verify Inertia events fire as expected in browser tests, making it easier to cover Inertia-powered Laravel flows end to end.
Test-strategy decisions for Inertia.js SPAs on Laravel Dusk. Inertia navigation is XHR-driven (no full page reload), so Dusk's default waitFor / assertSee primitives race against the client-side visit lifecycle. Teams end up either sprinkling pause()/fixed sleeps (slow, still flaky) or under-testing. This package surfaces Inertia's browser events (inertia:start, inertia:success, inertia:error, inertia:invalid, inertia:finish) into Dusk so assertions can synchronize on real navigation state. That directly informs:
AssertableInertia. That is a coverage decision, not just a tooling one.composer update.Consider it when:
@inertiajs/inertia / @inertiajs/vue3 version — the package predates Inertia v1 GA and v2, and 1.3.0 did not change that).Look elsewhere when:
AssertableInertia, or move browser testing to Playwright/Cypress, which have first-class async SPA primitives (network idle, route interception) and no equivalent maintenance gap.To executives: This is a small, free (MIT), developer-only utility that makes our browser tests for Inertia screens reliable instead of timing-dependent. It doesn't touch production code or customers — it reduces CI flake and the engineering hours spent re-running and debugging E2E failures. The new 1.3.0 release is a compatibility refresh (Laravel 10, Dusk 7, PHP 8.2) and removes the "abandoned project" concern that previously argued for immediate forking. It is still not a platform bet: it's a single-maintainer, zero-dependent package, so we'd time-box adoption, pin the version, and keep vendoring as the fallback. Expected cost: under a day of engineering; expected return: fewer retried CI runs and trustworthy end-to-end coverage of form/validation flows.
To engineering: It registers Inertia's client-side lifecycle events as Dusk-observable hooks, so waitForInertiaEvent('success')-style assertions replace pause() and retry loops. Adoption is composer require --dev plus a macro registration. Two things changed with 1.3.0: the package now explicitly supports Laravel 10 / Dusk 7 / PHP 8.2, so it fits our current stack without patching; and it hard-drops Laravel < 9 and PHP < 8.1, so any service or CI image still on the old floor needs the app upgrade first (or a 1.2.x pin, which we should avoid). The remaining risk is Inertia-version drift — 1.3.0 did not touch the event-hook layer, so confirm the event names against our installed @inertiajs/* in a spike, and plan to vendor the macro into tests/Browser if we want to insulate against future staleness. Fallback is unchanged: a short in-house browser macro, same behavior, no dependency.
Recommendation: Spike, then pin-or-vendor — the drop-in path is now defensible. One day to validate against our Inertia version and confirm the PHP/Laravel floor matches our CI; if it works, pin 1.3.0 and treat vendoring into our own test support code as the pre-agreed exit if upstream goes quiet again.
How can I help you explore Laravel packages today?