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:
But I get this error:
This is an excerpt of the relation manager component:
Thoughts?
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?