Files
manual_slop/scripts/tasks/gui_ux_1_2_tests.toml

45 lines
2.1 KiB
TOML

role = "tier3-worker"
docs = ["conductor/workflow.md"]
prompt = """
Create tests/test_mma_approval_indicators.py — failing tests for Task 1.2 of comprehensive_gui_ux track.
CONTEXT: Task 1.2 adds a blinking "APPROVAL PENDING" badge after the Status line in _render_mma_dashboard in @gui_2.py. It checks self._pending_mma_spawn, self._pending_mma_approval, and self._pending_ask_dialog.
TESTS TO WRITE (all should FAIL against current code — test new behaviour):
Use the same _make_app / _make_imgui_mock pattern as @tests/test_mma_dashboard_streams.py but add these attributes:
app._pending_mma_spawn = None
app._pending_mma_approval = None
app._pending_ask_dialog = False
1. test_no_approval_badge_when_idle:
- All three pending attrs are None/False
- Patch gui_2.imgui, call App._render_mma_dashboard(app)
- Assert imgui.text_colored was NOT called with any string containing "APPROVAL PENDING"
2. test_approval_badge_shown_when_spawn_pending:
- app._pending_mma_spawn = {"ticket_id": "T-001"}
- Patch gui_2.imgui, patch 'gui_2.math' (so math.sin returns 0.8)
- Call App._render_mma_dashboard(app)
- Collect all text_colored call args as a single joined string
- Assert "APPROVAL PENDING" appears in that string
3. test_approval_badge_shown_when_mma_approval_pending:
- app._pending_mma_approval = {"step": "test"}
- Same patch pattern
- Assert "APPROVAL PENDING" in text_colored calls
4. test_approval_badge_shown_when_ask_dialog_pending:
- app._pending_ask_dialog = True
- Same patch pattern
- Assert "APPROVAL PENDING" in text_colored calls
IMPLEMENTATION DETAILS:
- Import: import pytest, math, from unittest.mock import patch, MagicMock, call
- Use the _make_app helper from test_mma_dashboard_streams (copy it or import it — prefer copying to keep tests self-contained)
- For _make_imgui_mock: same as test_mma_dashboard_streams, also set imgui_mock.ImVec4.return_value = MagicMock()
- Patch 'gui_2.math' where needed: with patch('gui_2.math') as mock_math: mock_math.sin.return_value = 0.8
- Use 1-space indentation throughout.
- All 4 tests should FAIL against current gui_2.py (which has no approval badge logic yet).
"""