© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
3 replies
Davide Bellini

Testing relation manager form field visibility

How can I test form field visibility in a relation manager modal?

e.g. I would assert that "email" field is visible using ViewAction.

I have tried this:
livewire(InvitationsRelationManager::class, ['ownerRecord' => $model])
    ->mountTableAction(ViewAction::class, $invitation)
    ->assertFormFieldIsVisible('email')
    ->callMountedTableAction();
livewire(InvitationsRelationManager::class, ['ownerRecord' => $model])
    ->mountTableAction(ViewAction::class, $invitation)
    ->assertFormFieldIsVisible('email')
    ->callMountedTableAction();


But I get this error:
Failed asserting that a field with the name [email] exists on the form with the name [form] on the [App\Filament\Resources\LodgerResource\RelationManagers\InvitationsRelationManager] component.
  Failed asserting that null is an instance of class "Filament\Forms\Components\Field".
Failed asserting that a field with the name [email] exists on the form with the name [form] on the [App\Filament\Resources\LodgerResource\RelationManagers\InvitationsRelationManager] component.
  Failed asserting that null is an instance of class "Filament\Forms\Components\Field".


This is an excerpt of the relation manager component:
class InvitationManager extends RelationManager
{
    protected static string $relationship = 'invitations';

    protected static ?string $recordTitleAttribute = 'email';

    // ...

    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                TextInput::make('email')
                    ->translateLabel()
                    ->email()
                    ->required()
                    ->dehydrateStateUsing(fn ($state) => mb_strtolower($state)),

                    // ..
            ]);
    }

    // ...
}
class InvitationManager extends RelationManager
{
    protected static string $relationship = 'invitations';

    protected static ?string $recordTitleAttribute = 'email';

    // ...

    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                TextInput::make('email')
                    ->translateLabel()
                    ->email()
                    ->required()
                    ->dehydrateStateUsing(fn ($state) => mb_strtolower($state)),

                    // ..
            ]);
    }

    // ...
}


Thoughts?
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Relation manager form
FilamentFFilament / ❓┊help
2y ago
Testing relation manager actions
FilamentFFilament / ❓┊help
12mo ago
Testing Filament Relation Manager
FilamentFFilament / ❓┊help
2y ago
Hide form field in relation manager create modal
FilamentFFilament / ❓┊help
2y ago