Leonardy
How test resource flag --simple
I have a resource EquipmentOwnersResource that was created using the command sail artisan make:filament-resource EquipmentOwner --simple. This generates a single page for the resource instead of the typical 3 and puts the create/edit form in a modal instead of loading a new page.
I've create a Pest test as follows:
it('can create equipment owners', function () {
$equipmentOwner = EquipmentOwner::factory()->make();
livewire(ManageEquipmentOwners::class) ->set('name', $equipmentOwner->name) ->call('save') ->assertHasNoFormErrors(); }); However, when running the test I get an error "Unable to call component method. Public method [save] not found on component." I know this is because I'm not using the standard create/edit pages, but the Filament docs don't have an example of testing these "simple" resources.
$equipmentOwner = EquipmentOwner::factory()->make();
livewire(ManageEquipmentOwners::class) ->set('name', $equipmentOwner->name) ->call('save') ->assertHasNoFormErrors(); }); However, when running the test I get an error "Unable to call component method. Public method [save] not found on component." I know this is because I'm not using the standard create/edit pages, but the Filament docs don't have an example of testing these "simple" resources.
4 replies
How do I test the Managing relationships form
livewire(ConsignanteResource\Pages\ManageUsuariosConsignante::class, [
'record' => $consignante->id,
])->fillForm([
'title' => fake()->sentence(),
// ...
])->call('create')
->assertHasNoFormErrors();
I'm getting this error
TypeError: App\Filament\Resources\ConsignanteResource\Pages\ManageUsuariosConsignante::form(): Argument #1 ($form) must be of type Filament\Forms\Form, Filament\Infolists\Infolist given, called in /Users/leonardy/Herd/consig/vendor/filament/infolists/src/Concerns/InteractsWithInfolists.php on line 56
3 replies
Action Import
I'm using action import to insert data into my model, as it is sent to the queue, I would like to add a loading to the table. You would need to change the status of the model when you send it to the queue and then when it completes or fails. What would be the best way to do this?
https://filamentphp.com/docs/3.x/actions/prebuilt-actions/import
2 replies