Wizard does not progress through the steps as expected when testing in Pest
Package
filament/filament
Package Version
v3.2.115
Laravel Version
v11.25.0
Livewire Version
v3.5.6
PHP Version
PHP 8.3.11
Problem description
I created a test using Pest. A call to assertWizardCurrentStep(3) during the Pest Feature test causes the test to fail. From what I can tell, the fillForm() call is resetting the wizard back to Step 1 each time. The only way to get around this seems to be to make multiple calls to goToNextWizardStep() for all steps after step 1.
Expected behavior
I expected the first test to pass with one goToNextWizardStep() per step, but it fails
I expected the second test to fail with multiple goToNextWizardStep() calls on steps 2 and 3, but it passes
Steps to reproduce
- Clone the repo https://github.com/joseph-d/filamentIssue20240930
- Run
composer install - Run
php artisan test
The tests are located in tests/Feature/WizardTest.php
The 1st test will fail and the 2nd test will pass. The only difference between the two tests is that the 2nd test has multiple consecutive calls to goToNextWizardStep(). The number of calls increases incrementally throughout the test to get it back to the correct step. I'm assuming that this is a bug as the docs do not mention multiple calls being needed.
Reproduction repository (issue will be closed if this is not valid)
https://github.com/joseph-d/filamentIssue20240930
Relevant log output
FAIL Tests\Feature\WizardTest
⨯ it advances through the wizard with one goToNextWizardStep() call per step 0.39s
✓ it advances through the wizard with extra goToNextWizardStep() calls on steps 2 and 3 0.43s
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
FAILED Tests\Feature\WizardTest > it advances through the wizard with one `goToNextWizardStep()` call per step
Failed asserting that wizard is on step 3, current step is 2.
Failed asserting that 2 matches expected 3.
Donate 💰 to fund this issue
- You can donate funding to this issue. We receive the money once the issue is completed & confirmed by you.
- 100% of the funding will be distributed between the Filament core team to run all aspects of the project.
- Thank you in advance for helping us make maintenance sustainable!