Skip to content

What is Dawn?

Dawn is a Composer package that lets an existing Laravel Dusk test suite run on Playwright instead of Selenium/ChromeDriver - without rewriting the tests. You change the base class of your DuskTestCase; every test body stays exactly as written.

Dawn does not swap Dusk's WebDriver driver; it reimplements Dusk's public Browser API on Playwright.

What that means in practice

php
use Laravel\Dusk\Browser;   // ← this import keeps working

class LoginTest extends DuskTestCase
{
    public function test_user_can_log_in(): void
    {
        $this->browse(function (Browser $browser) {
            $browser->visit('/login')
                ->type('email', 'taylor@laravel.com')
                ->type('password', 'secret')
                ->press('Login')
                ->waitForLocation('/dashboard')
                ->assertSee('Welcome back');
        });
    }
}

Under Dawn, Browser is Dawn\Browser, type() compiles to a Playwright locator fill(), press('Login') resolves the button the same way Dusk does (selector → name → submit value → text), and waitForLocation() waits inside the browser - no PHP-side polling.

What Dawn is not

  • Not a WebDriver driver swap. There are no Facebook\WebDriver interfaces anywhere and no WebDriver endpoint.
  • Not a poller. No sleep(), no implicit wait loops, no DOM polling on top of Playwright. Waiting is delegated to Playwright's native auto-wait. (waitUsing() - whose contract is an arbitrary PHP closure - is the single documented exception.)
  • Not a Pest plugin. Dawn is class-based and PHPUnit-native, mirroring DuskTestCase, for teams that cannot move to Pest's closure-style browser testing.
  • Not an HTTP bridge. Your tests stay in PHP; nothing is rewritten in TypeScript.

Compatibility promise

Dawn implements ~95% of the Dusk Browser API - a figure measured automatically against the current upstream laravel/dusk, not hand-counted. Anything Dusk's Browser can do either works identically, or throws a typed Dawn\Exceptions\UnsupportedDuskMethod naming the method and linking to the compatibility table - never a silent approximation.

The only unsupported methods are ones that genuinely cannot map onto the stack: OS-window maximize()/move(), interactive tinker()/stop(), and the JavaScript-dialog methods (an engine-level deadlock, explained in the table).

Released under the MIT License. Not affiliated with Laravel.