codewithdennis / filament-tests
A package that creates PEST tests specifically tailored for your filament resources
Installs: 2 604
Dependents: 0
Suggesters: 0
Security: 0
Stars: 82
Watchers: 8
Forks: 12
Open Issues: 2
Requires
- php: ^8.1
- laravel/framework: ^12.0
- laravel/prompts: ^0.3.6
- pestphp/pest: ^v4.0.2
- pestphp/pest-plugin-livewire: ^v4.0.1
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- filament/filament: ^4.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^v8.8.2
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- rector/rector: ^1.2
- 4.x-dev
- 3.x-dev
- dev-add-description-tests
- dev-add-individually-searchable-test
- dev-has-the-correct-state-test
- dev-fix-gloabally-deferred-confirmation
- dev-add-can-paginate-records-test
- dev-add-test-cannot-render-trashed-by-default
- dev-use-get-key-instead-of-id
- dev-add-deferred-loading-to-exisitng-tests
- dev-can-delete-record-test
- dev-support-enums
- dev-add-more-index-tests
- dev-add-run-pint-after
- dev-discovery
- dev-tests-setup
This package is auto-updated.
Last update: 2025-09-07 18:10:37 UTC
README
A package that creates PEST tests specifically tailored for your Filament components.
Caution
This package is not ready yet, use it at your own risk. ⚠️
Installation
composer require codewithdennis/filament-tests --dev
Usage
Run the command to generate tests for your Filament resources:
php artisan make:filament-test
Command Options
The make:filament-test
command supports the following options:
--skip-pint
: Skip running Laravel Pint on generated test files--force
: Overwrite existing test files without confirmation
Available Tests
This package generates comprehensive PEST tests for your Filament resources. Here's a complete list of currently working tests:
Page Rendering Tests
- CanRenderCreatePageTest - Tests that the create page renders correctly
- CanRenderEditPageTest - Tests that the edit page renders correctly
- CanRenderIndexPageTest - Tests that the index page renders correctly
- CanRenderViewPageTest - Tests that the view page renders correctly
Table Column Tests
- HasColumnTest - Tests that the resource has table columns defined
- CanRenderColumnTest - Tests that default visible columns render correctly
- CanNotRenderColumnTest - Tests that default hidden columns don't render
- ShowsColumnTest - Tests that explicitly visible columns are shown
- HidesColumnTest - Tests that explicitly hidden columns are hidden
- CanNotDisplayTrashedRecordsByDefault - Tests that trashed records are not displayed by default if soft deletes are enabled
- ColumnHasDescriptionBelowTest - Tests that columns with descriptions display them below
- ColumnHasDescriptionAboveTest - Tests that columns with descriptions display them above
Table Functionality Tests
- CanSearchColumnTest - Tests that searchable columns work correctly
- CanSearchColumnIndividuallyTest - Tests that individual column search works correctly
- CanSortColumnTest - Tests that sortable columns work correctly
- CanPaginateRecordsTest - Tests that pagination works correctly
Setup Tests
- BeforeEach - Sets up common test configuration and data
All tests are automatically generated based on your Filament resource configuration and will only run when the relevant features are present in your resource (e.g., search tests only run if you have searchable columns).
Known Issues
- Delete Action Visibility: We cannot check if the delete action is visible to users, but we can only verify that it exists in the application.
Credits
License
The MIT License (MIT). Please see License File for more information.