π Problem Statement
The README documents: "AI Fix with 'Apply Solution'" β the Apply Solution button makes applying a fix a one-click action. However, the "Generate Tests" AI feature has no equivalent action button. When the AI generates 5-10 test cases, a user who wants only test case #3 must:
- Manually select the specific test case text in the AI panel
- Copy it
- Switch to the editor
- Paste it in the right location
This is especially painful on mobile (Debugra has a dedicated MobileBottomNav) where text selection is frustrating.
Proposed Fix
Add a "Copy Test" button that appears on hover over each test case block in the AI response panel:
// In src/components/Editor/AIResponsePanel.jsx
// After AI generates test cases, parse them into individual blocks
function parseTestCases(aiOutput) {
// Split by common test function patterns: def test_, it(', test(', @Test
const testPattern = /(?=def test_|it\(['"`]|test\(['"`]|@Test)/g;
return aiOutput.split(testPattern).filter(Boolean);
}
// Render each test case with a copy button
{aiMode === 'tests' && testCases.map((testCase, index) => (
<div key={index} className="test-case-block">
<div className="test-case-header">
<span className="test-case-label">Test {index + 1}</span>
<button
className="btn-copy-test"
onClick={() => {
navigator.clipboard.writeText(testCase.trim());
showCopiedFeedback(index);
}}
aria-label={`Copy test case ${index + 1}`}
>
{copiedIndex === index ? 'β Copied' : 'Copy'}
</button>
</div>
<pre className="test-case-code">{testCase.trim()}</pre>
</div>
))}
Also add an "Insert All Tests" button below the full test output that appends all generated tests to a new section at the bottom of the Monaco editor (after the existing code), matching the UX pattern already established by "Apply Solution".
Files to Modify
| File |
Change |
src/components/Editor/AIResponsePanel.jsx |
Parse test cases into blocks, add per-block Copy button |
src/hooks/useAI.js |
Store test cases as parsed array, not raw string |
src/index.css |
Add .test-case-block, .btn-copy-test styles |
Suggested labels: enhancement, frontend, UX, level: intermediate
I would like to work on this. Could you please assign it to me?
π Problem Statement
The README documents: "AI Fix with 'Apply Solution'" β the Apply Solution button makes applying a fix a one-click action. However, the "Generate Tests" AI feature has no equivalent action button. When the AI generates 5-10 test cases, a user who wants only test case #3 must:
This is especially painful on mobile (Debugra has a dedicated
MobileBottomNav) where text selection is frustrating.Proposed Fix
Add a "Copy Test" button that appears on hover over each test case block in the AI response panel:
Also add an "Insert All Tests" button below the full test output that appends all generated tests to a new section at the bottom of the Monaco editor (after the existing code), matching the UX pattern already established by "Apply Solution".
Files to Modify
src/components/Editor/AIResponsePanel.jsxsrc/hooks/useAI.jssrc/index.css.test-case-block,.btn-copy-teststylesSuggested labels:
enhancement,frontend,UX,level: intermediateI would like to work on this. Could you please assign it to me?