| name | tauri-mcp-testing |
| description | E2E testing expert for Tauri applications using Tauri MCP server. Use when testing running Tauri apps - session management, webview interaction, IPC verification, screenshot capture, and debugging. ALWAYS use tauri_* tools, NEVER Chrome DevTools MCP for Tauri apps. |
Tauri MCP E2E Testing
CRITICAL: For E2E testing of Tauri applications, ALWAYS use tauri_* MCP tools. NEVER use Chrome DevTools MCP - that's for browser pages only.
Quick Reference
| Task | MCP Tool |
|---|
| Connect to app | tauri_driver_session |
| Take screenshot | tauri_webview_screenshot |
| Find elements | tauri_webview_find_element |
| Click/scroll/swipe | tauri_webview_interact |
| Type text | tauri_webview_keyboard |
| Wait for element | tauri_webview_wait_for |
| Execute JS | tauri_webview_execute_js |
| Get CSS styles | tauri_webview_get_styles |
| Test IPC commands | tauri_ipc_execute_command |
| Monitor IPC calls | tauri_ipc_monitor |
| Read console logs | tauri_read_logs |
| Manage windows | tauri_manage_window |
Prerequisites
- MCP Bridge Plugin installed in the Tauri app
- App running in development mode (
pnpm tauri dev)
- Port 9223 accessible (default MCP Bridge port)
If connection fails, run tauri_get_setup_instructions to get plugin installation guide.
Core Workflow
1. START SESSION → Connect to running Tauri app
2. VERIFY STATE → Screenshot + find elements
3. INTERACT → Click, type, scroll
4. WAIT → Wait for expected results
5. VERIFY → Check IPC, logs, DOM state
6. CLEANUP → Stop session when done
Session Management
Start Session
tauri_driver_session({ action: 'start' })
tauri_driver_session({ action: 'start', port: 9224 })
tauri_driver_session({ action: 'start', host: '<device-ip>', port: 9223 })
Check Status
tauri_driver_session({ action: 'status' })
Stop Session
tauri_driver_session({ action: 'stop' })
tauri_driver_session({ action: 'stop', appIdentifier: 9223 })
Testing Patterns
Pattern 1: Visual Verification
tauri_webview_screenshot()
tauri_webview_screenshot({ uid: 'editor-content' })
tauri_webview_screenshot({ filePath: 'dev-docs/archive/test-screenshots/test-screenshot.png' })
Pattern 2: Element Interaction
tauri_webview_find_element({ selector: '.save-button' })
tauri_webview_interact({ action: 'click', selector: '.save-button' })
tauri_webview_interact({ action: 'double-click', selector: '.editor' })
tauri_webview_interact({ action: 'long-press', selector: '.item', duration: 500 })
tauri_webview_interact({ action: 'scroll', selector: '.content', scrollY: 500 })
tauri_webview_interact({
action: 'swipe',
fromX: 300, fromY: 400,
toX: 100, toY: 400,
duration: 300
})
Pattern 3: Keyboard Input
tauri_webview_keyboard({
action: 'type',
selector: '.editor-input',
text: '# Hello World'
})
tauri_webview_keyboard({ action: 'press', key: 'Enter' })
tauri_webview_keyboard({
action: 'press',
key: 's',
modifiers: ['Control']
})
tauri_webview_keyboard({
action: 'press',
key: 'z',
modifiers: ['Meta', 'Shift']
})
Pattern 4: Wait for State
tauri_webview_wait_for({
type: 'selector',
value: '.success-toast',
timeout: 5000
})
tauri_webview_wait_for({
type: 'text',
value: 'File saved successfully',
timeout: 3000
})
tauri_webview_wait_for({
type: 'ipc-event',
value: 'file-saved',
timeout: 5000
})
Pattern 5: IPC Testing
tauri_ipc_monitor({ action: 'start' })
tauri_webview_interact({ action: 'click', selector: '.save-button' })
tauri_ipc_get_captured({ filter: 'save_file' })
tauri_ipc_execute_command({
command: 'get_document_state',
args: { id: 'doc-123' }
})
tauri_ipc_emit_event({
eventName: 'file-changed',
payload: { path: '/test/file.md' }
})
tauri_ipc_monitor({ action: 'stop' })
Pattern 6: JavaScript Execution
tauri_webview_execute_js({
script: '(() => { return document.querySelector(".editor").textContent; })()'
})
tauri_webview_execute_js({
script: '(() => { return typeof window.__TAURI__ !== "undefined"; })()'
})
tauri_webview_execute_js({
script: '(() => { return getComputedStyle(document.body).backgroundColor; })()'
})
tauri_webview_execute_js({
script: 'document.dispatchEvent(new CustomEvent("test-event", { detail: { test: true } }))'
})
Debugging
Read Console Logs
tauri_read_logs({ source: 'console', lines: 50 })
tauri_read_logs({ source: 'console', filter: 'error', lines: 100 })
tauri_read_logs({
source: 'console',
since: '2024-01-01T10:00:00Z',
lines: 50
})
Platform-Specific Logs
tauri_read_logs({ source: 'system', lines: 100 })
tauri_read_logs({ source: 'android', filter: 'vmark', lines: 100 })
tauri_read_logs({ source: 'ios', lines: 100 })
Window Management
tauri_manage_window({ action: 'list' })
tauri_manage_window({ action: 'info', windowId: 'main' })
tauri_manage_window({ action: 'resize', width: 800, height: 600 })
tauri_manage_window({
action: 'resize',
windowId: 'settings',
width: 400,
height: 300
})
Get CSS Styles
tauri_webview_get_styles({ selector: '.editor' })
tauri_webview_get_styles({
selector: '.editor',
properties: ['font-size', 'color', 'background-color']
})
tauri_webview_get_styles({
selector: '.toolbar button',
multiple: true,
properties: ['opacity', 'visibility']
})
Common Test Scenarios
Scenario: File Operations
tauri_driver_session({ action: 'start' })
tauri_webview_keyboard({ action: 'press', key: 'o', modifiers: ['Control'] })
tauri_ipc_monitor({ action: 'start' })
tauri_ipc_get_captured({ filter: 'read_file' })
tauri_webview_find_element({ selector: '.editor-content' })
tauri_webview_execute_js({
script: '(() => { return document.querySelector(".editor-content").textContent.length > 0; })()'
})
Scenario: Editor Typing
tauri_webview_interact({ action: 'click', selector: '.editor' })
tauri_webview_keyboard({
action: 'type',
selector: '.editor [contenteditable]',
text: '# Test Document\n\nThis is a test.'
})
tauri_webview_find_element({ selector: '[data-dirty="true"]' })
tauri_webview_keyboard({ action: 'press', key: 's', modifiers: ['Control'] })
tauri_webview_wait_for({ type: 'selector', value: '[data-dirty="false"]' })
Scenario: Responsive Testing
tauri_manage_window({ action: 'resize', width: 375, height: 667 })
tauri_webview_screenshot({ filePath: 'dev-docs/archive/test-screenshots/mobile.png' })
tauri_webview_find_element({ selector: '.mobile-menu-button' })
tauri_manage_window({ action: 'resize', width: 768, height: 1024 })
tauri_webview_screenshot({ filePath: 'dev-docs/archive/test-screenshots/tablet.png' })
tauri_manage_window({ action: 'resize', width: 1920, height: 1080 })
tauri_webview_screenshot({ filePath: 'dev-docs/archive/test-screenshots/desktop.png' })
Troubleshooting
| Issue | Solution |
|---|
| Connection refused | Ensure app is running with pnpm tauri dev |
| No elements found | Check selector, take screenshot to verify DOM |
| IPC not captured | Start monitor BEFORE the action |
| Timeout on wait | Increase timeout, check if element ever appears |
| JS returns undefined | Use IIFE syntax: (() => { return value; })() |
| Plugin not found | Run tauri_get_setup_instructions |
Reference Files
Related Skills
tauri-app-dev — General Tauri 2.0 patterns (commands, state, plugins, security)
tauri-v2-integration — VMark-specific IPC patterns (invoke/emit bridges, menu accelerators)
rust-tauri-backend — VMark Rust backend implementation