© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
1 reply
Hemith

Table Column Action testing not working in Manage Page.

I'm getting the following error when I try to call a table column action in my ManageNewsPage.
 Failed asserting that a table column with name [set_public] exists on the [App\Filament\Resources\NewsResource\Pages\ManageNews] component.
Failed asserting that null is an instance of class Filament\Tables\Columns\Column.
 Failed asserting that a table column with name [set_public] exists on the [App\Filament\Resources\NewsResource\Pages\ManageNews] component.
Failed asserting that null is an instance of class Filament\Tables\Columns\Column.


Here is the test case:
it('can set news to public with button', function () {
    $news = News::factory()->create([
        'status' => '下書き'
    ]);
    expect($news->status)->toBe('下書き');

    livewire(NewsResource\Pages\ManageNews::class)
        ->callTableColumnAction('set_public', $news)
        ->assertTableColumnStateSet('status', '公開中');

    $news->refresh();
    expect($news->status)->toBe('公開中');
});
it('can set news to public with button', function () {
    $news = News::factory()->create([
        'status' => '下書き'
    ]);
    expect($news->status)->toBe('下書き');

    livewire(NewsResource\Pages\ManageNews::class)
        ->callTableColumnAction('set_public', $news)
        ->assertTableColumnStateSet('status', '公開中');

    $news->refresh();
    expect($news->status)->toBe('公開中');
});


Here are the table actions:
  ->actions([
                Tables\Actions\EditAction::make()
                    ->icon(null)
                    ->label('編集')
                    ->view('filament.actions.edit-modal-button'),
                // Tables\Actions\DeleteAction::make(),
                Tables\Actions\Action::make('set_public')
                    ->label('公開')
                    ->button()
                    ->action(function ($record) {
                        $record->status = '公開中';
                        $record->save();
                    })
                    ->view('filament.actions.public-only-status-button'),
            ]);
  ->actions([
                Tables\Actions\EditAction::make()
                    ->icon(null)
                    ->label('編集')
                    ->view('filament.actions.edit-modal-button'),
                // Tables\Actions\DeleteAction::make(),
                Tables\Actions\Action::make('set_public')
                    ->label('公開')
                    ->button()
                    ->action(function ($record) {
                        $record->status = '公開中';
                        $record->save();
                    })
                    ->view('filament.actions.public-only-status-button'),
            ]);
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

testing table action
FilamentFFilament / ❓┊help
2y ago
Table action testing
FilamentFFilament / ❓┊help
3y ago
Table Action Not Working
FilamentFFilament / ❓┊help
3y ago
`assertnotified` not working in table action
FilamentFFilament / ❓┊help
14mo ago