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:
53
.github/copilot-instructions.md
vendored
53
.github/copilot-instructions.md
vendored
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user