FilamentF
Filament15mo ago
uendel

How to test the form of a relation manager?

I want to verifiy if one select field of my relation manager has the correct options, however I don't know how I can make this assertion. I've tried:

    livewire(RelationManager::class, ['ownerRecord' => $record, 'pageClass' => ''])
        ->assertFormFieldExists(
            'select_field',
            checkFieldUsing: function ($field) {
                $options = $field->getOptions();

                expect($options)
                    ->toHaveCount(1);

                return true;
            },
        );


But this returns the error:

`
Argument #1 ($form) must be of type Filament\Forms\Form, Filament\Infolists\Infolist given, called in /var/www/html/vendor/filament/infolists/src/Concerns/InteractsWithInfolists.php


How can I test this?
Was this page helpful?