/** * qa-workdesk.js * QA Team workdesk - Console logs, network monitoring, DOM inspection * MVP2: Added metrics frontpage as default view */ import BaseWorkdesk from './base-workdesk.js'; import { hydrateComponent } from '../config/component-registry.js'; import '../components/tools/ds-console-viewer.js'; export default class QAWorkdesk extends BaseWorkdesk { constructor(shell) { super(shell); this.teamId = 'qa'; this.teamName = 'QA Team'; this.tools = [ { id: 'frontpage', name: 'Dashboard', description: 'Team metrics and quick actions', component: 'ds-frontpage' }, { id: 'figma-live-compare', name: 'Figma vs Live', description: 'QA validation: Figma design vs live implementation', component: 'ds-figma-live-compare' }, { id: 'esre-editor', name: 'ESRE Editor', description: 'Edit Explicit Style Requirements and Expectations', component: 'ds-esre-editor' }, { id: 'console-viewer', name: 'Console Viewer', description: 'Monitor browser console logs', mcpTool: 'browser_get_logs' }, { id: 'network-monitor', name: 'Network Monitor', description: 'Track network requests', mcpTool: 'devtools_network_requests' }, { id: 'error-tracker', name: 'Error Tracker', description: 'Track uncaught exceptions', mcpTool: 'browser_get_errors' } ]; this.currentTool = 'frontpage'; } async loadTool(tool) { const stage = this.shell.stageContent; if (!stage) return; // For tools with components, load them dynamically if (tool.component) { // Show loading state stage.innerHTML = `
Loading ${tool.name}...
`; try { // Clear the stage and hydrate the component stage.innerHTML = ''; await hydrateComponent(tool.component, stage); console.log(`[QAWorkdesk] Loaded component: ${tool.component}`); } catch (error) { console.error(`[QAWorkdesk] Failed to load tool ${tool.component}:`, error); stage.innerHTML = `

Error Loading Tool

${error.message}

`; } } else { // Fall back to base implementation for MCP tools super.loadTool(tool); } } renderStage() { const stage = this.shell.stageContent; if (!stage) return; stage.innerHTML = `

QA Team Workdesk

QA validation, testing, and debugging tools

${this.createCard('QA Validation', `

Compare and validate implementations:

`)} ${this.createCard('Console Monitoring', `

Real-time console log streaming:

`)} ${this.createCard('Network Debugging', `

Track all HTTP requests:

`)}

Quick Actions

`; // Setup button handlers stage.querySelector('#compare-btn')?.addEventListener('click', () => { this.onToolClick('figma-live-compare'); }); stage.querySelector('#esre-btn')?.addEventListener('click', () => { this.onToolClick('esre-editor'); }); stage.querySelector('#console-btn')?.addEventListener('click', () => { this.onToolClick('console-viewer'); // Switch panel to console tab (component is already configured via panel-config.js) const panel = this.shell.querySelector('ds-panel'); if (panel) { panel.switchTab('console'); } }); stage.querySelector('#network-btn')?.addEventListener('click', () => { this.onToolClick('network-monitor'); // Switch panel to network tab (component is already configured via panel-config.js) const panel = this.shell.querySelector('ds-panel'); if (panel) { panel.switchTab('network'); } }); } }