In chrome I can set some command line options to use a fake media device or set a video file as the media device:
"--allow-file-access-from-files
--use-fake-ui-for-media-stream
--allow-file-access
--use-file-for-fake-audio-capture=D:\\PATH\\TO\\WAV\\xxx.wav,
--use-fake-device-for-media-stream"
In Mozilla I can create a profile that will set the fake device. The example is for selenium but at the end of the day we just want a profile file that can be loaded, Mozilla can load a profile from the command line:
DesiredCapabilities capabilities =
DesiredCapabilities.firefox();
ProfilesIni profilesIni = new ProfilesIni();
FirefoxProfile profile = profilesIni.getProfile("John");
profile.setPreference("browser.privatebrowsing.autostart", true);
profile.setPreference("media.navigator.enabled", true);
profile.setPreference("media.navigator.permission.disabled", true);
profile.setPreference("media.navigator.streams.fake",
true);
capabilities.setCapability(FirefoxDriver.PROFILE,
profile);
How can I do this for Safari using Testcafe in Saucelabs?