Skip to content

Comments

feat(tauri): add embedded WebDriver provider support#166

Open
goosewobbler wants to merge 58 commits intomainfrom
feat/embedded-webdriver
Open

feat(tauri): add embedded WebDriver provider support#166
goosewobbler wants to merge 58 commits intomainfrom
feat/embedded-webdriver

Conversation

@goosewobbler
Copy link
Contributor

@goosewobbler goosewobbler commented Feb 17, 2026

Closes #159 & #93

TODO:

  • fix tauri-driver e2es
  • fix standalone
  • fix webdriver execute error
  • fix embedded driver logging
  • fix windows edgedriver mismatch
  • fix multiremote logfile error
  • fix deeplink errors
  • do we need package tests for embedded?
  • decide on shipping forked embed plugin vs. getting fixes merged & released to the upstream repo
  • docs

- Introduced a new DRIVER_PROVIDER option in the environment schema to support 'embedded' WebDriver server.
- Updated TauriServiceOptions and related interfaces to include 'embedded' as a valid driver provider.
- Implemented embedded WebDriver functionality in the TauriLaunchService, allowing for direct app spawning without external drivers.
- Enhanced multiremote capabilities to support unique embedded ports for each instance.
- Added methods for starting and stopping the embedded driver, along with status polling for readiness.
- Updated documentation to reflect the new embedded provider option and its usage.
- Introduced a new reusable workflow for Tauri E2E tests using the embedded WebDriver provider.
- Updated CI configuration to include jobs for running E2E tests on Linux, Windows, and macOS (ARM and Intel).
- Added new test scripts in package.json for various test types with the embedded provider.
- Enhanced WDIO configuration to support embedded WebDriver, allowing for direct app testing without external drivers.
- Updated Tauri application to include the necessary plugin for embedded WebDriver functionality.
greptile-apps[bot]

This comment was marked as off-topic.

…tform

- Updated the `js_value_to_json` function to enhance the serialization strategy for JavaScript values.
- Simplified handling of numbers by using `to_string()` for conversion and added checks for NaN and Infinity.
- Streamlined string handling to directly return the string representation.
- Consolidated fallback logic for non-serializable types to ensure robust handling of arrays and objects.
- Replaced app-level event emission with window-specific emission for better context handling.
- Adjusted listener management to ensure proper unsubscription from the window.
- Enhanced comments for clarity on the changes made to the event handling process.
…s structure

- Updated JSON schemas in both tauri-plugin and tauri-plugin-webdriver to improve formatting consistency.
- Ensured all required fields are clearly defined in arrays for better readability.
- Adjusted type definitions to maintain uniformity across permission structures.
- Refactored JSON serialization handling in the Linux platform to streamline number and string processing.
- Replaced the command for displaying E2E test logs in CI workflows to use the new script `show-logs.ts`.
- Enhanced the log directory path resolution in the `show-logs.ts` script for cross-platform compatibility.
@goosewobbler goosewobbler force-pushed the feat/embedded-webdriver branch from 0899171 to 9a10762 Compare February 20, 2026 16:47
- Added comments to the debug information steps in multiple CI workflows to clarify that the script cannot be poisoned by artifacts, as it only extracts specific directories to the workspace.
- Renamed CodeQL config for clarity and added documentation to explain why certain alerts are false positives.
- Introduced a new markdown file detailing the analysis of the `actions/artifact-poisoning` alerts and the rationale for dismissing them.
- Updated query filters to exclude the identified false positive alerts from CodeQL analysis.
- Added comments to clarify the intentional allowance of non-secure cookies for testing flexibility in the WebDriver implementation.
- Emphasized that this approach is necessary to support both secure and non-secure cookie scenarios as per the WebDriver specification.
…().emit

