F
Filamentβ€’7mo ago
ModestasV

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!
Laracasts
GitHub
Testing FilamentPHP Error - Filament\Infolists\Infolist given Β· fil...
Hello all, I made filament custom page with a form and some logic. Please find the code of the page below. The form is working properly. However, when I set some test (code below), I have an error ...
2 Replies
ModestasV
ModestasVOPβ€’7mo ago
Okay, variant no.2 is getting closer:
livewire(FieldsRelationManager::class, [
'ownerRecord' => $crud,
'pageClass' => EditCrud::class,
])
->callTableAction(
'create',
$crud,
[
'type' => CrudFieldTypes::TEXT,
'validation' => CrudFieldValidation::REQUIRED,
'label' => 'Test Field',
'tooltip' => 'Test Tooltip',
'in_create' => true,
'in_edit' => true,
'in_list' => true,
]
)
->assertHasNoErrors()
->assertSuccessful();
livewire(FieldsRelationManager::class, [
'ownerRecord' => $crud,
'pageClass' => EditCrud::class,
])
->callTableAction(
'create',
$crud,
[
'type' => CrudFieldTypes::TEXT,
'validation' => CrudFieldValidation::REQUIRED,
'label' => 'Test Field',
'tooltip' => 'Test Tooltip',
'in_create' => true,
'in_edit' => true,
'in_list' => true,
]
)
->assertHasNoErrors()
->assertSuccessful();
This does call what I need, but it still does not submit πŸ™‚ I'm probably doing something wrong
CGM
CGMβ€’6mo ago
Any luck with your test? I'm getting stuck in pretty much the same place on the custom page relation. FormFill is giving me an argument error related to infolists.
Want results from more Discord servers?
Add your server