Deeplink Testing
The service provides the ability to test custom protocol handlers and deeplinks in your Electron application using the browser.electron.triggerDeeplink() method. This feature automatically handles platform-specific differences, particularly on Windows where deeplinks would normally launch a new instance instead of reaching the test instance.
Overview
What is Deeplink Testing?
Deeplink testing allows you to verify that your Electron application correctly handles custom protocol URLs (e.g., myapp://action?param=value). This is essential when your app registers as a protocol handler and needs to respond to URLs opened from external sources like web browsers, emails, or other applications.
Why is it Needed?
Testing protocol handlers presents unique challenges:
- Windows Issue: On Windows, triggering a deeplink normally launches a new app instance instead of routing to the running test instance. This happens because the test instance and the externally-triggered instance use different user data directories.
- Test Automation: You need a programmatic way to trigger deeplinks without manual intervention.
- Cross-Platform Testing: Different platforms use different mechanisms to trigger protocol handlers.
When Should You Use It?
Use browser.electron.triggerDeeplink() when you need to:
- Test that your app correctly handles custom protocol URLs
- Verify deeplink parameter parsing and routing logic
- Ensure single-instance behavior works correctly
- Test protocol handler registration and activation
- Validate deeplink-driven workflows in your application