Quick Start
Get up and running with WebdriverIO and Dioxus E2E testing in minutes.
Prerequisites
Required Software
-
Node.js 18+ - Download from nodejs.org
-
Rust Toolchain - Required for building Dioxus apps
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Platform-Specific Requirements
Windows
- Microsoft Visual C++ Build Tools - Download from Microsoft Visual C++
- The
'embedded'provider (recommended) requires no additional setup. - The
'external'provider requireswdio-dioxus-driverand msedgedriver — see Edge WebDriver (Windows).
Linux
- WebKitGTK Development Libraries - Required to build Dioxus desktop apps:
# Debian/Ubuntu
sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev
# Fedora
sudo dnf install -y webkit2gtk4.1-devel gtk3-devel
# Arch Linux
sudo pacman -S webkit2gtk-4.1 gtk3
The 'embedded' provider is the only supported provider on Linux in v1. 'external' is blocked pending an upstream Dioxus PR — see Platform Support.
macOS
✅ Supported - Use the embedded WebDriver provider (driverProvider: 'embedded', the default) for native macOS testing without external dependencies. 'external' is not supported on macOS. See Platform Support for details.
Setting Up a Dioxus App
Create a Minimal Dioxus Desktop App
mkdir my-dioxus-app
cd my-dioxus-app
cargo init --name my_app
Edit Cargo.toml:
[package]
name = "my_app"
version = "0.1.0"
edition = "2021"
[dependencies]
dioxus = { version = "0.6", features = ["desktop"] }
wdio-dioxus-bridge = "1"
Edit src/main.rs:
use dioxus::prelude::*;
fn main() {
let mut config = dioxus::desktop::Config::new();
#[cfg(debug_assertions)]
{
config = wdio_dioxus_bridge::install(config);
}
dioxus::LaunchBuilder::desktop().with_cfg(config).launch(App);
}
#[component]
fn App() -> Element {
rsx! {
h1 { "Hello, Dioxus!" }
}
}
Bridge Setup
The wdio-dioxus-bridge crate is required for testing — it enables browser.dioxus.execute(), mocking, and log capture.
The #[cfg(debug_assertions)] guard ensures the bridge is compiled out of release builds. See Bridge Setup for the full rationale and setup options.
Building the Dioxus App
# Build for testing (debug build, bridge is active)
cargo build
# Or release build (bridge compiled out, for production)
cargo build --release
The debug binary is at:
target/debug/my_app(Linux/macOS)target\debug\my_app.exe(Windows)
WebdriverIO Installation
1. Install WebdriverIO
npm install --save-dev @wdio/cli @wdio/dioxus-service
2. Create Configuration
Create wdio.conf.ts:
export const config = {
runner: 'local',
specs: ['./test/specs/**/*.spec.ts'],
maxInstances: 1,
services: [['@wdio/dioxus-service', {
driverProvider: 'embedded', // Recommended on all platforms
}]],
capabilities: [{
browserName: 'dioxus',
'dioxus:options': {
application: './target/debug/my_app', // Path to debug binary
},
}],
logLevel: 'info',
waitforTimeout: 10000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
framework: 'mocha',
mochaOpts: {
ui: 'bdd',
timeout: 60000,
},
};
3. Create a Test
Create test/specs/example.spec.ts:
describe('My Dioxus App', () => {
it('should display hello world', async () => {
await browser.pause(500);
const heading = await browser.$('h1');
expect(await heading.getText()).toBe('Hello, Dioxus!');
});
it('should execute Dioxus commands', async () => {
const mock = await browser.dioxus.mock('get_platform_info');
await mock.mockReturnValue({ platform: 'linux', arch: 'x86_64' });
const result = await browser.dioxus.execute(({ invoke }) => {
return invoke('get_platform_info');
});
expect(result).toHaveProperty('platform');
});
it('should mock Dioxus commands', async () => {
const mock = await browser.dioxus.mock('get_user');
await mock.mockReturnValue({ id: 1, name: 'Test User' });
const user = await browser.dioxus.execute(({ invoke }) => {
return invoke('get_user');
});
expect(user).toEqual({ id: 1, name: 'Test User' });
});
});
Running Tests
Run All Tests
npx wdio run wdio.conf.ts
Run Specific Test File
npx wdio run wdio.conf.ts --spec test/specs/example.spec.ts
Run with Debug Logging
npx wdio run wdio.conf.ts --logLevel debug
Troubleshooting
"Bridge not available" or execute returns undefined
The wdio-dioxus-bridge crate is not wired into your app. Make sure:
-
Add to
[dependencies]inCargo.toml:wdio-dioxus-bridge = "1" -
Call
wdio_dioxus_bridge::install(config)inmain.rsinside a#[cfg(debug_assertions)]block. -
Build in debug mode (
cargo build, notcargo build --release).
"Application not found at path"
The appBinaryPath or dioxus:options.application is wrong. Verify:
- You built the app:
cargo build - The path exists:
./target/debug/my_app - Update the path in
wdio.conf.tsif needed
Tests timeout on Windows ('external' provider)
Edge WebDriver version mismatch. See Edge WebDriver (Windows).
Linux: "external provider not supported"
'external' is blocked on Linux in v1. Use driverProvider: 'embedded' instead.
Next Steps
- Add more tests - See Usage Examples for patterns
- Advanced features - Read about Mocking and Log Forwarding
- Configure the service - See Configuration for all options
- Debug issues - Check Troubleshooting