Testing Table Action with modal

My action code is
public function removeAction(): Action
{
    ray('running remove action');

    return Action::make('removeAction')
        ->label('Remove')
        ->icon('heroicon-o-x-circle')
        ->color('danger')
        ->modalHeading(fn($record) => 'Remove ' . $record->user->name)
        ->modalDescription(fn($record) => 'Are you sure you want to de-associate this property manager?')
        ->action(function ($record) {
            ray($record);
            return $record->update(['property_management_company_id' => null]);
        })
        ->successNotificationTitle('Property manager has been de-associated.')
        ->visible($this->propertyManagementCompany !== null)
        ->after(fn() => $this->emitTo(ViewPropertyManagementCompany::class, '$refresh'));
}
with my test being
it('disassociate property manager with property management company', function () {
    /* @phpstan-ignore-next-line */
    $user = login();
    /* @phpstan-ignore-next-line */
    $this->withSession(['tenant' => $user->tenant]);

    $propertyManagementCompany = PropertyManagementCompany::factory()->create();
    $propertyManager = PropertyManager::factory()->create([
        'property_management_company_id' => $propertyManagementCompany->id,
    ]);

    /* @phpstan-ignore-next-line */
    $this->get('/property-managers/companies/' . $propertyManagementCompany->id);

    Livewire::test(PropertyManagersTable::class, ['propertyManagementCompany' => $propertyManagementCompany])
        ->assertTableActionExists('removeAction')
        ->callTableAction('removeAction', record: $propertyManager)
        ->assertHasNoErrors();

    expect($propertyManager->fresh()->property_management_company_id)->toBeNull();
});
, while it runs the action method, it never seems to get to the removeAction method, it never gets to the ->action() within it. Only my tests are failing. Its working great in the actual browser. Im assuming i need to call something else?
Was this page helpful?