MCPcopy
hub / github.com/tanelpoder/0xtools / TUITestMapper

Class TUITestMapper

xtop/tests/test_tui_mapping.py:29–101  ·  view source on GitHub ↗

Maps CLI test parameters to TUI interactions

Source from the content-addressed store, hash-verified

27
28
29class TUITestMapper:
30 """Maps CLI test parameters to TUI interactions"""
31
32 def __init__(self, pilot):
33 self.pilot = pilot
34 self.column_positions = {} # Cache column positions in menus
35
36 async def apply_group_columns(self, columns: List[str]):
37 """Apply GROUP BY columns via TUI"""
38 if not columns:
39 return
40
41 await self.pilot.press("g") # Open grouping menu
42 await self.pilot.pause()
43
44 # In a real implementation, we would:
45 # 1. Parse the current menu items
46 # 2. Navigate to each column
47 # 3. Select it with space/enter
48
49 # For now, simplified selection
50 for column in columns:
51 # This would need real navigation logic
52 for _ in range(5): # Assume column is within 5 moves
53 await self.pilot.press("down")
54 await self.pilot.press("space") # Toggle
55 await self.pilot.pause(0.1)
56
57 await self.pilot.press("enter") # Apply
58 await self.pilot.pause()
59
60 async def apply_latency_columns(self, columns: List[str]):
61 """Apply latency columns via TUI"""
62 if not columns:
63 return
64
65 await self.pilot.press("l") # Open latency menu
66 await self.pilot.pause()
67
68 for column in columns:
69 # Navigate to column (simplified)
70 for _ in range(3):
71 await self.pilot.press("down")
72 await self.pilot.press("space") # Toggle
73 await self.pilot.pause(0.1)
74
75 await self.pilot.press("enter") # Apply
76 await self.pilot.pause()
77
78 async def apply_filter(self, where_clause: str):
79 """Apply WHERE clause filter via TUI"""
80 if not where_clause or where_clause == "1=1":
81 return
82
83 await self.pilot.press("space") # Open filter menu
84 await self.pilot.pause()
85
86 # In real implementation, would type the filter

Callers 1

test_cli_mappingFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_cli_mappingFunction · 0.68