- Modified event emission to utilize getCurrentWindow().emit for window-specific events, enhancing context handling.
- Updated listener management to ensure proper unsubscription using a cloned window reference.
- Improved comments for clarity on the changes made to the event handling process.
@goosewobbler goosewobbler force-pushed the feat/embedded-webdriver branch from 79be7d6 to fd5e0bc Compare February 20, 2026 20:17
- Updated the binary detection logic for Windows to improve accuracy in finding .exe files.
- Added support for detecting macOS app bundles in multiple potential locations.
- Included additional debug output to display directory structures and search for .app bundles when no binaries are found, aiding in troubleshooting.
- Added additional debug output to list contents of release and bundle directories during CI runs on macOS.
- Improved visibility into the structure of target directories, aiding in troubleshooting and verification of build artifacts.
- Enhanced the logic to first check for raw binaries before looking for .app bundles in multiple locations.
- Updated comments for clarity on the binary detection process, aiding in troubleshooting and verification of build artifacts.
- Updated the binary detection logic to use -perm +111 for compatibility with macOS/BSD find, improving accuracy in identifying executable files.
- Enhanced comments for better understanding of the binary detection process, aiding in troubleshooting and verification of build artifacts.
- Modified the binary detection for macOS to check for raw binaries instead of skipping the check due to WKWebView limitations.
- Improved comments for clarity on the binary detection process, aiding in troubleshooting and verification of build artifacts.
- Added support for driver provider configuration in session options for Tauri capabilities.
- Updated logging tests to utilize the new driver provider option, improving flexibility in driver management.
- Removed auto-installation of the Tauri driver in session initialization for cleaner setup.
- Updated the script execution wrapping to use a function expression for embedded WebDriver, ensuring proper argument handling.
- Enhanced comments to clarify the differences in script evaluation between embedded and standard WebDriver contexts.
- Adjusted the script execution logic for embedded WebDriver to directly use the script string, avoiding syntax errors caused by the console wrapper.
- Updated comments to clarify the handling of script evaluation in embedded versus standard WebDriver contexts.
- Updated the script execution logic for embedded WebDriver to wrap the script in a return statement, ensuring proper argument handling and avoiding syntax errors.
- Adjusted comments to clarify the changes in script evaluation for embedded versus standard WebDriver contexts.
- Introduced `executeAsync` method for handling script execution in embedded WebDriver, preventing syntax errors related to return statements.
- Updated the script wrapping logic to ensure proper argument handling and compatibility with asynchronous execution.
- Enhanced comments to clarify the differences in script evaluation between embedded and standard WebDriver contexts.
- Removed the redundant `executeAsync` binding and updated the script execution logic to directly use `executeAsync` with a wrapped script for better handling of async scripts.
- Enhanced comments to clarify the differences in script evaluation for embedded versus standard WebDriver contexts.
…ements

Changes made:
1. executor.rs (line 883): Removed return from execute_script wrapper
      // Before: r"return (async function() { ... })();"
   // After:  r"(async function() { ... })()"

2. macos.rs (line 170): Removed return from execute_async_script wrapper
      // Before: r"return new Promise(...);"
   // After:  r"new Promise(...)"

3. linux.rs (line 457): Same fix for execute_async_script
4. tauri-service/src/service.ts: Simplified to pass scripts through for embedded mode (no executeAsync conversion needed)
The E2E tests should now work. The fix is at the correct layer - the embedded WebDriver now properly evaluates scripts as expressions rather than statements.
- Enhanced consistency in comment style across different platform implementations.
- Added a new function `detectWebView2Version` to accurately detect the WebView2 runtime version from the Windows registry, improving reliability for Tauri apps.
- Updated the existing `detectWebView2VersionFromBinary` function to be deprecated in favor of the new method, with adjusted logging for clarity.
- Enhanced the `ensureMsEdgeDriver` function to prioritize WebView2 runtime detection, falling back to the Tauri binary and then the system Edge version if necessary.
- Simplified the `ensureMsEdgeDriver` function by removing redundant version detection logic, now prioritizing the detection of the WebView2 runtime version directly.
- Enhanced logging to provide clearer information on the detected WebView2 runtime version and adjusted fallback behavior for improved reliability.
- Introduced a new log handler setup for capturing both stdout and stderr streams from the embedded WebDriver process, allowing for better log management.
- Updated the `startEmbeddedDriver` function to return an object containing the process and log handlers, improving the handling of embedded driver instances.
- Modified the `stopEmbeddedDriver` function to ensure log handlers are closed before terminating the process, enhancing resource management and error handling.
@goosewobbler goosewobbler linked an issue Feb 21, 2026 that may be closed by this pull request
- Implemented `script_timeout_ms` method across all platform executors (Android, iOS, Linux, macOS, Windows) to retrieve the script timeout value.
- Updated the script execution logic to utilize the new timeout feature, enhancing control over script execution duration.
- Improved the overall structure and comments in the script execution methods for better clarity and maintainability.
The execute command now uses browser.execute (sync) instead of
browser.executeAsync for plugin availability checking, so the
test mock needs to return true for browser.execute as well.
executeAsync is deprecated and no longer used in the service code.
The plugin availability check now uses browser.execute (sync) instead
of browser.executeAsync, so the mocks don't need executeAsync.
- Restore polling logic for plugin availability check using browser.execute
  (sync) instead of browser.executeAsync. This fixes Linux tests where
  the plugin might not be immediately available on page load.

