getTable() on null on Pest Test

Hi all

I need some help with some table tests if anyone can spare a few minute please.

I am getting:
Error: Call to a member function getTable() on null



it('can render post titles', function () {
    \App\Models\Client::factory()->count(10)->create();

    livewire(\App\Filament\Clusters\Contacts\Resources\ClientResource\Pages\ListClients::class)
        ->assertCanRenderTableColumn('name');
});


I must say I am very new to tests. I have used the example on the filamentdocs https://filamentphp.com/docs/3.x/tables/testing

The page itself loads okay and shows results.

Any advice?


EDIT: another example:
it('shows results', function () {
    $posts = \App\Models\Client::factory()->count(4)->create();

    livewire(\App\Filament\Clusters\Contacts\Resources\ClientResource\Pages\ListClients::class)
        ->assertCanSeeTableRecords($posts)
        ->assertCountTableRecords(4);
});


gives
Error: Call to a member function getTableRecordKey() on null
Was this page helpful?