fasna
fasna
FFilament
Created by fasna on 10/17/2023 in #❓┊help
Filament Testing Forms in Modal
I can create users, and this test works perfectly, I need more tests on the form for validation and form loading
test('non-admin can create new user using the form', function () {
expect(User::count())->toBe(1);
livewire(ListUsers::class)
->mountAction('create')
->setActionData([
'first_name' => $firstName = fake()->firstName(),
'last_name' => $lastName = fake()->lastName(),
'username' => fake()->userName(),
'email' => fake()->userName() . '@domain.com',
])
->callMountedAction();
$createdUser = User::latest()->limit(1)->get()->first();
expect($createdUser->first_name)->toBe($firstName);
expect($createdUser->last_name)->toBe($lastName);
expect(User::count())->toBe(2);
});
test('non-admin can create new user using the form', function () {
expect(User::count())->toBe(1);
livewire(ListUsers::class)
->mountAction('create')
->setActionData([
'first_name' => $firstName = fake()->firstName(),
'last_name' => $lastName = fake()->lastName(),
'username' => fake()->userName(),
'email' => fake()->userName() . '@domain.com',
])
->callMountedAction();
$createdUser = User::latest()->limit(1)->get()->first();
expect($createdUser->first_name)->toBe($firstName);
expect($createdUser->last_name)->toBe($lastName);
expect(User::count())->toBe(2);
});
4 replies
FFilament
Created by fasna on 10/17/2023 in #❓┊help
Filament Testing Forms in Modal
Just a very simple test, I'm loading the from through Modal, using headerActions CreateAction
it('has the correct form loaded', function () {

livewire(ListUsers::class)
->mountAction('create')
->assertFormExists();

});
it('has the correct form loaded', function () {

livewire(ListUsers::class)
->mountAction('create')
->assertFormExists();

});
4 replies
FFilament
Created by fasna on 10/5/2023 in #❓┊help
Display a filter based on previously selected filter option
Thank you, I'll check on this
4 replies