Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wizard does not progress through the steps as expected when testing in Pest #14397

Open
joseph-d opened this issue Sep 30, 2024 · 0 comments
Open
Labels

Comments

@joseph-d
Copy link
Contributor

joseph-d commented Sep 30, 2024

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

  1. Clone the repo https://github.com/joseph-d/filamentIssue20240930
  2. Run composer install
  3. 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!
Fund with Polar
@joseph-d joseph-d added bug Something isn't working medium priority unconfirmed labels Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Todo
Development

No branches or pull requests

1 participant