testing-tauri-apps

Guides unit, mock, and WebDriver end-to-end testing of Tauri v2 applications.

Updated Jun 7, 2026
One-click install
npx skills add https://github.com/dt418/better-shot-x --skill testing-tauri-apps-dt418
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-tauri-apps
Source: https://github.com/dt418/better-shot-x/tree/main/.agents/skills/testing-tauri-apps
Command: npx skills add https://github.com/dt418/better-shot-x --skill testing-tauri-apps-dt418

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Testing Tauri desktop applications is difficult because they combine a Rust backend with a webview frontend, and standard web testing tools cannot drive the native webview. This Skill provides concrete patterns for mocking Tauri IPC APIs in unit tests and running real end-to-end tests through the WebDriver protocol. ## Core Features & Use Cases - Mock-Based Unit Testing: Use @tauri-apps/api/mocks with Vitest to simulate IPC commands, events, sidecar processes, and multi-window state without launching a native webview. - WebDriver E2E Testing: Configure tauri-driver with WebdriverIO or Selenium to automate the real application binary on Linux and Windows. - CI Integration: Ready-to-adapt GitHub Actions workflow covering dependency installation, headless execution with xvfb-run, and a Linux/Windows test matrix. - Use Case: You are building a Tauri 2 desktop app and want to verify that clicking a button invokes a Rust command and updates the UI. Use this Skill to write a Vitest mock test for the IPC layer and a WebdriverIO spec that clicks the real button in the built application. ## Quick Start Set up Vitest with @tauri-apps/api/mocks to unit test my Tauri commands, then configure tauri-driver with WebdriverIO for end-to-end tests.

Frequently Asked Questions about testing-tauri-apps

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I mock Tauri API calls in unit tests?

Use the mockIPC function from @tauri-apps/api/mocks to intercept invoke calls and return simulated responses in Vitest. Call clearMocks in afterEach to prevent state leakage, and mock window.__TAURI_INTERNALS__ in your test setup file.

How do I run end-to-end tests on a Tauri application?

Install tauri-driver via cargo, then connect WebdriverIO or Selenium to it on port 4444 with the browserName set to wry and the application path in tauri:options. Build the app binary first, and use xvfb-run for headless Linux execution.

WebdriverIO vs Selenium for Tauri testing?

Both connect to tauri-driver over the WebDriver protocol. WebdriverIO offers a managed test runner with built-in element waiting, while Selenium with Mocha gives lower-level control through the standard WebDriver client API.

Does Tauri WebDriver testing work on macOS?

No, macOS is not supported for WebDriver testing because WKWebView lacks WebDriver tooling. Tauri WebDriver tests run on Windows via Microsoft Edge Driver and on Linux via WebKitWebDriver.

Why does my Tauri WebDriver test fail to connect in CI?

Connection failures usually come from a missing webkit2gtk-driver on Linux, a mismatched Edge Driver version on Windows, or tauri-driver not listening on port 4444. On Linux CI runners, prefix test commands with xvfb-run for headless display support.