Repository navigation
E2E hardware test with API call triggering and telemetry verification - #40
Merged
Merged
Conversation
…timeout arg
1. ESP32 reset sequence fix (bootloader mode prevention):
- Open port with autoOpen:false, rtscts:false, hupcl:false
- IMMEDIATELY set({dtr:false, rts:false}) to establish known state
- Then pulse EN: set({dtr:false, rts:true}) for 200ms
- Then release: set({dtr:false, rts:false})
- CRITICAL: Every set() must explicitly pass dtr:false
Root cause: node serialport asserts DTR (GPIO0) by default on open.
DTR low during EN pulse puts ESP32 into bootloader mode:
'rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT) waiting for download'
Fix matches known-good PowerShell sequence on this board:
DtrEnable=false; RtsEnable=true; Open(); sleep 200ms; RtsEnable=false
2. Positional timeout argument fix:
- Now honors: npx tsx run-e2e.ts COM15 180000
- Collect all non-flag args as positional array
- positional[0] = serial port, positional[1] = timeout
- Previously ignored positional timeout (always used 120000ms default)
Tested on Windows COM15 hardware.
Co-authored-by: James Brown <JamesSmartCell@users.noreply.github.com>
…dotenv - Anchor API_CALL regex to match only 'API_CALL ' (with space), not 'API_CALLS_RECEIVED=' - Parse API_CALLS_RECEIVED separately to show total count - Add --env-file flag to load custom environment configuration - Load TELEMETRY_API_KEY and TELEMETRY_API_URL from .env (gitignored) or --env-file - Never print API key to console or logs - Verify connect event firmware version matches device FW_VERSION - Verify diagnostics row exists with timestamp >= testStartTime - Update README with telemetry verification details and CLI options Co-authored-by: James Brown <JamesSmartCell@users.noreply.github.com>
…alls - Replace --env-file and TELEMETRY_API_KEY with --proxy-repo flag - Accept SMARTLAYER_PROXY_DIR env var as default repo path - Run 'npm run telemetry:pull' in proxy repo after device test - Read pulled data from <proxy-repo>/data/telemetry-*.jsonl (local DB) - Verify connect event firmware version and diagnostics from JSONL - Never handle or print API keys (proxy repo's tools load from their own .env) - Keep API_CALL regex fix from previous commit (distinguishes from API_CALLS_RECEIVED) - Update README with SmartLayerProxy tools documentation - Skip telemetry verification with clear message if no repo path given Rationale: The owner designed SmartLayerProxy's local telemetry tools (tools/telemetry/pull.ts, tools/telemetry/analyse.ts) for exactly this use case. They load credentials from tools/telemetry/.env automatically, eliminating the need for E2E runner to manage separate keys or environment files. Co-authored-by: James Brown <JamesSmartCell@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds comprehensive E2E hardware testing firmware with active API call triggering and enhanced telemetry verification.
Overview
Builds on PR #38 by adding:
GET /api/<address>/e2eTestthrough the public proxye2e-<short-sha>ore2e-<short-sha>-dirtyChanges
Test Firmware (
test/hardware/proxy_e2e/)src/main.cpp: E2E test firmwareE2E:log lines for test runner parsingTcpBridge::armStartupWatchdog()to verify watchdog implementationgit_version.py: Build scriptFW_VERSION = e2e-<short-sha>usinggit rev-parse --short HEAD-dirtysuffix ifgit diff --quiet HEADfails (ignores untracked files)-DFW_VERSION="..."build flagrun-e2e.ts: TypeScript test runnerdtr=false, rts=false→dtr=false, rts=true(200ms) →dtr=false, rts=falseE2E:log lines with key=value pairsGET /api/<address>/e2eTestwhen device reachesWAITING_FOR_APIE2E:API_CALL name=...fromE2E:API_CALLS_RECEIVED=...--proxy-repo <path>flag (orSMARTLAYER_PROXY_DIRenv var)npm run telemetry:pullin proxy repo after test<proxy-repo>/data/telemetry-*.jsonl.env)--address,--timeout,--proxy-repoREADME.md: DocumentationTesting
✅ Hardware verified on COM15 (commit 5f3075a):
E2E:DONE PASS time_ms=28000Key Implementation Details
Hardware Reset Sequence
ESP32 uses DTR and RTS to control GPIO0 and EN pins:
Default serialport behavior asserts DTR, pulling GPIO0 LOW during reset → bootloader hang.
Fixed sequence:
Git Version Detection
Uses
git diff --quiet HEADinstead ofgit status --porcelainto ignore untracked.pio/andnode_modules/directories. Only tracked modifications trigger-dirtysuffix.API Call Testing
When device reports
E2E:WAITING_FOR_API, runner calls:Proxy forwards opcode 0x04 to device over TCP bridge. Device responds with opcode 0x08 and prints
E2E:API_CALL.Telemetry Verification via SmartLayerProxy Repo
Instead of managing API keys directly, the runner uses the SmartLayerProxy repo's telemetry tools:
After device test completes, runner calls
npm run telemetry:pullin the proxy repotools/telemetry/pull.tswhich loads credentials fromtools/telemetry/.env<proxy-repo>/data/telemetry-YYYYMMDD.jsonlRunner reads the pulled JSONL data and filters events:
Verifies:
firmwareVersion === FW_VERSIONAdvantages:
.env(never exposed to E2E runner)Usage:
Dependencies
Test runner uses:
serialport— serial communication@serialport/parser-readline— line parsingaxios— HTTP requests (for API call triggering)Related