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')

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

In v2 you could
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?

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
GitHub
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') -...
Was this page helpful?