Testing formActions

I have a following footer actions:

->footerActions([
fn (string $operation): Action => Action::make('saveBasicDetails')
->label('Save changes')
->action(function (Section $component, EditRecord $livewire) {
$livewire->saveFormComponentOnly($component);

Notification::make()
->title('Basic details saved')
->success()
->send();
})
->visible($operation == 'edit'),
])

->footerActions([
fn (string $operation): Action => Action::make('saveBasicDetails')
->label('Save changes')
->action(function (Section $component, EditRecord $livewire) {
$livewire->saveFormComponentOnly($component);

Notification::make()
->title('Basic details saved')
->success()
->send();
})
->visible($operation == 'edit'),
])
Is there a way to test it? It is inside a section of the form
1 Reply
Krzysztof
KrzysztofOP5mo ago
I've tried testing this way with no luck:
Livewire::test(EditUser::class, [
'record' => $user->id,
])
->fillForm([
'name' => 'New name',
])
->callAction('saveBasicDetails')
->assertHasNoErrors();
Livewire::test(EditUser::class, [
'record' => $user->id,
])
->fillForm([
'name' => 'New name',
])
->callAction('saveBasicDetails')
->assertHasNoErrors();
Failed asserting that an action with name [saveBasicDetails] exists on the [Workflou\Filament\Resources\UserResource\Pages\EditUser] page. Failed asserting that null is an instance of class Filament\Actions\Action.
Want results from more Discord servers?
Add your server