Tauri WebDriver Tests for KG Graph Functionality
This directory contains WebDriver-based tests for the KG (Knowledge Graph) functionality in the Tauri application, using the official Tauri WebDriver support.
Overview
The WebDriver tests provide more accurate testing of the native Tauri application behavior by using the official Tauri WebDriver implementation. This allows testing of:
- Native Tauri Commands: Direct testing of Tauri backend commands
- Real Application Behavior: Testing the actual compiled Tauri app
- Better Integration: More accurate representation of production behavior
- Native Features: Testing of native OS integrations
Prerequisites
- Tauri Driver: Install the Tauri WebDriver
- Dependencies: Install WebDriver dependencies
- Configuration: Ensure WebDriver is enabled in
src-tauri/tauri.conf.json
"plugins": Test Files
1. kg-graph-webdriver.spec.ts
Pure WebDriver test using Selenium WebDriver directly with Tauri driver.
Features:
- Direct WebDriver integration
- Native Tauri app testing
- Comprehensive KG graph functionality validation
- Error handling and recovery testing
2. kg-graph-playwright-webdriver.spec.ts
Playwright test with WebDriver capabilities for Tauri testing.
Features:
- Playwright's modern testing API
- WebDriver integration for Tauri
- Same comprehensive KG graph testing
- Better debugging and reporting
Running the Tests
Basic WebDriver Test
# Run the pure WebDriver test
Playwright WebDriver Test
# Run with Playwright WebDriver config
# Run with UI for debugging
# Run in headed mode
# Run in CI mode
Test Coverage
The WebDriver tests validate the following KG graph functionality:
β Core Functionality
- Tauri app loading and initialization
- Search interface functionality
- Graph navigation and routing
- Graph container rendering
β Graph Visualization
- SVG graph element rendering
- Node and edge display
- Loading states and completion
- Error handling and recovery
β User Interactions
- Node click interactions (left-click and right-click)
- Modal system for document viewing
- KG context information display
- Zoom functionality with mouse wheel
β Search Integration
- Search with KG-related terms
- KG tags in search results
- Tag click interactions
- Document modal integration
β Navigation and Controls
- Navigation between search and graph pages
- Graph controls and information display
- Close buttons and modal management
- Error recovery mechanisms
Configuration Files
playwright.webdriver.config.ts
Playwright configuration specifically for WebDriver tests with:
- Single worker for WebDriver compatibility
- Extended timeouts for Tauri app startup
- WebDriver-specific browser arguments
- CI-friendly settings
setup.ts and teardown.ts
Global setup and teardown for WebDriver tests:
- Tauri driver process management
- Proper cleanup and resource management
Test Results
The tests provide comprehensive validation of KG graph functionality:
π PROVING KG Graph Functionality with WebDriver...
β
Tauri app loaded successfully
β
Search interface is visible
β
Search functionality working
π Testing graph navigation...
β
Successfully navigated to graph page
β
Graph container is visible
β
Graph loaded immediately
β
SVG graph element is visible
π Graph rendered: X nodes, Y edges
π― Testing node interactions...
β
Node click opened modal successfully
β
KG context information displayed
β
Modal closed successfully
π Testing zoom functionality...
β
Zoom functionality working
ποΈ Testing graph controls...
β
Graph controls information is displayed
π Testing navigation back to search...
β
Successfully navigated back to search page
π Testing search with KG terms...
π·οΈ Found X KG tags in search results
β
KG tag click opened document modal
β
KG context information displayed in modal
π KG Graph Functionality WebDriver Test Complete!Advantages of WebDriver Tests
1. Native Testing
- Tests the actual compiled Tauri application
- Validates native OS integrations
- More accurate production behavior simulation
2. Better Integration
- Direct access to Tauri backend commands
- Native window management
- Real file system interactions
3. Comprehensive Coverage
- End-to-end functionality validation
- Error handling and recovery testing
- Performance and stability validation
4. CI/CD Ready
- Headless mode support
- Automated testing capabilities
- Detailed reporting and debugging
Troubleshooting
Common Issues
- Tauri Driver Not Found
-
WebDriver Connection Issues
- Ensure Tauri app is running on correct port
- Check WebDriver plugin is enabled in config
- Verify Chrome/Chromium is installed
-
Test Timeouts
- Increase timeout values in config
- Check system resources
- Verify Tauri app startup time
Debug Mode
# Run with UI for visual debugging
# Run in headed mode to see browser
Integration with CI/CD
The WebDriver tests are designed for CI/CD integration:
# Example GitHub Actions workflow
- name: Run WebDriver Tests
run: |
yarn test:webdriver:ci
env:
CI: trueConclusion
The WebDriver tests provide the most accurate validation of KG graph functionality in the Tauri application context, ensuring that all features work correctly in the native application environment.