Dusk Notes

Posted: 2017-12-10 12:19:55

Just keeping a list of gotchas around dusk.

use RefreshDatabase not working

Cost: 1 hour lost

Basically I had to go back to the slower "use DatabaseMigrations;" otherwise it would not work. The user was null.

Links: This thread helped

Headless or not

Cost: 1 hour lost or less

For some odd reasons my tests started coming up blank.

I turned off headless in this class DuskTestCase

    protected function driver()
    {
        $args = [
            '--disable-gpu',
            '--headless'
        ];
        if (env("HEADLESS_OFF")) {
            $args = [
                '--disable-gpu'
            ];
        }
        $options = (new ChromeOptions)->addArguments($args);

        return RemoteWebDriver::create(
            'http://localhost:9515',
            DesiredCapabilities::chrome()->setCapability(
                ChromeOptions::CAPABILITY,
                $options
            )
        );
    }

And this way it still works on travis.