Tauri is a framework for building tiny, fast binaries for all major desktop and mobile platforms. Developers can integrate any frontend framework that compiles to HTML, JavaScript, and CSS for building their user experience while leveraging languages such as Rust, Swift, and Kotlin for backend logic when needed.
– https://tauri.app/start
Testing Tauri apps with TestDriver
In this guide, we’ll leverage Playwright and the TestDriver Playwright SDK to convert the Tauri Quick Start to TestDriver’s selectorless, Vision AI.View Source:
https://github.com/testdriverai/demo-tauri-app
Requirements
To start testing your Tauri app with TestDriver, you need the following:Create a TestDriver account
Create a TestDriver account
1
Create a TestDriver Account
You will need a TestDriver Pro account ($20/month) to get an API key.
Sign Up for TestDriver
2
Set up your environment
Copy your API key from the TestDriver dashboard, and set it as an environment variable.
Export an environment variable on macOS or Linux systems:
Create a Tauri project
Create a Tauri project
Follow Tauri’s Create a Project
guide.
Create a Playwright project
Create a Playwright project
This is a condensed version of Playwright’s Installation Instructions.If you’re new to Playwright, you should follow their guide first.
Install the TestDriver Playwright SDK
Install the TestDriver Playwright SDK
@testdriver.ai/playwright
is an AI-powered extension of @playwright/test
.Testing the Tauri Web App
Setup
First, we need to modify the default Playwright configuration and our Tauri project to work together:1
Configure Playwright to start the Tauri frontend
In the
playwright.config.ts
file, we’ll configure the webServer
to start the Tauri frontend for Playwright to test against:playwright.config.ts
2
Mock Tauri APIs
Since we’re testing the Tauri frontend, we need to mock IPC Requests
to simulate We only need to do this once, as we’ll be accessing
invoke
calls to the Rust backend:src/index.html
window.mockIPC
in our tests.3
Create a new test file
Create a new file (e.g.
tests/testdriver.spec.ts
) with:tests/testdriver.spec.ts
4
Run Playwright in UI Mode
Now we’re ready to run Playwright and start working on our tests:
Click the button to successfully run the tests in the UI.

Click the button to automatically re-run tests on save.
Usage
Import the TestDriver Playwright SDK
By changing 1 line, we can add TestDriver’s AI capabilities to Playwright:tests/testdriver.spec.ts
toHaveTitle
)
with @testdriver.ai/playwright
.
The test continues to pass as before, so now we can update our test to use natural language instead of selectors.
Assertions with expect.toMatchPrompt
With Playwright, we would normally use a getByRole
selector to assert the heading text:
tests/example.spec.ts
toMatchPrompt
instead:
tests/testdriver.spec.ts
Agentic tests with test.agent
With TestDriver, we can skip the test implementation entirely and let AI perform the test for us:
1
Mock the `greet` call
First, we need to mock our
invoke
calls,
since we’re testing the frontend behavior and not our Tauri backend:tests/testdriver.spec.ts
2
Add an Agentic Test
Next, wrap a prompt in
test.agent
to perform the test:tests/testdriver.spec.ts
Continued Reading
Learn more about TestDriver’s Playwright SDKTesting the Tauri Desktop App
We can use TestDriver and natural language to test our Tauri desktop app:1
Run the Desktop App
2
Continued Reading
See Desktop Apps for more information.
Testing the Tauri Mobile App
We can use TestDriver and natural language to test our Tauri iOS app:1
Run the Mobile App
2
Continued Reading
See Mobile Apps for more information.