A small trick. I wanted to use my DOM assertions package to test a livewire form today. It has an `->assertFormExists()` method. Now the problem arose as I am using filament in the same project. Filament has a method by the same name, registered as a macro on the livewire testable. So their method would always be called.
So to get around this I simply added a small macro wrapper in Pest.php
TestResponse::macro('assertFormElementExists', function (...$params) {
return $this->assertFormExists(...$params);
});
I was then able to call the new method on my livewire component
Livewire::test(Access::class, ['access' => $this->access])
->assertFormElementExists('form', function (AssertForm $form) {
$form->hasCSRF();
$form->has('wire:submit.prevent');
});