Skip to content

Conversation

@babeuloula
Copy link

Problem

When testing a wizard using the testStep macro, it is currently not possible to pass additional parameters to the mount method of the main Wizard component.

This limitation makes it difficult to properly test wizards that rely on:

  • contextual data (e.g. a model, an ID, or a configuration array),
  • dynamic initialization logic in the Wizard’s mount method.

Proposed solution

This PR updates the testStep macro to accept additional parameters, which are then forwarded to the mount method of the main Wizard component.

This allows tests to more closely match real usage of the Wizard, where the component is often mounted with one or more arguments.

Example

Livewire::testStep(MyWizard::class, 'first-step', [
    'user' => $user,
    'mode' => 'edit',
]);

These parameters will now be passed to:

public function mount(User $user, string $mode)

Benefits

  • Enables testing of wizards that depend on external or contextual data
  • Improves parity between test setup and real application behavior
  • Keeps backward compatibility (existing tests without parameters are unaffected)

@babeuloula babeuloula changed the title feat: add extra params to wizard feat: add extra params to wizard testStep method Dec 18, 2025
@babeuloula
Copy link
Author

@freekmurze The failures are not from my PR. I don't know why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant