You were absolutely right - the existing tests were mostly pseudo-GUI tests that created QApplication but didn't actually test real user interactions. This is why obvious GUI errors were slipping through despite tests passing.
- Purpose: Core logic validation without GUI overhead
- Speed: ⚡ Fast execution (< 10 seconds total)
- When to run: During development, CI/CD, quick validation
- Coverage: Business logic, data structures, algorithms
Files:
test_node_system.py- Node creation, properties, code managementtest_pin_system.py- Pin generation, type detection, positioningtest_connection_system.py- Connection logic, validation, serialization
- Purpose: Actual user interaction testing with visible windows
- Speed: 🐌 Slower execution (30+ seconds) but catches real issues
- When to run: Before releases, when GUI bugs suspected, comprehensive validation
- Coverage: User workflows, visual behavior, integration issues
Files:
test_full_gui_integration.py- Complete GUI component testingtest_end_to_end_workflows.py- Real user workflow simulationtest_gui_node_deletion.py- Specific GUI interaction teststest_user_scenario.py- Bug reproduction scenarios
# Fast headless tests only
run_headless_tests.bat# Complete GUI integration tests
run_gui_tests.bat# Visual test management with categories
run_enhanced_test_gui.bat# Creates QApplication but doesn't show windows
app = QApplication([])
node = Node("Test")
# Tests logic but misses visual/interaction issues# Actually shows windows and tests user interactions
self.window = NodeEditorWindow()
self.window.show() # Window is visible!
self.window.resize(1200, 800)
QApplication.processEvents() # Real event processing
# Simulates actual user actions
node.setSelected(True)
delete_event = QKeyEvent(QKeyEvent.KeyPress, Qt.Key_Delete, Qt.NoModifier)
self.graph.keyPressEvent(delete_event)
# Verifies visual results
self.assertTrue(node.isVisible())- Window opens correctly
- Menu bar exists and functional
- Components initialize properly
- Context menu node creation
- Node selection and properties
- Code editing workflow
- Creating connections between compatible nodes
- Visual feedback during connection
- Connection validation
- Creation and deletion of reroute nodes
- Critical: Undo/redo cycle (addresses user-reported bug)
- Complete data processing pipelines
- Save/load file operations
- Error recovery scenarios
def test_reroute_node_undo_redo_cycle(self):
"""This test specifically addresses the user-reported bug"""
# Create reroute node
reroute = RerouteNode()
self.assertIsInstance(reroute, RerouteNode)
# Delete it
delete_event = QKeyEvent(QKeyEvent.KeyPress, Qt.Key_Delete, Qt.NoModifier)
self.graph.keyPressEvent(delete_event)
# Undo deletion (this is where the bug occurred)
undo_event = QKeyEvent(QKeyEvent.KeyPress, Qt.Key_Z, Qt.ControlModifier)
self.view.keyPressEvent(undo_event)
# CRITICAL TEST: Restored node should still be a RerouteNode
restored_node = find_restored_node("Reroute")
self.assertIsInstance(restored_node, RerouteNode,
"CRITICAL BUG: RerouteNode was restored as regular Node!")def test_create_simple_data_pipeline(self):
"""Tests complete user workflow: create -> connect -> execute"""
# User creates input node
input_node = self.graph.create_node("Data Generator", pos=(100, 200))
input_node.set_code('@node_entry\ndef generate() -> list:\n return [1,2,3]')
# User creates processing node
process_node = self.graph.create_node("Processor", pos=(400, 200))
process_node.set_code('@node_entry\ndef process(data: list) -> list:\n return [x*2 for x in data]')
# User connects nodes
connection = self.graph.create_connection(output_pin, input_pin)
# Verify complete pipeline works
self.assertTrue(connection.isVisible())
self.assertEqual(len(self.graph.connections), 1)# Quick feedback loop
run_headless_tests.bat# Full validation
run_enhanced_test_gui.bat
# Select both Headless and GUI categories# Focus on GUI tests
run_gui_tests.bat# Complete test suite
run_enhanced_test_gui.bat
# Run ALL tests and ensure 100% pass rateThe new run_enhanced_test_gui.bat provides:
- 📊 Visual test organization by category
- ⚡ Category-specific timeouts (GUI tests get more time)
- 🎯 Selective execution (run only what you need)
- 📝 Detailed output with real-time status
⚠️ GUI test warnings (don't interact with test windows)
- Application is working correctly
- Safe to release/deploy
- Your exact situation! Logic works but user experience is broken
- Focus on GUI test failures to find integration issues
- Core logic problems
- Fix headless issues first
- Major issues requiring comprehensive fixes
- 🎯 Catches Real Issues: GUI tests find problems users actually encounter
- ⚡ Fast Development: Headless tests provide quick feedback
- 🔧 Organized Debugging: Know exactly which layer has issues
- 📊 Better Coverage: Tests both logic AND user experience
- 🚀 Confidence: Release knowing the GUI actually works
This testing approach ensures that when tests pass, the application actually works for real users, not just in theory!