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);
});
Was this page helpful?