Tests: assertActionDoesNotExist failing for DeleteAction
I have a simple test to check if my
DeleteAction
s are being hidden appropriately for users that don't have the permission.
This works fine in the app, but in my tests the assertions don't seem to behave the same way.
My test is as follows (assuming I have a user with the relevant lack of permissions):
Assuming the ThingPolicy
returns false
for delete/deleteAny (which it does), why does the test always fail? To prove my point, I changed it to assertActionExists
and it passes.
I've tried to dive in to see where DeleteAction
might check the relevant model policy but I can't find it.1 Reply
i ran into this just now.
I was wondering if, in my action i am "only" using the hidden method to not show it, and if i was missing an additional method for the user to not be able to click (And the test pass).
looking at the source, i think this is the assertion we where looking for: Filament\Actions\Testing\TestsActions::assertActionVisible