Testing a HintAction in a Relation Manager

Hello - I am running into an issue trying to write a test for a HintAction inside a relation manager.
// this is in the form element of the relation manager
use Filament\Forms\Components\Actions\Action as ActionsAction;

Select::make('category_id')
->label('Menu Category')
->required()
->searchable()
->reactive()
->hintAction(
ActionsAction::make('createCategory')
->label('Create New Category')
->form([
TextInput::make('name')
->required()
->columnSpanFull(),
Select::make('payment_code_type_id')
->label('Payment Code Type')
->required()
->options(PaymentCodeType::pluck('name', 'id')),

])

// this is the test
livewire(ItemsRelationManager::class, [
'ownerRecord' => $event,
'pageClass' => EditEvent::class,
])
->callTableAction(EditAction::class, $item)
->callFormComponentAction('category_id', 'createCategory', data: [
'name' => $name,
'payment_code_type_id' => $paymentCodeType->id,
])
->assertHasNoFormComponentActionErrors();
// this is in the form element of the relation manager
use Filament\Forms\Components\Actions\Action as ActionsAction;

Select::make('category_id')
->label('Menu Category')
->required()
->searchable()
->reactive()
->hintAction(
ActionsAction::make('createCategory')
->label('Create New Category')
->form([
TextInput::make('name')
->required()
->columnSpanFull(),
Select::make('payment_code_type_id')
->label('Payment Code Type')
->required()
->options(PaymentCodeType::pluck('name', 'id')),

])

// this is the test
livewire(ItemsRelationManager::class, [
'ownerRecord' => $event,
'pageClass' => EditEvent::class,
])
->callTableAction(EditAction::class, $item)
->callFormComponentAction('category_id', 'createCategory', data: [
'name' => $name,
'payment_code_type_id' => $paymentCodeType->id,
])
->assertHasNoFormComponentActionErrors();
I get the following error message when I try to run the test: Argument #1 ($form) must be of type Filament\Forms\Form, Filament\Infolists\Infolist given, called in /Users/robertwurtz/Sites/site/vendor/filament/infolists/src/Concerns/InteractsWithInfolists.php on line 56 I'm confused because nothing in here uses an Infolist - it's all Forms. I tried following the relevant documentation (https://filamentphp.com/docs/3.x/forms/testing#actions) so I'm not sure where to go from here. Thanks in advance!
2 Replies
LeandroFerreira
LeandroFerreira5mo ago
ahh, sorry I didn't see this post
Want results from more Discord servers?
Add your server