Fix UI test timeouts, TypeScript compilation, dependency compatibility, and backend tests with isolated test suite using per-test mocking (#930)

This commit is contained in:
Copilot
2025-12-20 15:09:26 +01:00
committed by GitHub
parent 5a54ba4983
commit 92aa2c9fa8
14 changed files with 3135 additions and 667 deletions

View File

@@ -188,6 +188,59 @@ yarn lint
yarn lint:fix
```
### Running UI Tests (yarn test:ui)
The UI tests require specific setup in the test environment:
**Prerequisites:**
1. **Xvfb (X Virtual Framebuffer)** - Required for headless Electron testing
```bash
# Start Xvfb on display :99
Xvfb :99 -screen 0 1024x720x24 -ac &
export DISPLAY=:99
```
2. **Mosquitto MQTT Broker** - Required for MQTT message testing
```bash
# Install mosquitto
sudo apt-get install -y mosquitto mosquitto-clients
# Start mosquitto service
sudo systemctl start mosquitto
# Verify it's running on port 1883
sudo systemctl status mosquitto
```
3. **@types/node** - Required for TypeScript compilation
```bash
yarn add -D @types/node
```
**Running UI Tests:**
```bash
# Build the application first
yarn build
# Run UI tests with proper display
DISPLAY=:99 yarn test:ui
```
**Common Issues:**
- **"Timeout exceeded" in before hook**: Mosquitto is not running or not accessible on port 1883
- **"Cannot find type definition file for 'node'"**: Run `yarn add -D @types/node`
- **Electron fails to launch**: Xvfb is not running or DISPLAY variable not set
- **Tests hang**: Check if old Electron/mosquitto processes are still running and kill them
**Environment Cleanup:**
```bash
# Kill old Electron processes
ps aux | grep electron | grep -v grep | awk '{print $2}' | xargs kill -9 2>/dev/null
# Kill old mosquitto processes (if running custom instance)
ps aux | grep mosquitto | grep -v grep | awk '{print $2}' | xargs kill -9 2>/dev/null
```
## MCP Introspection Testing
The project supports MCP (Model Context Protocol) for automated testing with Playwright:

View File

@@ -33,6 +33,7 @@ jobs:
- name: Build
run: yarn build
- name: Run UI Tests
timeout-minutes: 10
run: ./scripts/runUiTests.sh
- name: Upload Test Screenshots
if: always()