Testing form actions

Couldn't see this in the docs. Given that a livewire component is set up with a custom form and action as follows:
public function form(Form $form): Form
{
return $form->schema([
TextInput::make('name')
->required(),
Actions::make([
Action::make('action')
->action(/** doing something **/)
]);
}
public function form(Form $form): Form
{
return $form->schema([
TextInput::make('name')
->required(),
Actions::make([
Action::make('action')
->action(/** doing something **/)
]);
}
With the following test (which fails) I can't find a way to pass the form to callAction order to test the action:
livewire(MyPage::class)
->fillForm([
'name' => 'something'
])
->callAction('action');
livewire(MyPage::class)
->fillForm([
'name' => 'something'
])
->callAction('action');
This results in Failed asserting that an action with name [action] exists on the [App\Filament\Pages\MyPage] page. Does such functionality exist? Here a component name should be provided but we don't have one.
livewire(MyPage::class)
->fillForm([
'name' => 'something'
])
->assertFormComponentActionExists('component','action')
}
livewire(MyPage::class)
->fillForm([
'name' => 'something'
])
->assertFormComponentActionExists('component','action')
}
We need to solve this.
1 Reply
LeandroFerreira
GitHub
Testing form actions · filamentphp filament · Discussion #14493
Package Form builder Package Version v3.0.0 How can we help you? Couldn't see this in the docs. Given that a livewire component is set up with a custom form and action as follows: public functi...
Want results from more Discord servers?
Add your server