Skip to content

Commit eae166e

Browse files
committed
fix: consolidate interactive mode testing into main framework
1 parent d86cddf commit eae166e

13 files changed

+1948
-8
lines changed
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# Running Interactive Mode with Python Test Script - Quick Reference
2+
3+
## 🎯 TL;DR
4+
5+
```bash
6+
# Existing tests work as-is (automated mode)
7+
python tools/internal-test/test-integration.py integrate laravel test-project
8+
9+
# Test interactive mode manually
10+
python tools/internal-test/test-interactive.py
11+
12+
# Test interactive mode with simulated input
13+
python tools/internal-test/test-interactive.py --automated
14+
```
15+
16+
## 📋 What Changed
17+
18+
### 1. Integration Script Updates
19+
- ✅ Added `-N` flag for non-interactive mode (CI-friendly)
20+
- ✅ Modified `-I` flag behavior to respect `-N` override
21+
- ✅ Updated help text
22+
23+
### 2. Python Integration Class Updates
24+
- ✅ Added `interactive_mode` parameter to `integrate_booster()`
25+
- ✅ Automatically uses `-N` flag when `interactive_mode=False`
26+
- ✅ Uses `-I` flag when `interactive_mode=True`
27+
28+
### 3. New Test Script
29+
- ✅ Created `test-interactive.py` for manual and automated testing
30+
- ✅ Supports both manual input and simulated input modes
31+
32+
## 🚀 Usage Modes
33+
34+
### Mode 1: Existing Tests (No Changes Needed)
35+
36+
Your existing Python tests work exactly as before:
37+
38+
```python
39+
# This automatically uses non-interactive mode
40+
integration.integrate_booster()
41+
```
42+
43+
**CI/CD:** ✅ No changes needed - everything works!
44+
45+
### Mode 2: Manual Interactive Testing
46+
47+
```bash
48+
# 1. Setup test project
49+
python tools/internal-test/test-integration.py setup laravel test-interactive
50+
51+
# 2. Run interactive test
52+
python tools/internal-test/test-interactive.py
53+
54+
# 3. Choose option 1 for interactive wizard
55+
```
56+
57+
### Mode 3: Automated Interactive Testing
58+
59+
```bash
60+
# Tests the interactive flow with pre-defined answers
61+
python tools/internal-test/test-interactive.py --automated
62+
```
63+
64+
This simulates:
65+
- "y" → Install all tools
66+
- "y" → Use ticket IDs
67+
- "PRJ" → Ticket prefix
68+
- "" → Default commit footer
69+
- "y" → Install IDE settings
70+
- "y" → Confirm configuration
71+
72+
## 💡 Key Points
73+
74+
1. **Backward Compatible:** All existing tests continue to work
75+
2. **CI-Friendly:** Non-interactive mode (`-N`) prevents hanging
76+
3. **Manual Testing:** New script for testing the wizard
77+
4. **Automated Testing:** Can simulate user input for CI
78+
79+
## 📝 Command Flags
80+
81+
| Flag | Purpose | Use In |
82+
|------|---------|--------|
83+
| `-I` | Interactive wizard | Manual testing |
84+
| `-N` | Non-interactive (skip prompts) | CI/CD, Python tests |
85+
| `-v` | Verbose logging | Debugging |
86+
| `-i` | Show version | Version checks |
87+
| `-h` | Help | Documentation |
88+
89+
## 🔍 Examples
90+
91+
### Example 1: Standard Python Test (Automated)
92+
93+
```python
94+
from lib.booster_integration import BoosterIntegration
95+
96+
# Default behavior - no prompts
97+
integration.integrate_booster()
98+
99+
# Equivalent to:
100+
# bash integrate_booster.sh -N
101+
```
102+
103+
### Example 2: Test Interactive Wizard
104+
105+
```python
106+
# Requires TTY (terminal)
107+
integration.integrate_booster(interactive_mode=True)
108+
109+
# Equivalent to:
110+
# bash integrate_booster.sh -I
111+
```
112+
113+
### Example 3: CI/CD Pipeline
114+
115+
```yaml
116+
# GitHub Actions
117+
- name: Test Integration
118+
run: |
119+
# Uses non-interactive mode automatically
120+
python tools/internal-test/test-integration.py full laravel ci-test
121+
```
122+
123+
## ✅ Testing Checklist
124+
125+
- [x] Verify existing tests still pass
126+
- [x] Test interactive mode manually
127+
- [x] Test automated interactive mode
128+
- [x] Verify CI/CD compatibility
129+
- [x] Update documentation
130+
131+
## 📚 More Information
132+
133+
See detailed documentation:
134+
- `tools/internal-test/TESTING_INTERACTIVE_MODE.md` - Full testing guide
135+
- `docs/content/1.integration_guide/2.interactive_mode.md` - User documentation
136+
- `docs/INTERACTIVE_MODE_IMPLEMENTATION.md` - Implementation details
137+
138+
## 🎉 Summary
139+
140+
**You can now:**
141+
1. ✅ Run existing Python tests without changes
142+
2. ✅ Test interactive mode manually when needed
143+
3. ✅ Automate interactive mode testing
144+
4. ✅ Use in CI/CD without modifications
145+
146+
The interactive mode is **fully integrated** with your Python test infrastructure! 🚀

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,17 @@ To integrate the booster into your existing PHP project:
3131

3232
2. Run the following command to integrate the booster into your project:
3333

34+
**Interactive Mode (Recommended for first-time setup):**
35+
```bash
36+
curl -sSL https://raw.githubusercontent.com/TerrorSquad/php-booster/main/booster/integrate_booster.sh | bash -s -- -I
37+
```
38+
39+
The interactive wizard will guide you through:
40+
- Selecting which code quality tools to install
41+
- Configuring Git workflow and ticket IDs
42+
- Setting up IDE configurations
43+
44+
**Quick Mode (Use defaults):**
3445
```bash
3546
curl -sSL https://raw.githubusercontent.com/TerrorSquad/php-booster/main/booster/integrate_booster.sh | bash
3647
```

0 commit comments

Comments
 (0)