© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•15mo ago•
5 replies
Vp

test `--simple` resource crud

I am testing
simple
simple
resource like
has form
has form
,
has form field
has form field
but I always got error, below are my test and error I had.
// Test
it('has a form', function () {
    livewire(AnnouncementResource\Pages\ManageAnnouncements::class)
        ->mountAction('create')
        ->assertFormExists();
});

it('has form fields', function (string $field) {
    livewire(AnnouncementResource\Pages\ManageAnnouncements::class)
        ->mountAction('create')
        ->assertFormFieldExists($field);
})->with(['title', 'detail']);
// Test
it('has a form', function () {
    livewire(AnnouncementResource\Pages\ManageAnnouncements::class)
        ->mountAction('create')
        ->assertFormExists();
});

it('has form fields', function (string $field) {
    livewire(AnnouncementResource\Pages\ManageAnnouncements::class)
        ->mountAction('create')
        ->assertFormFieldExists($field);
})->with(['title', 'detail']);

Error => Argument #1 ($form) must be of type Filament\Forms\Form, Filament\Infolists\Infolist given.
Error => Argument #1 ($form) must be of type Filament\Forms\Form, Filament\Infolists\Infolist given.

How Can I make this test pass. thanks in advance
EDITED: Now error only on form
Solution
because it is not a form, it is a modal form.
You could verify if the action was called or if the modal form contains something using
assertSee
assertSee
or
assertSeeHtml
assertSeeHtml

https://filamentphp.com/docs/3.x/actions/testing#modal-content
Testing - Actions - Filament
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

How to test a simple resource CRUD functionality?
FilamentFFilament / ❓┊help
3y ago
How test resource flag --simple
FilamentFFilament / ❓┊help
2y ago
Testing resource CRUD using PHPUnit
FilamentFFilament / ❓┊help
2y ago
CRUD another resource in an edit
FilamentFFilament / ❓┊help
2y ago