© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•12mo ago•
5 replies
Laurens

Testing relation manager actions

I am trying to test the actions of relation managers to get 100% code coverage across an internal project we have. However, the furthest I can get are exception that the create actions is not being rendered/present on the livewire component.

I am seeing the create action while logged into the panel.

This is a trimmed down WIP of an example test I have with some specific business logic from the app trimmed out.

it('can create project assets', function () {
    $this->actingAs($user = $this->createTeamUser()->fresh());

    // Create dummy owner record
    $ownerRecord = Project::factory()->create();

    // Prepare dummy data
    $data = Asset::factory()->make();

    livewire(ProjectResource\RelationManagers\AssetsRelationManager::class, [
        'pageClass' => ProjectResource\Pages\EditProject::class,
        'ownerRecord' => $ownerRecord,
    ])
        ->callAction(CreateAction::class, $data->only(['name', 'url']))
        ->assertSuccessful();

    // Verify the record exists
    $this->assertDatabaseHas(Asset::class, $data->only(['name', 'url']));
})->skip('cannot assert on relation manager');
it('can create project assets', function () {
    $this->actingAs($user = $this->createTeamUser()->fresh());

    // Create dummy owner record
    $ownerRecord = Project::factory()->create();

    // Prepare dummy data
    $data = Asset::factory()->make();

    livewire(ProjectResource\RelationManagers\AssetsRelationManager::class, [
        'pageClass' => ProjectResource\Pages\EditProject::class,
        'ownerRecord' => $ownerRecord,
    ])
        ->callAction(CreateAction::class, $data->only(['name', 'url']))
        ->assertSuccessful();

    // Verify the record exists
    $this->assertDatabaseHas(Asset::class, $data->only(['name', 'url']));
})->skip('cannot assert on relation manager');


This is happening for me in an Laravel 11 project with Filament v3.3.x.

Is there any way to test actions for relation managers?

Thanks in advance!
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Customizing relation manager actions
FilamentFFilament / ❓┊help
3y ago
Testing Filament Relation Manager
FilamentFFilament / ❓┊help
2y ago
Testing pagination on relation manager
FilamentFFilament / ❓┊help
13mo ago
Actions not appearing in Relation Manager
FilamentFFilament / ❓┊help
3y ago