Writing PEST tests for Filament Tables

Hi, I have a ListItemResource which is simply to store a key value pair in the database. I have a ListListItems.php which includes the table of all the entries. I'm trying to write a test to ensure that the table is populated. So far I have the following tests:

Render pages - Works fine βœ…
Check "value" column is in table - Works fine βœ…
Check all items in table - Fails ❌

I've tried all sorts of different variations including PHPUnit and PEST. I currently have PEST installed along with the livewire plugin too. The user is authenticated via actingAs method. All namespaces etc are used.

It seems that the tests just blurts out the HTML to the terminal, but can never match any results from the array of ListItems.

The code is as close to the docs here as I can get: https://filamentphp.com/docs/3.x/panels/testing#table but still no joy.

I've attached a screenshot showing the test code and the error in the terminal.

Thanks in advance πŸ™‚
image.png
Solution
Are you modifying something in the query? It is weird because your table has 12 records..
try ->assertCountTableRecords(12)
Was this page helpful?