Skip to content
Laravel integration

Migrating from Dusk ​

Puth mirrors most of the Dusk Browser API, but a few behaviors differ.

Server lifecycle ​

  • Dusk starts ChromeDriver for you. Puth does not.
  • Run the Puth server separately and configure your client to connect.

Unsupported ​

  • $browser->moveMouse(xOffset, yOffset) is not supported.
  • Several window and cookie helpers do not work on iframes.

API differences ​

  • $browser->keys() uses Puppeteer key names and braced special-key sequences such as {Backspace}. See keyboard input.
  • Use $browser->acceptDialog(value) to supply prompt text while accepting the dialog. The current API also exposes $browser->typeInDialog(value), which queues text until acceptance.
  • Replace WebDriver $driver->executeScript() calls with $browser->evaluate(); see evaluating JavaScript.
  • Some assertion error messages are phrased differently.
  • Console output format is different from Dusk.

Register your Puth test directory in phpunit.xml and run php artisan test. Existing Dusk tests can stay in a separate directory while you migrate. See Laravel setup and waiting and sync for configuration.

Application requests ​

Portal and detours are disabled by default in Laravel tests. If your tests need application requests to run through the test process, enable portal explicitly as described in portal and detours.