Skip to content

Getting started

Requirements

  • PHP 8.2+
  • Laravel 10, 11, or 12
  • Node.js 20+ (runs the Playwright engine)

Install

bash
composer require --dev gawrys/dawn
vendor/bin/playwright-install --browsers

The second command installs the Playwright Node dependencies and downloads the browser binaries (Chromium by default). On CI add --with-deps to also install OS-level dependencies.

Dawn\DawnServiceProvider is auto-discovered; it registers the environment-gated /_dawn/login, /_dawn/logout and /_dawn/user routes that power loginAs() and the authentication assertions - the same out-of-process mechanism Dusk uses. They are never registered in production.

Your first test

Create tests/DuskTestCase.php (or adapt your existing one - see Migrating from Dusk):

php
<?php

namespace Tests;

use Dawn\TestCase as BaseTestCase;

abstract class DuskTestCase extends BaseTestCase
{
    // Laravel 10 only: use CreatesApplication;
}

And a test in tests/Browser:

php
<?php

namespace Tests\Browser;

use Laravel\Dusk\Browser;
use Tests\DuskTestCase;

class ExampleTest extends DuskTestCase
{
    public function test_basic_example(): void
    {
        $this->browse(function (Browser $browser) {
            $browser->visit('/')
                ->assertTitleContains('Laravel');
        });
    }
}

Run it:

bash
vendor/bin/phpunit tests/Browser

Dawn starts one browser per PHP process (one Node sidecar, spawned automatically) and reuses the primary browser across tests within a class, exactly like Dusk. Failure screenshots land in tests/Browser/screenshots, console logs in tests/Browser/console.

Released under the MIT License. Not affiliated with Laravel.