<?php

use App\Livewire\BulkOperationProgress;
use Filament\Facades\Filament;
use Livewire\Livewire;

it('renders the progress widget poller script', function () {
    $this->get('/admin/login')
        ->assertSuccessful()
        ->assertSee('js/tenantpilot/ops-ux-progress-widget-poller.js', escape: false);

    [$user, $tenant] = createUserWithTenant(role: 'owner');
    $this->actingAs($user);

    Filament::setTenant($tenant, true);

    Livewire::test(BulkOperationProgress::class)
        ->assertSee('opsUxProgressWidgetPoller()')
        ->assertDontSee('window.opsUxProgressWidgetPoller');
})->group('ops-ux');
