ArneDB's avatar

Laravel Dusk: Running one test at a time works, but when running two tests or more a PDOException is thrown

Hello there,

I have a few dusk tests, they're slow high level tests, they give me alot of comfort! :D I can run every single one of these tests in isoloation with --filter, but when I just run php artisan dusk, the first test works, but after that the tests generate SQLSTATE[HY000]: General error: 10 disk I/O error

There's always another SQL error, here's some examples: (SQL: alter table "users" add column "trial_ends_at" datetime null)

Illuminate\Database\QueryException: SQLSTATE[HY000]: General error: 10 disk I/O error (SQL: insert into "migrations" ("migration", "batch") values (2018_12_05_184924_create_failed_jobs_table, 1))

Illuminate\Database\QueryException: SQLSTATE[HY000]: General error: 10 disk I/O error (SQL: drop table if exists "cache")

I am testing with sqlite in an in-memory database.

I've been googling, there seem to be other people who are running into similar issues, but none have encountered the same 10 disk I/O error.

As a matter of test I have added the following setUp() and tearDown() to my tests: (Note: the issue already arose before I implemented the beneath functions)

public function setUp(): void
    {
        parent::setUp();

        foreach (static::$browsers as $browser) {
            $browser->driver->manage()->deleteAllCookies();
        }
    }
    public function tearDown(): void
    {
        parent::tearDown();
    }
0 likes
2 replies
ArneDB's avatar

Hello there,

As a workaround I'm now set my APP_URL to localhost:port (change with ip & port), which I can then serve via php artisan serve --env=dusk.local

here's my source: https://medium.com/@splatEric/working-with-laravel-dusk-54d67cc0241b#.b4va8ibx8

This does indeed work, probably because it's running on the host machine (same process).

Weird thing is, I have been using dusk in the past. And I always thought this was run in memory. But it might have just ran against the mysql database.

Please or to participate in this conversation.