Native E2E Testing with WebdriverIO
This directory contains end-to-end tests that run against the actual Tauri desktop application using WebdriverIO and tauri-driver.
Prerequisites
1. Install tauri-driver
cargo install tauri-driver
This installs the WebDriver server that bridges WebdriverIO to Tauri's WebView.
Note: tauri-driver does not support macOS. Use the Appium mac2 harness described below.
2. (Windows only) Install msedgedriver
Tauri on Windows uses WebView2 (Edge-based), which requires Microsoft Edge WebDriver:
- Check your Edge version:
edge://version - Download matching driver from: https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
- Extract
msedgedriver.exeand either:- Add its location to your PATH
- Set
MSEDGEDRIVER_PATHenvironment variable - Place it in your home directory (
C:\Users\YourName\)
3. Install npm dependencies
cd client
npm install
4. Build the Tauri app
npm run tauri:build
The tests require a built binary. Debug builds also work:
cd src-tauri && cargo build
Running Tests
Run all native tests
npm run test:native
Build and test in one command
npm run test:native:build
macOS Native Testing (Appium mac2)
Tauri does not ship a macOS WebDriver server, so native macOS tests use Appium.
Prerequisites (macOS)
- Install Appium 2:
npm install -g appium
- Install the mac2 driver:
appium driver install mac2
- Install Xcode and Command Line Tools, then accept the license:
sudo xcodebuild -license accept
If needed, point CLI tools to Xcode:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
- Enable Developer Mode (System Settings → Privacy & Security → Developer Mode).
You can also enable dev tools access via CLI:
sudo /usr/sbin/DevToolsSecurity -enable
sudo dseditgroup -o edit -a "$(whoami)" -t user _developer
Log out and back in after enabling Developer Mode.
- Enable Automation Mode (required by XCTest UI automation):
sudo automationmodetool enable-automationmode-without-authentication
Approve the system prompt when it appears.
- Grant Accessibility permissions:
- Terminal (or your shell app)
- Xcode Helper (
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/Agents/Xcode Helper.app)
- Build the Tauri app bundle:
npm run tauri:build
- Start Appium:
appium --base-path / --log-level error
Run macOS native tests
npm run test:native:mac
Test Structure
e2e-native/
├── fixtures.ts # Test helpers and utilities
├── app.spec.ts # Core app tests
├── screenshots/ # Failure screenshots
└── README.md # This file
Writing Tests
Tests use WebdriverIO's Mocha framework:
import { waitForAppReady, navigateTo, invokeCommand } from './fixtures';
describe('Feature', () => {
before(async () => {
await waitForAppReady();
});
it('should do something', async () => {
await navigateTo('/settings');
// Direct Tauri IPC
const result = await invokeCommand('get_preferences');
expect(result).toBeDefined();
});
});
Available Fixtures
| Function | Description |
|---|---|
waitForAppReady() |
Wait for React app to mount |
navigateTo(path) |
Navigate to a route |
isTauriAvailable() |
Check if Tauri IPC works |
invokeCommand(cmd, args) |
Call Tauri command directly |
waitForLoadingComplete() |
Wait for spinners to clear |
clickButton(text) |
Click button by text |
fillInput(selector, value) |
Fill an input field |
waitForToast(pattern) |
Wait for toast notification |
takeScreenshot(name) |
Save screenshot |
Comparison: Playwright vs WebdriverIO Native
| Aspect | Playwright (e2e/) | WebdriverIO (e2e-native/) |
|---|---|---|
| Target | Web dev server | Built Tauri app |
| IPC | Mock adapter | Real Rust commands |
| Audio | Not available | Real device access |
| Speed | Fast | Slower (app launch) |
| CI | Easy | Needs Windows runner |
Troubleshooting
"Tauri binary not found"
Build the app first:
npm run tauri:build
"Connection refused" on port 4444
Ensure tauri-driver is installed and no other WebDriver is running on port 4444.
"EPERM" or "Operation not permitted" on localhost ports
Grant Local Network access to your terminal (or the app running tests) in
System Settings → Privacy & Security → Local Network. Also check that no firewall
or network filter blocks 127.0.0.1:4723.
Tests hang on Windows
Check Windows Firewall isn't blocking tauri-driver.exe.
WebView2 not found
Install Microsoft Edge WebView2 Runtime from: https://developer.microsoft.com/en-us/microsoft-edge/webview2/