TestDriver is the only testing platform that lets you test web applications, desktop apps, browser extensions, and IDE extensions with the same simple API.
Test Anything
One SDK, unlimited testing possibilities:
Web Applications Test any website or web application
Desktop Applications Windows, macOS, and Linux native apps
Chrome Extensions Browser extensions and add-ons
VS Code Extensions IDE extensions and plugins
Electron Apps Cross-platform Electron applications
Mobile Apps Android and iOS applications (beta)
Web Applications
Test any website with the Chrome preset:
import { test } from 'vitest' ;
import { chrome } from 'testdriverai/presets' ;
test ( 'web application test' , async ( context ) => {
const { testdriver } = await chrome ( context , {
url: 'https://myapp.com' ,
maximized: true ,
guest: true , // Incognito mode
os: 'linux'
});
await testdriver . find ( 'Login button' ). click ();
await testdriver . find ( 'email input' ). type ( '[email protected] ' );
await testdriver . find ( 'password input' ). type ( 'secret' , { secret: true });
await testdriver . find ( 'Submit' ). click ();
await testdriver . assert ( 'Dashboard is visible' );
});
Chrome Preset Documentation Complete guide to testing web applications
Desktop Applications
Test native desktop applications on any platform:
import { desktop } from 'testdriverai/presets' ;
test ( 'windows app' , async ( context ) => {
const { testdriver } = await desktop ( context , {
appPath: 'C: \\ Program Files \\ MyApp \\ MyApp.exe' ,
os: 'windows'
});
await testdriver . find ( 'File menu' ). click ();
await testdriver . find ( 'New Document' ). click ();
await testdriver . assert ( 'New document window is open' );
});
Chrome Extensions
Test browser extensions in their natural environment:
import { test } from 'vitest' ;
import { chromeExtension } from 'testdriverai/presets' ;
test ( 'chrome extension' , async ( context ) => {
const { testdriver } = await chromeExtension ( context , {
extensionPath: './my-extension' ,
url: 'https://example.com'
});
// Test extension popup
await testdriver . find ( 'extension icon in toolbar' ). click ();
await testdriver . find ( 'Settings button in popup' ). click ();
// Test extension functionality
await testdriver . find ( 'Enable feature checkbox' ). click ();
await testdriver . assert ( 'Feature is enabled message appears' );
// Test on web page
await testdriver . find ( 'extension-injected content on page' ). click ();
await testdriver . assert ( 'Extension content is visible' );
});
Chrome Extension Guide Complete extension testing documentation
VS Code Extensions
Test IDE extensions with the VS Code preset:
import { test } from 'vitest' ;
import { vscode } from 'testdriverai/presets' ;
test ( 'vscode extension' , async ( context ) => {
const { testdriver } = await vscode ( context , {
workspace: '/tmp/test-project' ,
extensions: [ 'ms-python.python' , 'dbaeumer.vscode-eslint' ]
});
// Open command palette
await testdriver . pressKeys ([ 'cmd' , 'shift' , 'p' ]);
await testdriver . type ( 'Python: Create New File' );
await testdriver . pressKeys ([ 'enter' ]);
// Verify extension behavior
await testdriver . assert ( 'Untitled Python file is open' );
await testdriver . assert ( 'Python extension is active' );
// Test extension commands
await testdriver . type ( 'print("Hello World")' );
await testdriver . pressKeys ([ 'cmd' , 's' ]); // Save
await testdriver . find ( 'filename input' ). type ( 'test.py' );
await testdriver . pressKeys ([ 'enter' ]);
await testdriver . assert ( 'test.py is saved' );
});
VS Code Preset Guide Complete VS Code extension testing
Electron Applications
Test Electron apps with specialized support:
import { test } from 'vitest' ;
import { electron } from 'testdriverai/presets' ;
test ( 'electron app' , async ( context ) => {
const { app } = await electron ( context , {
appPath: './dist/my-electron-app' ,
args: [ '--debug' ]
});
// Test native menu
await app . find ( 'File menu' ). click ();
await app . find ( 'New Window' ). click ();
// Test application UI
await app . find ( 'sidebar toggle' ). click ();
await app . assert ( 'sidebar is collapsed' );
// Test window interactions
await app . pressKeys ([ 'cmd' , 'w' ]); // Close window
await app . assert ( 'window is closed' );
});
Electron Preset Guide Complete Electron testing documentation
Run the same test across multiple platforms:
import { test } from 'vitest' ;
import { desktop } from 'testdriverai/presets' ;
const platforms = [ 'linux' , 'mac' , 'windows' ];
platforms . forEach (( os ) => {
test ( `app works on ${ os } ` , async ( context ) => {
const { testdriver } = await desktop ( context , {
appPath: getAppPathForOS ( os ),
os
});
await testdriver . find ( 'File menu' ). click ();
await testdriver . find ( 'New Document' ). click ();
await testdriver . assert ( 'New document is created' );
});
});
function getAppPathForOS ( os ) {
switch ( os ) {
case 'windows' : return 'C: \\ Program Files \\ MyApp \\ MyApp.exe' ;
case 'mac' : return '/Applications/MyApp.app' ;
case 'linux' : return '/usr/bin/myapp' ;
}
}
Multiple Applications
Test interactions between multiple applications:
test ( 'cross-app workflow' , async ( context ) => {
// Start VS Code
const { testdriver : vscode } = await vscode ( context , {
workspace: '/tmp/project'
});
await vscode . type ( '// TODO: Implement feature' );
await vscode . pressKeys ([ 'cmd' , 's' ]);
// Switch to browser
const { testdriver : chrome } = await chrome ( context , {
url: 'https://jira.company.com'
});
await chrome . find ( 'Create issue button' ). click ();
await chrome . find ( 'Summary input' ). type ( 'Implement feature' );
await chrome . find ( 'Submit' ). click ();
// Switch back to VS Code
await vscode . focusApplication ( 'VS Code' );
await vscode . assert ( 'TODO comment is visible' );
});
Advanced Interactions
TestDriver handles complex interaction patterns:
const element = await testdriver . find ( 'draggable item' );
await element . mouseDown ();
await testdriver . hover ( 500 , 300 ); // Drag to position
await testdriver . mouseUp (); // Drop
await testdriver . assert ( 'Item is in new position' );
// Multi-key combinations
await testdriver . pressKeys ([ 'ctrl' , 'shift' , 'p' ]);
// Platform-specific shortcuts
const modKey = os === 'mac' ? 'cmd' : 'ctrl' ;
await testdriver . pressKeys ([ modKey , 'c' ]); // Copy
await testdriver . pressKeys ([ modKey , 'v' ]); // Paste
await testdriver . find ( 'file upload button' ). click ();
// Type file path in dialog
await testdriver . type ( '/path/to/file.pdf' );
await testdriver . pressKeys ([ 'enter' ]);
await testdriver . assert ( 'File is uploaded' );
Execute Custom Code
Run JavaScript or PowerShell for advanced scenarios:
JavaScript (Browser)
PowerShell (Windows)
Bash (Linux/Mac)
// Execute code in browser context
const title = await testdriver . exec ( 'js' , 'document.title' , 5000 );
console . log ( 'Page title:' , title );
// Modify DOM
await testdriver . exec ( 'js' , `
document.querySelector('#username').value = 'testuser';
document.querySelector('#submit').click();
` , 5000 );
// Extract data
const items = await testdriver . exec ( 'js' , `
Array.from(document.querySelectorAll('.item'))
.map(el => el.textContent)
` , 5000 );
Mobile Applications (Beta)
TestDriver supports mobile app testing:
import { android } from 'testdriverai/presets' ;
test ( 'android app' , async ( context ) => {
const { testdriver } = await android ( context , {
appPath: './app.apk' ,
device: 'Pixel 7'
});
await testdriver . find ( 'Login button' ). click ();
await testdriver . find ( 'username field' ). type ( '[email protected] ' );
await testdriver . find ( 'password field' ). type ( 'secret' , { secret: true });
await testdriver . find ( 'Submit' ). click ();
await testdriver . assert ( 'Home screen is visible' );
});
Mobile testing is in beta. Contact sales for early access.
Real-World Example
Here’s a complex cross-platform test:
test ( 'full application workflow' , async ( context ) => {
// Test web application
const { testdriver : web } = await chrome ( context , {
url: 'https://myapp.com'
});
await web . find ( 'Export data button' ). click ();
await web . find ( 'Download as CSV' ). click ();
await web . assert ( 'Download started notification' );
// Test desktop application
const { testdriver : desktop } = await desktop ( context , {
appPath: '/Applications/MyApp.app' ,
os: 'mac'
});
await desktop . find ( 'Import button' ). click ();
await desktop . find ( 'Select file button' ). click ();
await desktop . type ( '~/Downloads/export.csv' );
await desktop . pressKeys ([ 'enter' ]);
await desktop . assert ( 'Import successful message' );
// Test VS Code extension
const { testdriver : vscode } = await vscode ( context , {
workspace: '/tmp/project' ,
extensions: [ 'mycompany.myapp-extension' ]
});
await vscode . pressKeys ([ 'cmd' , 'shift' , 'p' ]);
await vscode . type ( 'MyApp: Sync Data' );
await vscode . pressKeys ([ 'enter' ]);
await vscode . assert ( 'Data synced successfully' );
});
Learn More