© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
4 replies
howdu

Test form component's action

Is there a way of interacting with individual form components inside a form?

E.g how to call add action on a repeater?
mountFormComponentAction('data.categories', 'add')
mountFormComponentAction('data.categories', 'add')


Or testing a select's createOptionForm
mountFormComponentAction('data.categories.record-183.language_id', 'editOption')
mountFormComponentAction('data.categories.record-183.language_id', 'editOption')


In v2 you could
livewire(EditProduct::class, [
    'record' => $product->getKey(),
])
->call(
    'dispatchFormEvent',
    'repeater::createItem',
    'data.categories',
)
livewire(EditProduct::class, [
    'record' => $product->getKey(),
])
->call(
    'dispatchFormEvent',
    'repeater::createItem',
    'data.categories',
)


Also is there a way of asserting that an action was called or is there a way to test notifications for an action. How do test the replicate action redirects to the newly created product in
assertRedirect
assertRedirect
?

livewire(EditProduct::class, [
    'record' => $product->id,
])
    ->callAction('replicate', data: [
        'name' => $name = $this->faker->unique()->realText(),
    ])
    ->assertHasNoActionErrors()
    ->assertNotified('Replicated')
    ->assertRedirect();
livewire(EditProduct::class, [
    'record' => $product->id,
])
    ->callAction('replicate', data: [
        'name' => $name = $this->faker->unique()->realText(),
    ])
    ->assertHasNoActionErrors()
    ->assertNotified('Replicated')
    ->assertRedirect();


This shows 'A notification was not sent'
Solution
CreateOptionForm

https://github.com/filamentphp/filament/discussions/10381#discussioncomment-7900957
GitHub
How to test select createOptionUsing · filamentphp filament · Discu...
I searched the docs for how to test select createOptionUsing modal but i couldn't find any Forms\Components\Select::make('owner_id') ->relationship('owner', 'name') -...
How to test select createOptionUsing · filamentphp filament · Discu...
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Test Form Component Action
FilamentFFilament / ❓┊help
2y ago
Test create action form field
FilamentFFilament / ❓┊help
2y ago
Test a notification's action?
FilamentFFilament / ❓┊help
3y ago
action with form with livewire component inside
FilamentFFilament / ❓┊help
15mo ago