Mister Nicolaz
Mister Nicolaz
FFilament
Created by Mister Nicolaz on 4/16/2024 in #❓┊help
Test authentication with Pest
How could you best test the login of filament dashboard, since there is no POST option on the login route?
test('Admin user can login with valid credentials', function () {
$user = createUser('Admin');

$response = $this->post('admin/login', [
'email' => $user->email,
'password' => 'password',
]);

$response->assertRedirect(route('filament.admin.pages.dashboard'));
$this->assertAuthenticatedAs($user);
});
test('Admin user can login with valid credentials', function () {
$user = createUser('Admin');

$response = $this->post('admin/login', [
'email' => $user->email,
'password' => 'password',
]);

$response->assertRedirect(route('filament.admin.pages.dashboard'));
$this->assertAuthenticatedAs($user);
});
21 replies