Filament Test Fails for Force Delete Action but Works in Browser
I'm testing a
Here’s my test code:
And here is the
it works in the browser. However, in the test, it appears that the model is still present in the database, causing
What could cause the action to work in the browser but fail during the test? How can I resolve this discrepancy?
ForceDeleteAction
for an organization in a Filament table builder Liveware component using Pest. The functionality works perfectly in the browser but fails during the test, with the error:Here’s my test code:
And here is the
ForceDeleteAction
implementation:it works in the browser. However, in the test, it appears that the model is still present in the database, causing
assertModelMissing
to fail.
Additional Details:
- The Organization
model uses soft deletes.
- The database has a deleted_at
column.
- The trashed()
state in the factory correctly sets the deleted_at
column.What could cause the action to work in the browser but fail during the test? How can I resolve this discrepancy?
Solution:Jump to solution
yes
```php
livewire(Index::class)
->filterTable('trashed', 1) // make sure the trashed filtered is active
->callTableAction(ForceDeleteAction::class, $organization, ['confirmation' => 'Confirm'])...
2 Replies