The title says it all. I would like to know how to properly set up a new Laravel 5.4 project using Dusk using an in-memory SQLite database.
I can run tests, but I get an error: "There is no such table: users"
- I created a new Laravel 5.4 project
- Mounted Twilight and Added Service Provider
- I am using a test from laravel docs that authenticates. It already includes the DatabaseMigrations property.
- I can run tests, and the first one works (switching to the route / login), but the second one where he tried to log in fails.
I added .env.dusk.local
which contains
APP_ENV=local
APP_KEY=RANDOM_STRING_HERE
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://laravel54.dev
DB_CONNECTION=sqlite
DB_DATABASE=':memory:' // I've also tried just :memory: and also adding these details to the config/database.php file but to no avail
, ( docs)
<?php
namespace Tests\Browser;
use App\User;
use Tests\DuskTestCase;
use Laravel\Dusk\Chrome;
use Illuminate\Foundation\Testing\DatabaseMigrations;
class LoginTest extends DuskTestCase
{
use DatabaseMigrations;
public function test_login_page()
{
$user = factory(User::class)->create();
$this->browse(function ($browser) use ($user) {
$browser->visit('/login')
->type('email', $user->email)
->type('password', 'secret')
->press('Sign in')
->assertPathIs('/home');
});
}
}
?