This document describes how to run and debug mobile UI tests for MQTT Explorer.
The mobile tests simulate MQTT Explorer running in a mobile browser (Google Pixel 6 viewport: 412x914px) and generate demo videos showing the mobile user experience.
sudo apt-get install -y ffmpeg tmux xvfb x11vnc mosquittoyarn install
npx playwright install --with-deps chromiumyarn build:server # For browser mode./scripts/uiTestsMobile.shThis will:
- Start Xvfb (virtual framebuffer)
- Start mosquitto MQTT broker
- Start MQTT Explorer server in browser mode
- Run Playwright tests with mobile viewport
- Record video of the test session
./scripts/prepareVideoMobile.shThis converts the raw video to MP4 and GIF formats and creates individual segments for each test scene.
ui-test-mobile.mp4- Full mobile test video (MP4)ui-test-mobile.gif- Full mobile test video (GIF)segment-mobile-*.gif- Individual scene segmentsscenes-mobile.json- Scene timing metadata
All video files are automatically excluded from git (see .gitignore).
During test execution, you can connect with VNC to watch in real-time:
# Password: bierbier
vncviewer localhost:5900Error: Executable doesn't exist at .../chromium_headless_shell-1200/chrome-headless-shell
Solution:
npx playwright install --with-deps chromiumError: height not divisible by 2
Solution: Ensure viewport height is even. Mobile viewport is set to 412x914 (not 915).
Error: element is outside of the viewport
Solution: The fix adds scrollIntoViewIfNeeded() before clicking elements. For modal/dialog elements that intercept clicks, use force: true.
Error: Address already in use on port 1883
Solution: Kill existing mosquitto process:
pkill mosquittoThe tests revealed several mobile UI improvements that were implemented:
Added responsive CSS to ConnectionSetup.tsx:
- Mobile viewports use 95vw width and 85vh height
- Enabled scrolling on the right panel
- Hide profile list on mobile to save space
Enhanced clickOn helper in util/index.ts:
- Added
scrollIntoViewIfNeeded()to ensure elements are in viewport - Support for
force: trueto bypass overlay elements
Updated expandTopic helper:
- Use
force: truefor tree clicks to bypass accordion overlays - Better handling of nested topic expansion
The mobile demo includes these scenes:
- mobile_intro - Introduction screen
- mobile_connect - Connect to MQTT broker
- mobile_browse_topics - Browse topic tree
- mobile_search - Search and filter topics
- mobile_view_message - View message details
- mobile_json_view - JSON formatting display
- mobile_clipboard - Copy operations
- mobile_plots - Numeric data visualization
- mobile_menu - Settings and menu
- mobile_end - Conclusion screen
Mobile tests run in the demo-video-mobile job in .github/workflows/tests.yml:
demo-video-mobile:
runs-on: ubuntu-latest
container:
image: ghcr.io/thomasnordquist/mqtt-explorer-ui-tests:latest
steps:
- name: Generate Mobile Demo Video
run: ./scripts/uiTestsMobile.sh
- name: Post-processing
run: ./scripts/prepareVideoMobile.shVideos are uploaded to S3 and linked in PR comments.
- Width: 412px (Pixel 6)
- Height: 914px (must be even for h264 encoding)
- Device Scale Factor: 2.625
- Mobile Mode: Enabled with touch events
- Raw video: YUV420P format
- Frame rate: 20 fps
- Recording tool: ffmpeg via tmux
- MP4 encoding: h264 codec
- GIF palette: 256 colors optimized per segment
- Segment creation: Based on scene timing in
scenes-mobile.json
Potential areas for enhancement:
- Touch Gestures - Add swipe and pinch interactions
- Performance - Optimize for slower mobile networks
- Accessibility - Larger touch targets, better contrast
- PWA Support - Add manifest for "add to home screen"
- Orientation - Test landscape mode
- MOBILE_COMPATIBILITY.md - Mobile compatibility strategy
- Playwright Device Emulation
- Material-UI Responsive Design