Get up and running with WebdriverIO and Tauri E2E testing in minutes.
-
Node.js 18+ - Download from nodejs.org
-
Rust Toolchain - Required for building Tauri apps and tauri-driver
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Tauri CLI - Install globally or as dev dependency
npm install -g @tauri-apps/cli # or cargo install tauri-cli
- Microsoft Visual C++ Build Tools - Download from Microsoft Visual C++
- Edge WebDriver - Auto-managed by the service (see Edge WebDriver Windows)
- WebKitGTK Development Libraries - Install WebKitWebDriver
# Debian/Ubuntu sudo apt-get install -y webkit2gtk-driver # Fedora 40+ sudo dnf install -y webkit2gtk-driver # Arch Linux sudo pacman -S webkit2gtk-4.1 # Void Linux sudo xbps-install -y webkit2gtk-devel
See Platform Support for detailed distribution support information.
✅ Supported - Use the embedded WebDriver provider (driverProvider: 'embedded') for native macOS testing without external dependencies. See Platform Support for details.
npm create tauri-app@latestFollow the prompts and select your preferred frontend framework.
Create a minimal Tauri app:
mkdir my-tauri-app
cd my-tauri-app
# Create frontend (use any framework or plain HTML)
mkdir src
echo '<h1>Hello, Tauri!</h1>' > src/index.html
# Create Rust backend
cargo init --name my_app src-tauri
cd src-tauri
# Add Tauri to Cargo.toml
# [dependencies]
# tauri = { version = "2.9", features = ["shell-open"] }
# tauri-build = "2.0"Create the minimal required files for a Tauri app:
src-tauri/src/main.rs
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
fn main() {
tauri::Builder::default()
.run(tauri::generate_context!())
.expect("error while running tauri application");
}src-tauri/tauri.conf.json
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "my-app",
"version": "0.1.0",
"identifier": "com.mycompany.myapp",
"build": {
"frontendDist": "../src",
"beforeDevCommand": "echo 'dev server running'",
"beforeBuildCommand": "echo 'building frontend'"
},
"app": {
"withGlobalTauri": true,
"windows": [
{
"title": "My App",
"width": 800,
"height": 600
}
]
}
}src-tauri/Cargo.toml - Add:
[dependencies]
tauri = { version = "2.9", features = [] }
tauri-plugin-wdio = { path = "../../packages/tauri-plugin" }
[build-dependencies]
tauri-build = "2.0"src-tauri/build.rs
fn main() {
tauri_build::build()
}-
Already added to Cargo.toml (see above)
-
Register in
src-tauri/src/main.rs
fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_wdio::init()) // Add this line
.run(tauri::generate_context!())
.expect("error while running tauri application");
}- Create
src-tauri/capabilities/default.json
{
"identifier": "default",
"windows": ["main"],
"permissions": [
"core:default",
"core:window:default",
"wdio:default"
]
}- Import frontend plugin in
src/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>My App</title>
</head>
<body>
<h1>Hello, Tauri!</h1>
<!-- Import WebdriverIO Tauri plugin (required for testing) -->
<script type="module">
import '@wdio/tauri-plugin';
</script>
</body>
</html>For detailed plugin setup and troubleshooting, see Plugin Setup.
# Build for release (required for testing with WebdriverIO)
cd src-tauri
cargo build --releaseOn macOS/Linux, you'll also need to give the app executable permissions:
chmod +x target/release/my_app # Linux/macOS
# or on Windows:
# target\release\my_app.exenpm install --save-dev @wdio/cli @wdio/tauri-serviceUse the WebdriverIO CLI setup wizard:
npx wdio configOr manually create wdio.conf.ts:
export const config = {
runner: 'local',
specs: ['./test/specs/**/*.spec.ts'],
maxInstances: 1,
// Tauri service configuration
services: [['@wdio/tauri-service', {
appBinaryPath: './src-tauri/target/release/my-app.exe', // Adjust for your OS/app name
driverProvider: 'embedded', // Use embedded WebDriver (recommended, no external drivers needed)
// driverProvider: 'official', // Use external tauri-driver (explicit opt-in)
// driverProvider: 'crabnebula', // Use CrabNebula (requires paid API key)
}]],
// Capabilities
capabilities: [{
browserName: 'tauri',
'tauri:options': {
application: './src-tauri/target/release/my-app.exe', // Path to built binary
},
}],
// Logging
logLevel: 'info',
bail: 0,
baseUrl: 'http://localhost:4444',
waitforTimeout: 10000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
// Test configuration
framework: 'mocha',
mochaOpts: {
ui: 'bdd',
timeout: 60000,
},
};Create test/specs/example.spec.ts:
describe('My Tauri App', () => {
it('should display hello world', async () => {
// Wait for the app to fully load
await browser.pause(500);
// Find and check a heading
const heading = await browser.$('h1');
expect(await heading.getText()).toBe('Hello, Tauri!');
});
it('should execute Tauri commands', async () => {
// Execute JavaScript in the Tauri frontend context with access to Tauri APIs
const result = await browser.tauri.execute(({ core }) => {
return core.invoke('get_platform_info');
});
console.log('Platform info:', result);
});
it('should mock Tauri commands', async () => {
// Mock a Tauri command
const mock = await browser.tauri.mock('get_user');
await mock.mockReturnValue({ id: 1, name: 'Test User' });
// Execute code that uses the mocked command
const user = await browser.tauri.execute(({ core }) => {
return core.invoke('get_user');
});
expect(user).toEqual({ id: 1, name: 'Test User' });
});
});npx wdio run wdio.conf.tsnpx wdio run wdio.conf.ts --spec test/specs/example.spec.tsnpx wdio run wdio.conf.ts --watchnpx wdio run wdio.conf.ts --logLevel debugThe frontend plugin import is failing. Make sure:
-
Install the peer dependencies:
npm install --save-dev @wdio/tauri-plugin
-
The import is in your HTML/JS entry point before tests run
The service couldn't determine which driver to use, or couldn't find tauri-driver. Solutions:
-
Use embedded provider (no external driver needed):
driverProvider: 'embedded'Requires
tauri-plugin-wdio-webdriverin your Tauri app. On macOS this is auto-detected. -
Install tauri-driver manually (if using
driverProvider: 'official'):cargo install tauri-driver
-
Or enable auto-install in
wdio.conf.ts:driverProvider: 'official', autoInstallTauriDriver: true
The appBinaryPath is wrong. Verify:
- You built the app in release mode:
cargo build --release - The path exists:
./src-tauri/target/release/my-app.exe - Update the path in
wdio.conf.tsif needed
Edge WebDriver version mismatch. The service auto-manages this, but if issues persist:
- See Edge WebDriver (Windows)
- Check your Edge version: Settings → About Microsoft Edge
- Verify the driver version matches
Make sure you're using browserName: 'tauri' in capabilities, not other browsers.
- Add more tests - See Usage Examples for patterns
- Advanced features - Read about Mocking and Logging
- Configure the service - See Configuration for all options
- Debug issues - Check Troubleshooting
it('should call custom commands', async () => {
const result = await browser.tauri.execute(({ core }) => {
return core.invoke('my_custom_command', { param: 'value' });
});
expect(result).toBeDefined();
});Enable log capture in wdio.conf.ts:
services: [['@wdio/tauri-service', {
captureBackendLogs: true,
captureFrontendLogs: true,
backendLogLevel: 'debug',
frontendLogLevel: 'debug',
}]],Run multiple instances of your app:
capabilities: [
{
browserName: 'tauri',
'tauri:options': {
application: './src-tauri/target/release/my-app.exe',
},
},
{
browserName: 'tauri',
'tauri:options': {
application: './src-tauri/target/release/my-app.exe',
},
},
],Example GitHub Actions workflow:
name: E2E Tests
on: [push, pull_request]
jobs:
test:
runs-on: windows-latest # or ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: npm install
- name: Build Tauri app
run: npm run tauri build
- name: Run tests
run: npm run test:e2e