// Assignment Popover Verification Script // Run this in the browser console on a shots table page console.log('๐Ÿงช Starting Assignment Popover Verification...'); const verifyAssignmentPopover = { // Check if EditableTaskStatus components are present checkComponents() { const components = document.querySelectorAll('[data-testid="editable-task-status"]'); console.log(`โœ… Found ${components.length} EditableTaskStatus components`); if (components.length === 0) { console.log('โŒ No EditableTaskStatus components found. Make sure you\'re on the shots table view.'); return false; } return components; }, // Check if assignment buttons are present checkAssignmentButtons() { const buttons = document.querySelectorAll('[data-testid="editable-task-status"] button'); console.log(`โœ… Found ${buttons.length} assignment buttons`); buttons.forEach((btn, index) => { const hasUserIcon = btn.querySelector('svg[data-lucide="user"]'); const hasAvatar = btn.querySelector('[class*="avatar"]'); console.log(` Button ${index + 1}: ${hasUserIcon ? '๐Ÿ‘ค User icon' : hasAvatar ? '๐Ÿ”ต Avatar' : 'โ“ Unknown'}`); }); return buttons; }, // Test popover opening async testPopoverOpening(buttonIndex = 0) { const buttons = this.checkAssignmentButtons(); if (buttons.length === 0) { console.log('โŒ No buttons found to test'); return false; } const button = buttons[buttonIndex]; console.log(`๐Ÿ–ฑ๏ธ Testing popover opening on button ${buttonIndex + 1}...`); // Click the button button.click(); // Wait a moment for popover to appear await new Promise(resolve => setTimeout(resolve, 500)); // Check if popover appeared const popovers = document.querySelectorAll('[data-radix-popper-content-wrapper]'); const popoverContent = document.querySelector('[role="dialog"]'); if (popovers.length > 0 || popoverContent) { console.log('โœ… Popover opened successfully!'); // Check popover content const assignText = document.querySelector('*:contains("Assign Task")'); const debugInfo = document.querySelector('*:contains("Project ID:")'); const loadingText = document.querySelector('*:contains("Loading members")'); const membersList = document.querySelector('*:contains("Unassign")'); console.log('๐Ÿ“‹ Popover content check:'); console.log(` - Assign Task header: ${assignText ? 'โœ…' : 'โŒ'}`); console.log(` - Debug info: ${debugInfo ? 'โœ…' : 'โŒ'}`); console.log(` - Loading/Members: ${loadingText || membersList ? 'โœ…' : 'โŒ'}`); return true; } else { console.log('โŒ Popover did not open'); return false; } }, // Check for expected console messages checkConsoleMessages() { console.log('๐Ÿ” Expected console messages after clicking assignment button:'); console.log(' - "Popover state changed: true"'); console.log(' - "Loading project members when popover opens"'); console.log(' - "Loading project members for project: [ID]"'); console.log(' - "Loaded project members: [...]"'); console.log(''); console.log('๐Ÿ’ก Click an assignment button and watch for these messages'); }, // Check network requests checkNetworkRequests() { console.log('๐ŸŒ Expected network requests:'); console.log(' - GET /projects/{id}/members (when popover opens)'); console.log(' - POST /shots/{id}/tasks (if task doesn\'t exist)'); console.log(' - PUT /tasks/{id}/assign (when assigning)'); console.log(' - PUT /tasks/{id} (when unassigning)'); console.log(''); console.log('๐Ÿ’ก Open Network tab in DevTools to monitor these requests'); }, // Run full verification async runFullVerification() { console.log('๐Ÿš€ Running full assignment popover verification...'); console.log(''); // Step 1: Check components const components = this.checkComponents(); if (!components) return false; // Step 2: Check buttons const buttons = this.checkAssignmentButtons(); if (buttons.length === 0) return false; // Step 3: Test popover opening const popoverWorking = await this.testPopoverOpening(); // Step 4: Show expected messages and requests console.log(''); this.checkConsoleMessages(); this.checkNetworkRequests(); // Summary console.log(''); console.log('๐Ÿ“Š Verification Summary:'); console.log(` - Components found: โœ… ${components.length}`); console.log(` - Buttons found: โœ… ${buttons.length}`); console.log(` - Popover opening: ${popoverWorking ? 'โœ…' : 'โŒ'}`); if (popoverWorking) { console.log(''); console.log('๐ŸŽ‰ Assignment popover verification PASSED!'); console.log('โœ… The implementation appears to be working correctly.'); console.log(''); console.log('๐Ÿงช Manual testing steps:'); console.log('1. Click assignment buttons to open popovers'); console.log('2. Verify project members load'); console.log('3. Test assignment by clicking a member'); console.log('4. Test unassignment by clicking "Unassign"'); console.log('5. Check for success toast notifications'); } else { console.log(''); console.log('โŒ Assignment popover verification FAILED'); console.log('๐Ÿ”ง Check browser console for errors and verify:'); console.log(' - You\'re on the shots table view'); console.log(' - No JavaScript errors are present'); console.log(' - Popover components are properly imported'); console.log(' - Backend is running and accessible'); } return popoverWorking; } }; // Auto-run verification verifyAssignmentPopover.runFullVerification(); // Make verification object available globally window.verifyAssignmentPopover = verifyAssignmentPopover; console.log(''); console.log('๐Ÿ› ๏ธ Verification object available as: window.verifyAssignmentPopover'); console.log('๐Ÿ“‹ Available methods:'); console.log(' - checkComponents()'); console.log(' - checkAssignmentButtons()'); console.log(' - testPopoverOpening(buttonIndex)'); console.log(' - runFullVerification()');