- Fix execute-advanced tests that failed due to TypeScript/esbuild
  injecting __name helper when inner functions are used. Tests now use
  string form to avoid transpilation issues.
- Replaced the deprecated setupStreamLogHandler with a new createLogCapture function for capturing stdout and stderr logs in both driverProcess and embeddedProvider.
- Introduced a logWriter for managing log file output, enhancing the logging capabilities for both standalone and embedded modes.
- Updated related functions and tests to reflect the new log handling structure, ensuring better resource management and error handling.
- Consolidated the structure of JSON schemas across various files, ensuring consistent formatting and improved readability.
- Updated required fields in schemas to be arrays for better validation and clarity.
- Enhanced the descriptions and properties in the schemas to provide clearer guidance on usage and expected values.
- Removed unnecessary whitespace and ensured all files end with a newline for consistency.
- Reformatted JSON schemas across multiple files to ensure consistent structure and readability.
- Updated required fields to be arrays for better validation and clarity.
- Enhanced descriptions and properties to provide clearer guidance on usage.
- Removed unnecessary whitespace and ensured all files end with a newline for consistency.
- Modified the artifact naming convention in the CI workflows to include the architecture alongside the OS, improving clarity and organization of generated artifacts.
- Updated paths in the download and upload actions to reflect the new naming structure, ensuring consistency across the workflows.
- Updated the log directory naming convention in the standalone logging tests to include the driver provider, enhancing clarity in log organization.
- Modified the log writer initialization in the TauriLaunchService to prevent re-initialization if already set up, improving efficiency and reducing unnecessary operations.
@goosewobbler goosewobbler force-pushed the feat/embedded-webdriver branch from fadfdbd to 4ec4c9e Compare February 22, 2026 03:10
- Updated the test configuration files to clarify the exclusion of specific tests related to mocking, window, and deeplink functionalities, as well as added exclusions for logging tests that document embedded limitations.
- Introduced new logging tests to verify console method capture in both embedded and tauri-driver contexts, ensuring comprehensive coverage of logging functionalities.
- Improved the naming and organization of logging tests to better reflect their purpose and context.
@goosewobbler goosewobbler force-pushed the feat/embedded-webdriver branch from 4ec4c9e to cd8022d Compare February 22, 2026 20:22
- Updated the timeout duration for script execution from 10 seconds to 30 seconds to enhance reliability and match the WebDriver default script timeout.
- Adjusted related logging messages to reflect the new timeout value, ensuring consistency in error reporting.
- Added `tokio` as a dependency in the Cargo.toml files for better async support.
- Reformatted JSON schemas across multiple files to ensure consistent structure and readability.
- Updated required fields in schemas to be arrays for better validation and clarity.
- Enhanced descriptions and properties in the schemas to provide clearer guidance on usage and expected values.
- Removed unnecessary whitespace and ensured all files end with a newline for consistency.
- Updated the log directory naming convention in the multiremote logging tests to differentiate between 'embedded' and 'tauri-driver' contexts, improving clarity in log organization.
- Introduced logic to determine the appropriate log directory based on the DRIVER_PROVIDER environment variable, ensuring accurate log file placement.
- Improved error handling in the `evaluate_js` method by wrapping the transmission channel in an `Arc<Mutex<Option<...>>>`, allowing for better management of error states during script execution.
- Added detailed logging for script execution failures, including specific messages for CoreWebView2 retrieval issues and unexpected channel closures.
- Updated the `status` endpoint to reflect the readiness of the WebDriver server based on the availability of webview windows, providing clearer feedback on initialization status.
- Updated the error logging message in the WindowsExecutor to remove the specific window label, streamlining the log output for script execution failures related to CoreWebView2 retrieval.
- Cloned the transmission channel for the ExecuteScriptHandler to ensure proper error handling during script execution.
- Added logging for script execution failures to handle cases where the handler is not called, improving overall error reporting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Embedded WebDriver Provider for Tauri Service Tauri Service - Windows Edgedriver version mismatch

1 participant