ModestasV
ModestasV
FFilament
Created by ModestasV on 4/29/2024 in #❓┊help
Testing Filament Relation Manager
Hey, Currently, I have an issue with Relation Manager testing. Here's the two problems I have: 1. RelationManager::form(): Argument #1 ($form) must be of type Filament\Forms\Form, Filament\Infolists\Infolist given, - this comes from the code below 2. I have no idea which method actually submits the form 🙂 Does anyone have any experience or examples how to test relation managers? So far, I have this:
livewire(FieldsRelationManager::class, [
'ownerRecord' => $crud,
'pageClass' => EditCrud::class,
])
->fillForm([
'type' => CrudFieldTypes::TEXT,
'validation' => CrudFieldValidation::REQUIRED,
'label' => 'Test Field',
'tooltip' => 'Test Tooltip',
'in_create' => true,
'in_edit' => true,
'in_list' => true,
])
->assertSuccessful();
livewire(FieldsRelationManager::class, [
'ownerRecord' => $crud,
'pageClass' => EditCrud::class,
])
->fillForm([
'type' => CrudFieldTypes::TEXT,
'validation' => CrudFieldValidation::REQUIRED,
'label' => 'Test Field',
'tooltip' => 'Test Tooltip',
'in_create' => true,
'in_edit' => true,
'in_list' => true,
])
->assertSuccessful();
And it successfully loads the relation manager as long as I don't have a form, but as soon as I do - it crashes. It might be that I am incorrectly setting the parameters, but I'm unsure. I have tried looking at the documentation, but I'm probably blind and could not find anything related. I took a look at google search and most of the same issue were on custom Livewire pages. Reference: https://filamentphp.com/docs/3.x/tables/testing https://laracasts.com/discuss/channels/laravel/testing-filamentphp-error-filamentinfolistsinfolist-given https://github.com/filamentphp/filament/discussions/8962 Ideas are welcome much appreciated!
4 replies