F
Filament2mo ago
drabew

assertTableActionDoesNotExist has no assertions

I have a simple test:
it('cannot see delete action when status is in_progress', function (): void {
$record = Order::factory()
->inProgress()
->create();

livewire(ListOrders::class)
->assertTableActionDoesNotExist(name: 'delete', record: $record);
});
it('cannot see delete action when status is in_progress', function (): void {
$record = Order::factory()
->inProgress()
->create();

livewire(ListOrders::class)
->assertTableActionDoesNotExist(name: 'delete', record: $record);
});
but message after running vendor/bin/pest is ! it cannot see delete action when status is in_progress → This test did not perform any assertions 0.19s DeleteAction is removed by the OrderPolicy:
public function delete(User $user, ?Model $order): bool
{
return $order->state->equals(Draft::class);
}
public function delete(User $user, ?Model $order): bool
{
return $order->state->equals(Draft::class);
}
so in OrderResource actions() method is just DeleteAction::make() DeleteAction is not available on record with in_progress state, but the test cannot check this.
5 Replies
Hasan Tahseen
Hasan Tahseen2mo ago
Yeah the same problem did happend to me.
Dennis Koch
Dennis Koch2mo ago
Sounds like a bug. Please report on Github
Hasan Tahseen
Hasan Tahseen2mo ago
@drabew I will report it if you don't mind. I have a plenty of time today ':)'.
drabew
drabewOP2mo ago
@Hasan Tahseen You're welcome
Hasan Tahseen
Hasan Tahseen2mo ago
GitHub
assertActionExists And assertActionDoesNotExist don't works as expe...
Package filament/filament Package Version v4.0.0-beta23 Laravel Version v12.20.0 Livewire Version v3.6.3 PHP Version 8.4.7 Problem description I have this test code it('say edit action is Exist...

Did you find this page helpful?