repeater field test

please assist, am trying to check if a field in the repeater can through error if not available, and how i can use file in pest test to fill the field for testing. Here is a rough idea of what am trying to do.

The class


class Add extends Component implements HasForms { use InteractsWithForms; public $name = ''; public $phone_number = ''; protected function getFormSchema(): array { return [ TextInput::make('name') ->label('Full name') ->required(), Repeater::make('phones') ->relationship() ->schema([ TextInput::make('phone_number') ->label('Phone Number') ->hint('E.g: 255713001001 or 0713001001') ->required(), ]) ->label('Phone numbers') ->defaultItems(1) ->minItems(1) ->createItemButtonLabel('Add user phone number'), ]; } }

The test


livewire(Add::class) ->call('invite') ->assertHasErrors(['name', 'phone_number']);
Was this page helpful?