Skip to content

Commit ebe23c3

Browse files
Copilotsofthack007
andcommitted
Add boot validation scenarios for quick firmware testing
- Create boot-check.yaml: 12-second quick boot validation - Create boot-full.yaml: 30-second comprehensive boot validation - Add CI step for quick boot check before Playwright tests - Update README.md with scenario documentation and usage examples - Boot check runs as pre-flight validation in CI workflow - Both scenario logs uploaded as artifacts for analysis Co-authored-by: softhack007 <[email protected]>
1 parent 915b766 commit ebe23c3

File tree

4 files changed

+118
-0
lines changed

4 files changed

+118
-0
lines changed

.github/workflows/wokwi-test.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,28 @@ jobs:
7676
env:
7777
WOKWI_CLI_TOKEN: ${{ secrets.WOKWI_CLI_TOKEN }}
7878

79+
- name: Quick boot validation with scenario
80+
working-directory: test/wokwi
81+
env:
82+
WOKWI_CLI_TOKEN: ${{ secrets.WOKWI_CLI_TOKEN }}
83+
run: |
84+
# Create log directory
85+
mkdir -p logs
86+
87+
echo "Running quick boot check scenario (12 seconds)..."
88+
if ~/.wokwi-ci/bin/wokwi-cli --timeout 20000 --scenario scenarios/boot-check.yaml . > logs/boot-check.log 2>&1; then
89+
echo "✅ Boot check passed - firmware boots without crashes"
90+
echo ""
91+
echo "=== Boot check log ==="
92+
cat logs/boot-check.log
93+
else
94+
echo "❌ Boot check failed - firmware did not boot properly"
95+
echo ""
96+
echo "=== Boot check log ==="
97+
cat logs/boot-check.log
98+
exit 1
99+
fi
100+
79101
- name: Start Wokwi simulator in background
80102
env:
81103
WOKWI_CLI_TOKEN: ${{ secrets.WOKWI_CLI_TOKEN }}

test/wokwi/README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,65 @@ The Playwright tests (`test/playwright/wokwi-basic.spec.js`) verify:
7979
- Edit page loads without errors
8080
- JSON API endpoints respond correctly
8181

82+
## Boot Validation Scenarios
83+
84+
Wokwi CLI supports test scenarios that can validate firmware boot without requiring a full Playwright test suite. Two scenarios are provided:
85+
86+
### Quick Boot Check (`scenarios/boot-check.yaml`)
87+
A fast 12-second validation that ensures WLED boots without immediate crashes.
88+
89+
**Features:**
90+
- Simple delay-based validation
91+
- Total runtime: ~12 seconds
92+
- Fails if simulator crashes or hangs during boot
93+
- Perfect for CI pre-flight checks
94+
95+
**Usage:**
96+
```bash
97+
cd test/wokwi
98+
~/.wokwi-ci/bin/wokwi-cli --timeout 20000 --scenario scenarios/boot-check.yaml .
99+
```
100+
101+
### Comprehensive Boot Validation (`scenarios/boot-full.yaml`)
102+
A thorough 30-second validation with extended timing for WiFi AP and HTTP server initialization.
103+
104+
**Features:**
105+
- Allows full system initialization
106+
- Total runtime: ~30 seconds
107+
- More detailed validation
108+
- Better for local testing and troubleshooting
109+
110+
**Usage:**
111+
```bash
112+
cd test/wokwi
113+
~/.wokwi-ci/bin/wokwi-cli --timeout 40000 --scenario scenarios/boot-full.yaml .
114+
```
115+
116+
### Creating Custom Scenarios
117+
118+
You can create your own scenario files in YAML format:
119+
120+
```yaml
121+
version: 1
122+
timeout: 15000 # milliseconds
123+
124+
steps:
125+
- name: "Description of step"
126+
sleep: 5000 # wait 5 seconds
127+
```
128+
129+
The scenario will fail if:
130+
- The simulator crashes during execution
131+
- The timeout is exceeded
132+
- Any step encounters an error
133+
82134
## Extending Tests
83135
84136
To add more tests:
85137
1. Edit `test/playwright/wokwi-basic.spec.js`
86138
2. Add new test cases using Playwright's `test()` function
87139
3. Follow the existing pattern of checking for console errors
140+
4. Create custom scenario files in `scenarios/` directory
88141

89142
## Troubleshooting
90143

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Quick Boot Check Scenario for WLED-MM
2+
# This scenario performs a fast validation that WLED boots without immediate crashes
3+
# Total runtime: ~12 seconds
4+
# Perfect for CI pre-flight checks
5+
6+
version: 1
7+
timeout: 12000 # 12 seconds
8+
9+
# Simple validation: just wait and ensure the simulator doesn't crash
10+
steps:
11+
- name: "Wait for initial boot"
12+
sleep: 5000 # 5 seconds
13+
14+
- name: "Verify simulator is still running"
15+
sleep: 5000 # 5 seconds
16+
17+
- name: "Final stability check"
18+
sleep: 2000 # 2 seconds
19+
20+
# If we get here without the simulator crashing, boot is successful
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Comprehensive Boot Validation Scenario for WLED-MM
2+
# This scenario performs thorough validation with extended timing for WiFi AP and HTTP server
3+
# Total runtime: ~30 seconds
4+
# Better for local testing and troubleshooting
5+
6+
version: 1
7+
timeout: 30000 # 30 seconds
8+
9+
# Extended validation with more time for full system initialization
10+
steps:
11+
- name: "Initial boot phase"
12+
sleep: 8000 # 8 seconds - ESP32 basic initialization
13+
14+
- name: "WiFi AP initialization"
15+
sleep: 10000 # 10 seconds - WiFi access point setup
16+
17+
- name: "HTTP server startup"
18+
sleep: 8000 # 8 seconds - Web server initialization
19+
20+
- name: "Final stability verification"
21+
sleep: 4000 # 4 seconds - Ensure everything is stable
22+
23+
# If we get here, WLED has fully initialized with WiFi AP and HTTP server

0 commit comments

Comments
 (0)