Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filamentβ€’2y agoβ€’
11 replies
Adam Holmes

Writing PEST tests for Filament Tables

Hi, I have a
ListItemResource
ListItemResource
which is simply to store a key value pair in the database. I have a
ListListItems.php
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
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
ListItem
ListItem
s.

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
Testing - Panel Builder - Filament
Solution
Are you modifying something in the query? It is weird because your table has 12 records..
try
->assertCountTableRecords(12)
->assertCountTableRecords(12)
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel β€’ Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Sample of writing unit tests using Pest
FilamentFFilament / β“β”Šhelp
3y ago
Import PEST Tests
FilamentFFilament / β“β”Šhelp
2y ago
Create pest tests
FilamentFFilament / β“β”Šhelp
3y ago
On Pest 4, filling forms on browser tests for Filament 4
FilamentFFilament / β“β”Šhelp
6mo ago