Error calling table actions in tests

I'm having an issue trying to call table actions in a test. I'm able to assert that the action is visible and hidden in based on policy checks but when actually trying to call the action something is going wrong. In [Filament\Tables\Testing\TestsBulkActions::mountTableBulkAction()](https://github.com/filamentphp/filament/blob/f8d751acb8527abda6abe6f9ee1106dd706a8171/packages/tables/src/Testing/TestsBulkActions.php#L46), $this->instance() is returning null and causing it to crash. It seems like $this-instance() works fine in previous method calls on the Livewire Testable instance but not in this method for some reason. Am I missing something obvious? Using Filament v3.3.10
No description
No description
Solution:
If I remove Livewire::setUpdateRoute() then my tests pass. It looks like the Livewire update was failing due to routing issues and then the next component state was null. For now I'll just only modify the update route when not running unit tests and this should work fine for now.
Jump to solution
1 Reply
Solution
Dave Calnan
Dave Calnan4mo ago
If I remove Livewire::setUpdateRoute() then my tests pass. It looks like the Livewire update was failing due to routing issues and then the next component state was null. For now I'll just only modify the update route when not running unit tests and this should work fine for now.

Did you find this page helpful?