"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("@testing-library/react");
const user_event_1 = __importDefault(require("@testing-library/user-event"));
require("@testing-library/jest-dom");
const AgentProfiles_1 = require("../AgentProfiles");
const BFUIProvider_1 = require("../../../core/BFUIProvider");
const AgentProfilesProvider_1 = require("../AgentProfilesProvider");
// Mock WebSocket for real-time updates
global.WebSocket = jest.fn().mockImplementation(() => ({
    addEventListener: jest.fn(),
    removeEventListener: jest.fn(),
    send: jest.fn(),
    close: jest.fn(),
    readyState: 1
}));
// Mock the API service
jest.mock('../../../services/api', () => ({
    agentProfilesApi: {
        getAgentProfiles: jest.fn(),
        createAgentProfile: jest.fn(),
        updateAgentProfile: jest.fn(),
        deleteAgentProfile: jest.fn(),
        cloneAgentProfile: jest.fn(),
        deployAgent: jest.fn(),
        pauseAgent: jest.fn(),
        resumeAgent: jest.fn(),
        getAgentMetrics: jest.fn(),
        getAgentLogs: jest.fn(),
        getAgentConversations: jest.fn(),
        validateAgentConfig: jest.fn(),
        exportAgentProfile: jest.fn(),
        importAgentProfile: jest.fn(),
        getAgentTemplates: jest.fn(),
        testAgent: jest.fn(),
        getAgentHealth: jest.fn(),
        subscribeToAgentEvents: jest.fn(),
    }
}));
const mockApi = require('../../../services/api').agentProfilesApi;
const TestWrapper = ({ children }) => ((0, jsx_runtime_1.jsx)(BFUIProvider_1.BFUIProvider, { children: (0, jsx_runtime_1.jsx)(AgentProfilesProvider_1.AgentProfilesProvider, { children: children }) }));
describe('AgentProfiles Component - Comprehensive Tests', () => {
    beforeEach(() => {
        jest.clearAllMocks();
    });
    /**
     * Test Suite 1: Advanced Rendering and Real-time Updates
     */
    describe('Advanced Rendering & Real-time Updates', () => {
        it('should render with sophisticated layout and real-time agent status', async () => {
            const mockAgents = [
                {
                    id: 'agent-1',
                    name: 'Code Assistant',
                    type: 'coding',
                    status: 'active',
                    health: 98,
                    conversations: 145,
                    success_rate: 94.2,
                    avg_response_time: 1.2,
                    tools: ['github', 'jira', 'slack'],
                    capabilities: ['code_review', 'bug_fixing', 'documentation'],
                    model: 'gpt-4-turbo',
                    created_at: '2024-01-15T10:30:00Z',
                    last_active: '2024-01-16T14:22:00Z',
                    configuration: {
                        temperature: 0.7,
                        max_tokens: 4000,
                        system_prompt: 'You are an expert code assistant...',
                        tools_config: {
                            github: { token: '***', repos: ['org/repo1'] },
                            jira: { url: 'https://company.atlassian.net' }
                        }
                    },
                    metrics: {
                        total_conversations: 1250,
                        avg_satisfaction: 4.7,
                        cost_per_conversation: 0.15,
                        uptime_percentage: 99.2
                    }
                },
                {
                    id: 'agent-2',
                    name: 'Customer Support',
                    type: 'support',
                    status: 'paused',
                    health: 85,
                    conversations: 89,
                    success_rate: 91.5,
                    avg_response_time: 0.8,
                    tools: ['zendesk', 'salesforce'],
                    capabilities: ['ticket_resolution', 'escalation', 'sentiment_analysis'],
                    model: 'claude-3-sonnet',
                    created_at: '2024-01-10T08:15:00Z',
                    last_active: '2024-01-15T16:45:00Z'
                }
            ];
            mockApi.getAgentProfiles.mockResolvedValue({ agents: mockAgents });
            (0, react_1.render)((0, jsx_runtime_1.jsx)(AgentProfiles_1.AgentProfiles, {}), { wrapper: TestWrapper });
            await (0, react_1.waitFor)(() => {
                expect(react_1.screen.getByTestId('agent-profiles-dashboard')).toBeInTheDocument();
            });
            // Check for sophisticated layout elements
            expect(react_1.screen.getByTestId('agent-profiles-header')).toBeInTheDocument();
            expect(react_1.screen.getByTestId('agent-profiles-filters')).toBeInTheDocument();
            expect(react_1.screen.getByTestId('agent-profiles-grid')).toBeInTheDocument();
            expect(react_1.screen.getByTestId('agent-profiles-sidebar')).toBeInTheDocument();
            // Check for real-time status indicators
            expect(react_1.screen.getByText('Code Assistant')).toBeInTheDocument();
            expect(react_1.screen.getByText('Customer Support')).toBeInTheDocument();
            expect(react_1.screen.getByTestId('agent-status-active')).toBeInTheDocument();
            expect(react_1.screen.getByTestId('agent-status-paused')).toBeInTheDocument();
            // Check for health indicators
            expect(react_1.screen.getByText('98%')).toBeInTheDocument(); // Health score
            expect(react_1.screen.getByText('85%')).toBeInTheDocument();
        });
        it('should display real-time agent metrics with auto-refresh', async () => {
            mockApi.getAgentProfiles.mockResolvedValue({ agents: [] });
            mockApi.getAgentMetrics.mockResolvedValue({
                total_agents: 15,
                active_agents: 12,
                paused_agents: 2,
                failed_agents: 1,
                total_conversations: 5240,
                avg_response_time: 1.1,
                total_cost: 124.50,
                success_rate: 93.8
            });
            (0, react_1.render)((0, jsx_runtime_1.jsx)(AgentProfiles_1.AgentProfiles, { showMetrics: true, autoRefresh: true }), { wrapper: TestWrapper });
            await (0, react_1.waitFor)(() => {
                expect(react_1.screen.getByTestId('agent-metrics-panel')).toBeInTheDocument();
            });
            // Check for comprehensive metrics
            expect(react_1.screen.getByText('15')).toBeInTheDocument(); // Total agents
            expect(react_1.screen.getByText('12')).toBeInTheDocument(); // Active agents
            expect(react_1.screen.getByText('5,240')).toBeInTheDocument(); // Total conversations
            expect(react_1.screen.getByText('93.8%')).toBeInTheDocument(); // Success rate
            expect(react_1.screen.getByText('$124.50')).toBeInTheDocument(); // Total cost
        });
        it('should handle WebSocket real-time updates', async () => {
            const mockWebSocket = {
                addEventListener: jest.fn(),
                removeEventListener: jest.fn(),
                send: jest.fn(),
                close: jest.fn(),
                readyState: 1
            };
            global.WebSocket = jest.fn(() => mockWebSocket);
            (0, react_1.render)((0, jsx_runtime_1.jsx)(AgentProfiles_1.AgentProfiles, { realTimeUpdates: true }), { wrapper: TestWrapper });
            // Verify WebSocket connection
            expect(global.WebSocket).toHaveBeenCalledWith(expect.stringContaining('ws://localhost:3000/agent-updates'));
            expect(mockWebSocket.addEventListener).toHaveBeenCalledWith('message', expect.any(Function));
        });
    });
    /**
     * Test Suite 2: Advanced Agent Management Operations
     */
    describe('Advanced Agent Management', () => {
        it('should support bulk operations on multiple agents', async () => {
            const mockAgents = [
                { id: 'agent-1', name: 'Agent 1', status: 'active' },
                { id: 'agent-2', name: 'Agent 2', status: 'paused' },
                { id: 'agent-3', name: 'Agent 3', status: 'active' }
            ];
            mockApi.getAgentProfiles.mockResolvedValue({ agents: mockAgents });
            (0, react_1.render)((0, jsx_runtime_1.jsx)(AgentProfiles_1.AgentProfiles, { enableBulkOperations: true }), { wrapper: TestWrapper });
            await (0, react_1.waitFor)(() => {
                expect(react_1.screen.getByTestId('agent-profiles-grid')).toBeInTheDocument();
            });
            // Select multiple agents
            react_1.fireEvent.click(react_1.screen.getByTestId('agent-checkbox-agent-1'));
            react_1.fireEvent.click(react_1.screen.getByTestId('agent-checkbox-agent-2'));
            // Check bulk operations toolbar appears
            expect(react_1.screen.getByTestId('bulk-operations-toolbar')).toBeInTheDocument();
            expect(react_1.screen.getByText('2 agents selected')).toBeInTheDocument();
            // Test bulk pause operation
            react_1.fireEvent.click(react_1.screen.getByRole('button', { name: /Bulk Pause/i }));
            await (0, react_1.waitFor)(() => {
                expect(react_1.screen.getByTestId('bulk-confirm-dialog')).toBeInTheDocument();
            });
            react_1.fireEvent.click(react_1.screen.getByRole('button', { name: /Confirm/i }));
            expect(mockApi.pauseAgent).toHaveBeenCalledTimes(2);
        });
        it('should provide agent configuration wizard with smart recommendations', async () => {
            mockApi.getAgentTemplates.mockResolvedValue({
                templates: [
                    { id: 'coding', name: 'Code Assistant', description: 'AI coding helper' },
                    { id: 'support', name: 'Customer Support', description: 'Customer service agent' }
                ]
            });
            (0, react_1.render)((0, jsx_runtime_1.jsx)(AgentProfiles_1.AgentProfiles, {}), { wrapper: TestWrapper });
            react_1.fireEvent.click(react_1.screen.getByRole('button', { name: /Create Agent/i }));
            await (0, react_1.waitFor)(() => {
                expect(react_1.screen.getByTestId('agent-wizard-modal')).toBeInTheDocument();
            });
            // Step 1: Template selection
            expect(react_1.screen.getByText('Choose Agent Template')).toBeInTheDocument();
            react_1.fireEvent.click(react_1.screen.getByTestId('template-coding'));
            // Step 2: Basic configuration with smart defaults
            react_1.fireEvent.click(react_1.screen.getByRole('button', { name: /Next/i }));
            expect(react_1.screen.getByText('Configure Agent')).toBeInTheDocument();
            expect(react_1.screen.getByDisplayValue('Code Assistant')).toBeInTheDocument(); // Smart default name
            // Step 3: Advanced settings with AI recommendations
            react_1.fireEvent.click(react_1.screen.getByRole('button', { name: /Next/i }));
            expect(react_1.screen.getByText('Advanced Settings')).toBeInTheDocument();
            expect(react_1.screen.getByTestId('ai-recommendations-panel')).toBeInTheDocument();
        });
        it('should support agent cloning with configuration inheritance', async () => {
            const sourceAgent = {
                id: 'agent-1',
                name: 'Original Agent',
                configuration: { temperature: 0.8, tools: ['github'] }
            };
            mockApi.cloneAgentProfile.mockResolvedValue({
                agent: { ...sourceAgent, id: 'agent-2', name: 'Original Agent (Copy)' }
            });
            (0, react_1.render)((0, jsx_runtime_1.jsx)(AgentProfiles_1.AgentProfiles, {}), { wrapper: TestWrapper });
            // Assuming agent card is rendered with clone button
            react_1.fireEvent.click(react_1.screen.getByTestId('agent-actions-agent-1'));
            react_1.fireEvent.click(react_1.screen.getByText(/Clone Agent/i));
            await (0, react_1.waitFor)(() => {
                expect(react_1.screen.getByTestId('clone-agent-dialog')).toBeInTheDocument();
            });
            react_1.fireEvent.change(react_1.screen.getByLabelText(/New Agent Name/i), {
                target: { value: 'Cloned Assistant' }
            });
            react_1.fireEvent.click(react_1.screen.getByRole('button', { name: /Clone/i }));
            expect(mockApi.cloneAgentProfile).toHaveBeenCalledWith('agent-1', {
                name: 'Cloned Assistant',
                inherit_configuration: true
            });
        });
    });
    /**
     * Test Suite 3: Advanced Filtering and Search
     */
    describe('Advanced Filtering & Search', () => {
        it('should support complex multi-field filtering', async () => {
            const mockAgents = [
                { id: '1', name: 'Agent 1', type: 'coding', status: 'active', model: 'gpt-4' },
                { id: '2', name: 'Agent 2', type: 'support', status: 'paused', model: 'claude-3' },
                { id: '3', name: 'Agent 3', type: 'coding', status: 'active', model: 'gpt-4' }
            ];
            mockApi.getAgentProfiles.mockResolvedValue({ agents: mockAgents });
            (0, react_1.render)((0, jsx_runtime_1.jsx)(AgentProfiles_1.AgentProfiles, { enableAdvancedFiltering: true }), { wrapper: TestWrapper });
            await (0, react_1.waitFor)(() => {
                expect(react_1.screen.getByTestId('advanced-filters-panel')).toBeInTheDocument();
            });
            // Test multiple filter combinations
            react_1.fireEvent.click(react_1.screen.getByTestId('filter-type-coding'));
            react_1.fireEvent.click(react_1.screen.getByTestId('filter-status-active'));
            react_1.fireEvent.click(react_1.screen.getByTestId('filter-model-gpt-4'));
            await (0, react_1.waitFor)(() => {
                // Should show only agents matching all filters
                expect(react_1.screen.getByText('2 agents found')).toBeInTheDocument();
            });
        });
        it('should provide semantic search with AI-powered suggestions', async () => {
            mockApi.getAgentProfiles.mockResolvedValue({ agents: [] });
            (0, react_1.render)((0, jsx_runtime_1.jsx)(AgentProfiles_1.AgentProfiles, { enableSemanticSearch: true }), { wrapper: TestWrapper });
            const searchInput = react_1.screen.getByPlaceholderText(/Search agents.../i);
            await user_event_1.default.type(searchInput, 'code review assistant');
            await (0, react_1.waitFor)(() => {
                expect(react_1.screen.getByTestId('search-suggestions')).toBeInTheDocument();
            });
            // Check for AI-powered suggestions
            expect(react_1.screen.getByText('Code Assistant')).toBeInTheDocument();
            expect(react_1.screen.getByText('GitHub Integration Agent')).toBeInTheDocument();
            expect(react_1.screen.getByText('Pull Request Reviewer')).toBeInTheDocument();
        });
        it('should support saved filters and quick access', async () => {
            (0, react_1.render)((0, jsx_runtime_1.jsx)(AgentProfiles_1.AgentProfiles, { enableSavedFilters: true }), { wrapper: TestWrapper });
            // Create a filter
            react_1.fireEvent.click(react_1.screen.getByTestId('filter-status-active'));
            react_1.fireEvent.click(react_1.screen.getByTestId('filter-type-coding'));
            // Save the filter
            react_1.fireEvent.click(react_1.screen.getByRole('button', { name: /Save Filter/i }));
            await (0, react_1.waitFor)(() => {
                expect(react_1.screen.getByTestId('save-filter-dialog')).toBeInTheDocument();
            });
            react_1.fireEvent.change(react_1.screen.getByLabelText(/Filter Name/i), {
                target: { value: 'Active Coding Agents' }
            });
            react_1.fireEvent.click(react_1.screen.getByRole('button', { name: /Save/i }));
            // Check saved filter appears in quick access
            expect(react_1.screen.getByTestId('saved-filters-menu')).toBeInTheDocument();
            expect(react_1.screen.getByText('Active Coding Agents')).toBeInTheDocument();
        });
    });
    /**
     * Test Suite 4: Real-time Monitoring and Analytics
     */
    describe('Real-time Monitoring & Analytics', () => {
        it('should display live agent performance metrics', async () => {
            const mockMetrics = {
                agent_id: 'agent-1',
                live_metrics: {
                    current_conversations: 5,
                    queue_length: 2,
                    avg_response_time_60s: 1.1,
                    success_rate_60s: 95.5,
                    cpu_usage: 45,
                    memory_usage: 512,
                    tokens_consumed_60s: 15240
                }
            };
            mockApi.getAgentMetrics.mockResolvedValue(mockMetrics);
            (0, react_1.render)((0, jsx_runtime_1.jsx)(AgentProfiles_1.AgentProfiles, { showLiveMetrics: true }), { wrapper: TestWrapper });
            await (0, react_1.waitFor)(() => {
                expect(react_1.screen.getByTestId('live-metrics-panel')).toBeInTheDocument();
            });
            // Check for real-time metrics display
            expect(react_1.screen.getByText('5')).toBeInTheDocument(); // Current conversations
            expect(react_1.screen.getByText('2')).toBeInTheDocument(); // Queue length
            expect(react_1.screen.getByText('1.1s')).toBeInTheDocument(); // Response time
            expect(react_1.screen.getByText('95.5%')).toBeInTheDocument(); // Success rate
            expect(react_1.screen.getByText('45%')).toBeInTheDocument(); // CPU usage
        });
        it('should provide agent conversation insights with sentiment analysis', async () => {
            const mockConversations = [
                {
                    id: 'conv-1',
                    timestamp: '2024-01-16T14:30:00Z',
                    user: 'john.doe',
                    message: 'Help me fix this bug',
                    agent_response: 'I can help you debug this issue...',
                    sentiment: 'neutral',
                    satisfaction: 4,
                    duration: 300,
                    tokens_used: 150
                }
            ];
            mockApi.getAgentConversations.mockResolvedValue({ conversations: mockConversations });
            (0, react_1.render)((0, jsx_runtime_1.jsx)(AgentProfiles_1.AgentProfiles, { showConversationInsights: true }), { wrapper: TestWrapper });
            react_1.fireEvent.click(react_1.screen.getByTestId('agent-card-agent-1'));
            react_1.fireEvent.click(react_1.screen.getByText(/View Conversations/i));
            await (0, react_1.waitFor)(() => {
                expect(react_1.screen.getByTestId('conversation-insights-modal')).toBeInTheDocument();
            });
            // Check for conversation analytics
            expect(react_1.screen.getByText('Sentiment Analysis')).toBeInTheDocument();
            expect(react_1.screen.getByText('4.0/5.0')).toBeInTheDocument(); // Satisfaction
            expect(react_1.screen.getByText('5m 0s')).toBeInTheDocument(); // Duration
        });
        it('should display agent health monitoring with predictive alerts', async () => {
            const mockHealth = {
                agent_id: 'agent-1',
                overall_health: 85,
                health_checks: {
                    response_time: { status: 'warning', value: 2.1, threshold: 2.0 },
                    error_rate: { status: 'healthy', value: 1.2, threshold: 5.0 },
                    memory_usage: { status: 'critical', value: 90, threshold: 80 },
                    uptime: { status: 'healthy', value: 99.5, threshold: 95.0 }
                },
                predictions: {
                    performance_trend: 'declining',
                    estimated_failure_time: '2024-01-17T10:00:00Z',
                    recommended_actions: ['Increase memory allocation', 'Restart agent']
                }
            };
            mockApi.getAgentHealth.mockResolvedValue(mockHealth);
            (0, react_1.render)((0, jsx_runtime_1.jsx)(AgentProfiles_1.AgentProfiles, { showHealthMonitoring: true }), { wrapper: TestWrapper });
            react_1.fireEvent.click(react_1.screen.getByTestId('agent-health-agent-1'));
            await (0, react_1.waitFor)(() => {
                expect(react_1.screen.getByTestId('health-monitoring-panel')).toBeInTheDocument();
            });
            // Check health indicators
            expect(react_1.screen.getByText('85%')).toBeInTheDocument(); // Overall health
            expect(react_1.screen.getByTestId('health-warning-response-time')).toBeInTheDocument();
            expect(react_1.screen.getByTestId('health-critical-memory')).toBeInTheDocument();
            // Check predictive alerts
            expect(react_1.screen.getByText('Performance Declining')).toBeInTheDocument();
            expect(react_1.screen.getByText('Increase memory allocation')).toBeInTheDocument();
        });
    });
    /**
     * Test Suite 5: Advanced Configuration and Testing
     */
    describe('Advanced Configuration & Testing', () => {
        it('should provide agent testing playground with live interaction', async () => {
            mockApi.testAgent.mockResolvedValue({
                response: 'Hello! I can help you with coding tasks.',
                metrics: { response_time: 1.2, tokens_used: 25, confidence: 0.95 }
            });
            (0, react_1.render)((0, jsx_runtime_1.jsx)(AgentProfiles_1.AgentProfiles, { enableAgentTesting: true }), { wrapper: TestWrapper });
            react_1.fireEvent.click(react_1.screen.getByTestId('agent-actions-agent-1'));
            react_1.fireEvent.click(react_1.screen.getByText(/Test Agent/i));
            await (0, react_1.waitFor)(() => {
                expect(react_1.screen.getByTestId('agent-testing-playground')).toBeInTheDocument();
            });
            // Test live interaction
            const testInput = react_1.screen.getByPlaceholderText(/Enter test message.../i);
            await user_event_1.default.type(testInput, 'Hello, can you help me?');
            react_1.fireEvent.click(react_1.screen.getByRole('button', { name: /Send/i }));
            await (0, react_1.waitFor)(() => {
                expect(react_1.screen.getByText('Hello! I can help you with coding tasks.')).toBeInTheDocument();
            });
            // Check for testing metrics
            expect(react_1.screen.getByText('1.2s')).toBeInTheDocument(); // Response time
            expect(react_1.screen.getByText('25')).toBeInTheDocument(); // Tokens used
            expect(react_1.screen.getByText('95%')).toBeInTheDocument(); // Confidence
        });
        it('should validate agent configuration with real-time feedback', async () => {
            mockApi.validateAgentConfig.mockResolvedValue({
                valid: false,
                errors: [
                    { field: 'temperature', message: 'Temperature must be between 0 and 1' },
                    { field: 'tools.github.token', message: 'Invalid GitHub token format' }
                ],
                warnings: [
                    { field: 'max_tokens', message: 'High token limit may increase costs' }
                ]
            });
            (0, react_1.render)((0, jsx_runtime_1.jsx)(AgentProfiles_1.AgentProfiles, { enableConfigValidation: true }), { wrapper: TestWrapper });
            react_1.fireEvent.click(react_1.screen.getByRole('button', { name: /Create Agent/i }));
            await (0, react_1.waitFor)(() => {
                expect(react_1.screen.getByTestId('agent-config-form')).toBeInTheDocument();
            });
            // Change temperature to invalid value
            const tempInput = react_1.screen.getByLabelText(/Temperature/i);
            await user_event_1.default.clear(tempInput);
            await user_event_1.default.type(tempInput, '1.5');
            await (0, react_1.waitFor)(() => {
                expect(react_1.screen.getByText('Temperature must be between 0 and 1')).toBeInTheDocument();
                expect(react_1.screen.getByTestId('config-error-temperature')).toBeInTheDocument();
            });
        });
        it('should support agent import/export with version compatibility', async () => {
            const mockExportData = {
                agent: { id: 'agent-1', name: 'Code Assistant' },
                version: '1.0.0',
                export_timestamp: '2024-01-16T14:30:00Z'
            };
            mockApi.exportAgentProfile.mockResolvedValue(mockExportData);
            (0, react_1.render)((0, jsx_runtime_1.jsx)(AgentProfiles_1.AgentProfiles, { enableImportExport: true }), { wrapper: TestWrapper });
            // Test export
            react_1.fireEvent.click(react_1.screen.getByTestId('agent-actions-agent-1'));
            react_1.fireEvent.click(react_1.screen.getByText(/Export Agent/i));
            await (0, react_1.waitFor)(() => {
                expect(mockApi.exportAgentProfile).toHaveBeenCalledWith('agent-1');
            });
            // Test import
            react_1.fireEvent.click(react_1.screen.getByRole('button', { name: /Import Agent/i }));
            await (0, react_1.waitFor)(() => {
                expect(react_1.screen.getByTestId('import-agent-dialog')).toBeInTheDocument();
            });
            const fileInput = react_1.screen.getByTestId('agent-file-input');
            const file = new File(['{}'], 'agent.json', { type: 'application/json' });
            await user_event_1.default.upload(fileInput, file);
            expect(react_1.screen.getByText('agent.json')).toBeInTheDocument();
        });
    });
    /**
     * Test Suite 6: Advanced UI Features
     */
    describe('Advanced UI Features', () => {
        it('should support customizable dashboard layouts with drag-and-drop', async () => {
            (0, react_1.render)((0, jsx_runtime_1.jsx)(AgentProfiles_1.AgentProfiles, { enableCustomLayout: true }), { wrapper: TestWrapper });
            // Enter layout edit mode
            react_1.fireEvent.click(react_1.screen.getByRole('button', { name: /Customize Layout/i }));
            await (0, react_1.waitFor)(() => {
                expect(react_1.screen.getByTestId('layout-editor')).toBeInTheDocument();
            });
            // Check for draggable components
            expect(react_1.screen.getByTestId('draggable-metrics-panel')).toBeInTheDocument();
            expect(react_1.screen.getByTestId('draggable-agents-grid')).toBeInTheDocument();
            expect(react_1.screen.getByTestId('draggable-activity-feed')).toBeInTheDocument();
            // Simulate drag and drop
            const metricsPanel = react_1.screen.getByTestId('draggable-metrics-panel');
            react_1.fireEvent.dragStart(metricsPanel);
            react_1.fireEvent.dragEnd(metricsPanel);
        });
        it('should provide keyboard shortcuts and accessibility features', async () => {
            (0, react_1.render)((0, jsx_runtime_1.jsx)(AgentProfiles_1.AgentProfiles, { enableKeyboardShortcuts: true }), { wrapper: TestWrapper });
            // Test keyboard shortcut for creating agent
            react_1.fireEvent.keyDown(document, { key: 'n', ctrlKey: true });
            await (0, react_1.waitFor)(() => {
                expect(react_1.screen.getByTestId('agent-creation-modal')).toBeInTheDocument();
            });
            // Test escape to close
            react_1.fireEvent.keyDown(document, { key: 'Escape' });
            await (0, react_1.waitFor)(() => {
                expect(react_1.screen.queryByTestId('agent-creation-modal')).not.toBeInTheDocument();
            });
            // Check for ARIA labels and accessibility
            expect(react_1.screen.getByRole('main')).toHaveAttribute('aria-label', 'Agent Profiles Dashboard');
            expect(react_1.screen.getByRole('search')).toHaveAttribute('aria-label', 'Search agents');
        });
        it('should support multiple view modes with state persistence', async () => {
            (0, react_1.render)((0, jsx_runtime_1.jsx)(AgentProfiles_1.AgentProfiles, { enableMultipleViews: true }), { wrapper: TestWrapper });
            // Switch to list view
            react_1.fireEvent.click(react_1.screen.getByTestId('view-mode-list'));
            await (0, react_1.waitFor)(() => {
                expect(react_1.screen.getByTestId('agents-list-view')).toBeInTheDocument();
            });
            // Switch to card view
            react_1.fireEvent.click(react_1.screen.getByTestId('view-mode-cards'));
            await (0, react_1.waitFor)(() => {
                expect(react_1.screen.getByTestId('agents-card-view')).toBeInTheDocument();
            });
            // Switch to table view
            react_1.fireEvent.click(react_1.screen.getByTestId('view-mode-table'));
            await (0, react_1.waitFor)(() => {
                expect(react_1.screen.getByTestId('agents-table-view')).toBeInTheDocument();
            });
            // Check for advanced table features
            expect(react_1.screen.getByText('Name')).toBeInTheDocument();
            expect(react_1.screen.getByText('Status')).toBeInTheDocument();
            expect(react_1.screen.getByText('Health')).toBeInTheDocument();
            expect(react_1.screen.getByText('Conversations')).toBeInTheDocument();
        });
    });
});
//# sourceMappingURL=AgentProfiles.test.js.map