Skip to content

Commit 78bf221

Browse files
MarkoVcodeclaude
andcommitted
Add GenericOWONPSU component with voltage/current limit controls
- Create GenericOWONPSU component based on GenericPSU - Add voltage_limit and current_limit editable fields in Settings section - Implement API endpoints for reading/setting limits: - GET/POST /instruments/{class}/{device}/{channel}/voltage_limit - GET/POST /instruments/{class}/{device}/{channel}/current_limit - Register GenericOWONPSU in ClassPods for InstrumentPod rendering - Follow same 5-digit display pattern as V/A settings - Include SET buttons and API tooltips for limits 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent e96004b commit 78bf221

32 files changed

Lines changed: 3381 additions & 56 deletions

.github/workflows/e2e-tests.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: E2E Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
e2e-tests:
12+
name: Playwright E2E Tests
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 15
15+
16+
defaults:
17+
run:
18+
working-directory: benchmesh-serial-service/frontend
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: '18'
28+
cache: 'npm'
29+
cache-dependency-path: benchmesh-serial-service/frontend/package-lock.json
30+
31+
- name: Install dependencies
32+
run: npm ci
33+
34+
- name: Install Playwright browsers
35+
run: npx playwright install --with-deps chromium
36+
37+
- name: Build frontend
38+
run: npm run build
39+
40+
- name: Run Playwright tests
41+
run: npm run test:e2e
42+
env:
43+
CI: true
44+
45+
- name: Upload test results
46+
if: always()
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: playwright-report
50+
path: benchmesh-serial-service/frontend/playwright-report/
51+
retention-days: 30
52+
53+
- name: Upload test videos
54+
if: failure()
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: playwright-videos
58+
path: benchmesh-serial-service/frontend/test-results/
59+
retention-days: 7

CLAUDE.md

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,17 @@ Both systems coexist without interference and provide complementary insights.
187187
# From repository root - starts everything (API, Frontend, Node-RED)
188188
./start.sh
189189

190+
# Start with frontend UI build (use when frontend code has changed)
191+
./start.sh --uibuild
192+
190193
# Services will be available at:
191-
# - Frontend: http://localhost:57666
194+
# - Frontend: http://localhost:57666/ui
192195
# - API Docs: http://localhost:57666/docs
193196
# - Node-RED: http://localhost:1880
194197
```
195198

199+
**Note**: The `--uibuild` flag triggers a full frontend build before starting services. This runs `npm ci` and `npm run build` in the frontend directory. Use this flag when you've made changes to the frontend code. Without the flag, the script uses the existing build in `dist/`.
200+
196201
### Backend Development
197202

198203
```bash
@@ -249,13 +254,34 @@ npm run build
249254
# Preview production build
250255
npm run preview
251256

252-
# Run tests
257+
# Run unit tests (vitest)
253258
npm test
254259

255-
# Run tests once (CI mode)
260+
# Run unit tests once (CI mode)
256261
npm run test:run
262+
263+
# Run E2E tests (Playwright)
264+
npm run test:e2e
265+
266+
# Run E2E tests with UI mode
267+
npm run test:e2e:ui
268+
269+
# Run E2E tests in headed mode (visible browser)
270+
npm run test:e2e:headed
271+
272+
# Run E2E tests in debug mode
273+
npm run test:e2e:debug
257274
```
258275

276+
**E2E Testing**: The frontend includes comprehensive Playwright tests that verify UI functionality with mocked API and WebSocket connections. Tests cover:
277+
- App navigation and modals (Configuration, Documentation, Metrics, Recording)
278+
- Instrument display and status indicators
279+
- Device interaction and real-time updates
280+
- API integration, error handling, and retry logic
281+
- WebSocket connection and data streaming
282+
283+
See `benchmesh-serial-service/frontend/e2e/README.md` for detailed E2E testing documentation.
284+
259285
### Driver CLI Tool
260286

261287
Test driver methods directly from command line:
@@ -306,12 +332,29 @@ python3 mcp_services/testing/client_helper.py
306332

307333
The MCP service provides:
308334
- **Backend Tests**: Run pytest tests with filtering (46 tests discovered)
309-
- **Frontend Tests**: Run vitest tests (21 tests discovered)
335+
- **Frontend Unit Tests**: Run vitest tests (21 tests discovered)
336+
- **E2E Tests**: Run Playwright tests for UI integration testing (31 tests)
310337
- **Integration Tests**: Run integration tests separately
311338
- **Smart Testing**: Automatically run tests for changed files
312339
- **Test Discovery**: Find all available tests
313340
- **JSON Reports**: Structured test results with detailed metrics
314341

342+
### E2E Testing Modes
343+
344+
**Mocked Tests (default)**: Fast, isolated tests with mocked API/WebSocket
345+
```bash
346+
npm run test:e2e
347+
```
348+
349+
**Real Service Tests**: Full integration tests against running backend
350+
```bash
351+
# 1. Start backend service
352+
cd benchmesh-serial-service && PYTHONPATH=src uvicorn benchmesh_service.api:app --port 57666 &
353+
354+
# 2. Run E2E tests with real service
355+
npm run test:e2e:service
356+
```
357+
315358
### Usage Examples
316359

317360
```python
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Playwright
2+
test-results/
3+
playwright-report/
4+
playwright/.cache/

0 commit comments

Comments
 (0)