Skip to content

Commit

Permalink
Test user deletion using Dusk
Browse files Browse the repository at this point in the history
  • Loading branch information
range-of-motion committed Aug 24, 2020
1 parent ee0a05e commit 890e8e1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .env.travis
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost:8000

DB_CONNECTION=mysql
DB_CONNECTION=testing
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=budget
Expand Down
35 changes: 35 additions & 0 deletions tests/Browser/DeleteUserTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace Tests\Browser;

use App\Models\User;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Support\Facades\Hash;
use Laravel\Dusk\Browser;
use Tests\DuskTestCase;

class DeleteUserTest extends DuskTestCase
{
public function testSuccess(): void
{
$password = 'hoi';

$user = factory(User::class)->create([
'password' => Hash::make($password)
]);

$this->browse(function (Browser $browser) use ($user, $password) {
$browser
->assertGuest()
->visit('/login')
->type('email', $user->email)
->type('password', $password)
->press('Log in')
->assertAuthenticated()
->visit('/settings/account')
->press('Delete')
->press('Yes, I am sure')
->assertGuest();
});
}
}

0 comments on commit 890e8e1

Please sign in to comment.