Testing WebRTC applications

When writing automated tests for your WebRTC applications, there are useful configurations that can be enabled for browsers that make development and testing easier.

Chrome

When running automated tests on Chrome, the following arguments are useful when launching:

  • --allow-file-access-from-files - Allows API access for file:// URLs
  • --disable-translate - Disables the translation popup
  • --use-fake-ui-for-media-stream - Provide fake media streams. Useful when running on CI servers.
  • --use-file-for-fake-audio-capture=<filename> - Provide a file to use when capturing audio.
  • --use-file-for-fake-video-capture=<filename> - Provide a file to use when capturing video.
  • --headless - Run in headless mode. Useful when running on CI servers.
  • --mute-audio - Mute audio output.

Firefox

When running automated tests on Firefox, we need to provide a set of preference keys that will be used on the launched instance. Below is the configuration used for the WebRTC samples automated tests:

"prefs": {
    "browser.cache.disk.enable": false,
    "browser.cache.disk.capacity": 0,
    "browser.cache.disk.smart_size.enabled": false,
    "browser.cache.disk.smart_size.first_run": false,
    "browser.sessionstore.resume_from_crash": false,
    "browser.startup.page": 0,
    "media.navigator.streams.fake": true,
    "media.navigator.permission.disabled": true,
    "device.storage.enabled": false,
    "media.gstreamer.enabled": false,
    "browser.startup.homepage": "about:blank",
    "browser.startup.firstrunSkipsHomepage": false,
    "extensions.update.enabled": false,
    "app.update.enabled": false,
    "network.http.use-cache": false,
    "browser.shell.checkDefaultBrowser": false
}