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 tocallInfolistAction():
data parameter:
setInfolistActionData():
Execution
To check if an action has been halted, you can useassertInfolistActionHalted():
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:
assertInfolistActionDataSet() method:
Action state
To ensure that an action exists or doesn’t in an infolist, you can use theassertInfolistActionExists() or assertInfolistActionDoesNotExist() method:
assertInfolistActionHidden() or assertInfolistActionVisible() methods:
assertInfolistActionEnabled() or assertInfolistActionDisabled() methods:
assertInfolistActionHidden() method:
Button appearance
To ensure an action has the correct label, you can useassertInfolistActionHasLabel() and assertInfolistActionDoesNotHaveLabel():
assertInfolistActionHasIcon() or assertInfolistActionDoesNotHaveIcon():
assertInfolistActionHasColor() or assertInfolistActionDoesNotHaveColor():
URL
To ensure an action has the correct URL, you can useassertInfolistActionHasUrl(), assertInfolistActionDoesNotHaveUrl(), assertInfolistActionShouldOpenUrlInNewTab(), and assertInfolistActionShouldNotOpenUrlInNewTab():