Camera Service Service
wdio-camera-service is a 3rd party package, for more information please see GitHub | npm
A WebdriverIO service that enables camera feed injection for testing applications that use camera/video inputs. This service allows you to mock camera feeds with pre-recorded video files during automated testing.
Features
- 🎥 Inject custom video feeds into Chrome browsers during testing
- 🔄 Dynamically change camera sources during test execution
- 📁 Automatic video directory management
- 🔄 Automatic format conversion - Use MP4, WebM, PNG, JPG and more (requires FFmpeg)
- 💾 Smart caching - Converted files are cached to avoid re-conversion
- 🧪 Perfect for testing camera-dependent applications like QR code scanners, video conferencing, etc.
Installation
npm install --save-dev wdio-camera-service
Configuration
Add the camera service to your WebdriverIO configuration:
// wdio.conf.ts
export const config: WebdriverIO.Config = {
// ... other config
services: [
['camera', {
defaultCameraFeed: './camera/default.mjpeg',
videoDirectory: './camera/video',
}],
],
// ... other config
};
Service Options
| Option | Type | Required | Default | Description |
|---|---|---|---|---|
defaultCameraFeed | string | ✅ | - | Path to the default video file |
videoDirectory | string | ✅ | - | Directory for session-specific video files |
ffmpegPath | string | ❌ | 'ffmpeg' | Custom path to FFmpeg executable |
cacheEnabled | boolean | ❌ | true | Enable caching of converted files |
outputFormat | 'mjpeg' | 'y4m' | ❌ | 'mjpeg' | Output format for converted files |
Supported Formats
The service supports multiple input formats with automatic conversion:
Native Formats (No Conversion)
.mjpeg- Motion JPEG.y4m- YUV4MPEG2