How to test pages that extend extend ManageRelatedRecords (Create via Modal)
How would you properly setup a simple test for a custom page that extends ManageRelatedRecords?
This is a standard page create using
make:filament-page
and selecting Relationship.
The form is in a Modal and I think that is where I'm getting stuck.
I would love to see an example of how to just see how to assert the successful submission of a create form (no errors) via the modal. I think I could plow through the rest from there. 🙂4 Replies
I'm making a little progress, but I'm having a very difficult time with submitting the form as well as any FormFill calls and form error checking calls. Is there any way to test the form portion of the code while skipping on the table action portion?
I feel like I'm pulling in way too much here to test a few simple form conditions.
Ok, I think I've found the right direction now. I was looking in Panels and Forms, but I think the testing docs I needed were in https://filamentphp.com/docs/3.x/actions/testing. I'm still struggling on actually submitting the "Create" action from the Relation Manager Page to actully save the form.
Should ->callMountedAction() be submitting the create form?
This is I suppose what is the 'standard create action' on a relation page. I haven't really customized anything yet.
callTableAction is doing to mount, fill the form, and submit
callMountedAction is used if you want to manually mount, and then set the data, and then use it to submit