saucebase/laravel-playwright
Integrate Playwright browser testing into Laravel applications with ease. This package provides helpers, configuration, and test utilities for running end-to-end browser tests against your app, streamlining UI testing within your existing PHP workflow.
Test-strategy investment (E2E vs. feature tests). This package lowers the cost of the most expensive tier of your test pyramid. By letting Playwright drive a real browser while still touching Laravel factories, Eloquent queries, artisan commands, and Carbon time travel, it collapses the two workarounds teams usually pay for: fragile HTTP seeding endpoints on one side, and slow Selenium/Dusk suites on the other. The decision it informs is "how much of our critical path do we cover with true browser tests?" — this package makes a larger E2E surface economically defensible.
Build vs. buy vs. glue. The realistic alternatives are: (a) Laravel Dusk — first-party but Selenium-era DX, slower and harder to parallelize; (b) Cypress/Playwright with bespoke test-only routes in routes/web.php to seed and inspect state — a recurring security and maintenance liability; (c) hand-rolled Node↔PHP bridges per project. This is buy at the cheapest possible price point (MIT, zero cost) for a problem most teams otherwise solve badly and repeatedly. Treat it as glue code: high leverage, low lock-in, easy to wrap.
Roadmap enablers it unlocks. Time travel is the sleeper feature — subscription renewals, trial expiry, proration, scheduled jobs, "expires in N days" UI states, and any DST/timezone bug become testable in a single deterministic run instead of a mocked clock that drifts from production behavior. Factory-driven seeding in E2E also unlocks realistic multi-record scenarios (org with 3 seats, 2 failed payments, 1 dunning email) that fixture files never model well.
Migration decisions. If the team is already standardizing on Playwright for a Vue/React/Inertia frontend, this removes the "but our backend is PHP" objection to a single E2E toolchain. That's a consolidation decision — one runner, one CI job shape, one mental model — not just a testing-library choice. As of v1.1.0 the connector tracks the Laravel 13 release line, so it no longer becomes the reason your E2E layer can't follow the framework upgrade. That sequencing matters: the test harness should not be the last thing holding back a Laravel major.
Release-gate quality. Deterministic data setup and in-test DB assertions directly reduce flake rate. Fewer flakes means fewer retries, shorter CI, and — the PM-relevant part — engineers who trust red builds. Untrusted suites get ignored, and ignored suites stop gating releases.
Good fit when:
composer.json whether 12.x support was widened or dropped before you plan a straddle period across both.tests/e2e/support/ module so a swap or fork costs hours, not a sprint.Look elsewhere when:
For executives: Our end-to-end tests are the slowest and least trusted part of our release gate. This is a small, free (MIT) connector that lets our browser tests talk directly to the Laravel app — so they set up realistic data, check what actually landed in the database, and simulate the passage of time. The business outcome is a faster, more reliable path to production and fewer "it worked in staging" incidents, particularly around billing dates and scheduled jobs, which are currently hard to test honestly. Cost is engineering hours, not license fees. It also shipped a Laravel 13 compatibility release this cycle, so adopting it won't pin us to an older framework major. Risk is contained: we'll isolate it behind our own thin wrapper so it can be replaced in a day.
For engineering: You get Playwright's runner, tracing, parallelism, and retries with first-class access to Laravel factories, Eloquent queries, and artisan — no test-only routes in web.php, no Selenium grid, no separate seeding CLI. Time travel means travelTo() semantics inside a real browser session, so date-sensitive flows get tested against actual rendering rather than a mocked clock. v1.1.0 upgrades the package to Laravel 13; read the diff to see whether the framework constraint was broadened (supports 12 and 13) or bumped (13 only), because that determines whether you can ride it through a staged framework migration or have to move both together. Caveats unchanged: still a small, single-maintainer project with no dependents, so pin the version, read the source before upgrading, and keep all call sites behind an internal helper module — the Laravel 13 release is evidence of active maintenance, not a guarantee of it. If it stalls upstream, forking is trivial — it's MIT glue, not framework code.
How can I help you explore Laravel packages today?