Testing Modals
I'd like to create a simple unit test to check that if I call a Page Action, then a modal is shown with the form. For example, I want to test that when I call the CreateAction (on a simple ResourceManager) that the modal with the create form is shown and that it contains some fields. How can I do that?
1 Reply
I've tested doing a simple: $page = livewire(BusinessAreaResource\Pages\ListBusinessAreas::class);
$page->callPageAction("create")->assertFormExists();
Figured it out. For future reference, here it is how I made it:
$page = livewire(BusinessAreaResource\Pages\ListBusinessAreas::class);
$page
->mountPageAction('create')
->assertDispatchedBrowserEvent("open-modal")
->assertFormFieldExists("name", "mountedActionForm");