How to test a Table header action on a Relationship Manager?

I have the following test:
/** @test */
public function can_assign_users_to_job_on_view_page()
{
    $admin = User::factory()->create();
    $job = Job::factory()->create();
    $employee = User::factory()->create();

    Livewire::actingAs($admin)
        ->test(UsersRelationManager::class, ['ownerRecord' => $job])
        ->assertSuccessful()
        ->callPageAction(AttachAction::class, [
            'recordId' => $employee->id,
            'task' => Job::EXCAVATE,
        ]);

    $this->assertDatabaseHas('job_user', [
        'job_id' => $job->id,
        'user_id' => $employee->id,
        'task' => Job::EXCAVATE,
    ]);
}


I don't think callPageAction is correct since if I use it, I get the following error: UsersRelationManager::getCachedAction does not exist.

If I use callTableAction I get the following error: RelationManager::getTableRecord(): Argument #1 ($key) must be of type ?string, array given,

Which makes sense, but what should I use?
Was this page helpful?