Plugin Setup
Overview
The tauri-plugin-wdio is a required Tauri plugin that enables WebdriverIO testing of Tauri applications. It provides:
- Execute API - Run JavaScript code from tests with access to Tauri APIs
- Mocking Support - Mock Tauri backend commands for isolated testing
- Log Forwarding - Capture console logs from both frontend and backend
- Invoke Interception - Enable mocking without backend command modifications
Two WDIO Plugins
There are two Tauri plugins for WebdriverIO testing:
| Plugin | Package | Purpose | Required |
|---|---|---|---|
tauri-plugin-wdio | Rust + JS | Execute API, mocking, log forwarding | Yes |
tauri-plugin-wdio-webdriver | Rust only | Embedded WebDriver server | Only for embedded provider |
When You Need Each
-
tauri-plugin-wdio- Always required for:- Executing JavaScript in the frontend (
browser.tauri.execute()) - Mocking Tauri commands (
browser.tauri.mock()) - Capturing frontend and backend logs
- Executing JavaScript in the frontend (
-
tauri-plugin-wdio-webdriver- Required when using the embedded driver provider:- Provides built-in WebDriver HTTP server
- Eliminates need for external tauri-driver
- Enables native macOS testing without CrabNebula
- Auto-detected on macOS; signal via
TAURI_WEBDRIVER_PORTon Windows/Linux
Why Is It Required?
The @wdio/tauri-service explicitly checks for the plugin and will fail if it's not available:
Error: Tauri plugin not available. Make sure @wdio/tauri-plugin is installed and registered in your Tauri app.
What Works Without the Plugin
Only basic WebDriver operations work without the plugin:
- Element interactions (click, type, etc.)
- Navigation and page access
- Basic WebDriver commands
What Requires the Plugin
All advanced testing features require the plugin:
- ✅
browser.tauri.execute()- Execute JavaScript with Tauri APIs - ✅
browser.tauri.mock()- Mock backend commands - ✅ All mocking operations
- ✅ Console log capture
- ✅ Backend log forwarding