Skip to main content
You are currently viewing the documentation for Filament 3.x, which is a previous version of Filament.Looking for the current stable version? Visit the 5.x documentation.

Overview

All examples in this guide will be written using Pest. To use Pest’s Livewire plugin for testing, you can follow the installation instructions in the Pest documentation on plugins: Livewire plugin for Pest. However, you can easily adapt this to PHPUnit. Since the Infolist Builder works on Livewire components, you can use the Livewire testing helpers. However, we have custom testing helpers that you can use with infolists:

Actions

You can call an action by passing its infolist component key, and then the name of the action to callInfolistAction():
To pass an array of data into an action, use the data parameter:
If you ever need to only set an action’s data without immediately calling it, you can use setInfolistActionData():

Execution

To check if an action has been halted, you can use assertInfolistActionHalted():

Errors

assertHasNoInfolistActionErrors() is used to assert that no validation errors occurred when submitting the action form. To check if a validation error has occurred with the data, use assertHasInfolistActionErrors(), similar to assertHasErrors() in Livewire:
To check if an action is pre-filled with data, you can use the assertInfolistActionDataSet() method:

Action state

To ensure that an action exists or doesn’t in an infolist, you can use the assertInfolistActionExists() or assertInfolistActionDoesNotExist() method:
To ensure an action is hidden or visible for a user, you can use the assertInfolistActionHidden() or assertInfolistActionVisible() methods:
To ensure an action is enabled or disabled for a user, you can use the assertInfolistActionEnabled() or assertInfolistActionDisabled() methods:
To check if an action is hidden to a user, you can use the assertInfolistActionHidden() method:

Button appearance

To ensure an action has the correct label, you can use assertInfolistActionHasLabel() and assertInfolistActionDoesNotHaveLabel():
To ensure an action’s button is showing the correct icon, you can use assertInfolistActionHasIcon() or assertInfolistActionDoesNotHaveIcon():
To ensure that an action’s button is displaying the right color, you can use assertInfolistActionHasColor() or assertInfolistActionDoesNotHaveColor():

URL

To ensure an action has the correct URL, you can use assertInfolistActionHasUrl(), assertInfolistActionDoesNotHaveUrl(), assertInfolistActionShouldOpenUrlInNewTab(), and assertInfolistActionShouldNotOpenUrlInNewTab():