@@ -188,6 +188,59 @@ yarn lint
188188yarn lint:fix
189189```
190190
191+ ### Running UI Tests (yarn test: ui )
192+
193+ The UI tests require specific setup in the test environment:
194+
195+ ** Prerequisites:**
196+ 1 . ** Xvfb (X Virtual Framebuffer)** - Required for headless Electron testing
197+ ``` bash
198+ # Start Xvfb on display :99
199+ Xvfb :99 -screen 0 1024x720x24 -ac &
200+ export DISPLAY=:99
201+ ```
202+
203+ 2 . ** Mosquitto MQTT Broker** - Required for MQTT message testing
204+ ``` bash
205+ # Install mosquitto
206+ sudo apt-get install -y mosquitto mosquitto-clients
207+
208+ # Start mosquitto service
209+ sudo systemctl start mosquitto
210+
211+ # Verify it's running on port 1883
212+ sudo systemctl status mosquitto
213+ ```
214+
215+ 3 . ** @types/node ** - Required for TypeScript compilation
216+ ``` bash
217+ yarn add -D @types/node
218+ ```
219+
220+ ** Running UI Tests:**
221+ ``` bash
222+ # Build the application first
223+ yarn build
224+
225+ # Run UI tests with proper display
226+ DISPLAY=:99 yarn test:ui
227+ ```
228+
229+ ** Common Issues:**
230+ - ** "Timeout exceeded" in before hook** : Mosquitto is not running or not accessible on port 1883
231+ - ** "Cannot find type definition file for 'node'"** : Run ` yarn add -D @types/node `
232+ - ** Electron fails to launch** : Xvfb is not running or DISPLAY variable not set
233+ - ** Tests hang** : Check if old Electron/mosquitto processes are still running and kill them
234+
235+ ** Environment Cleanup:**
236+ ``` bash
237+ # Kill old Electron processes
238+ ps aux | grep electron | grep -v grep | awk ' {print $2}' | xargs kill -9 2> /dev/null
239+
240+ # Kill old mosquitto processes (if running custom instance)
241+ ps aux | grep mosquitto | grep -v grep | awk ' {print $2}' | xargs kill -9 2> /dev/null
242+ ```
243+
191244## MCP Introspection Testing
192245
193246The project supports MCP (Model Context Protocol) for automated testing with Playwright:
0 commit comments