© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
8 replies
Bruno Silva

How can I test a form from a modal? (simple resource)

I have some resources made with --simple flag, so they don't have
Create
Create
,
Edit
Edit
or
View
View
pages, only the
Manage
Manage
class. I would like to know 2 things, how to assert the modal rendering and how to test the form (because the
fillForm
fillForm
seems to not work in this case).

1 - is this a good assertion for the "render modal test"?
livewire($manageModelClass)
    ->callAction('create')
    ->assertSeeHtml('fi-modal-window')
    ->assertSee('Create');
livewire($manageModelClass)
    ->callAction('create')
    ->assertSeeHtml('fi-modal-window')
    ->assertSee('Create');


2 - how to use the fillForm for modals?
livewire($manageModelClass)
    ->callAction('create') // it does render the modal
    ->assertFormExists() // error
    ->fillForm($formData) // error
livewire($manageModelClass)
    ->callAction('create') // it does render the modal
    ->assertFormExists() // error
    ->fillForm($formData) // error
Solution
$data = [
    'title' => 'Title',
    'description' => 'Description',
    ...
];

livewire(ManageXXX::class)
    ->callAction('create', data: $data)
    ->assertHasNoActionErrors();
$data = [
    'title' => 'Title',
    'description' => 'Description',
    ...
];

livewire(ManageXXX::class)
    ->callAction('create', data: $data)
    ->assertHasNoActionErrors();


https://filamentphp.com/docs/3.x/actions/testing
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

Opening edit modal from a different resource (simple modal resources)
FilamentFFilament / ❓┊help
3y ago
How test resource flag --simple
FilamentFFilament / ❓┊help
2y ago
Simple Resource Modal Width
FilamentFFilament / ❓┊help
3y ago
test `--simple` resource crud
FilamentFFilament / ❓┊help
15mo ago